# Chalk Python SDK Reference: Testing
source: https://docs.chalk.ai/api-docs#section-testing

## `assert_frame_equal(left, right, check_column_order, check_row_order)`
source: https://docs.chalk.ai/api-docs#assert_frame_equal

Given two [`DataFrame`](https://docs.chalk.ai/api-docs#DataFrame)s, `left` and `right`, check if `left == right`, and raise otherwise.

**Parameters**

- `left`: `DataFrame`
  The [`DataFrame`](https://docs.chalk.ai/api-docs#DataFrame) to compare.
- `right`: `DataFrame`
  The [`DataFrame`](https://docs.chalk.ai/api-docs#DataFrame) to compare with.
- `check_column_order`: `bool` = `True`
  If [`False`](https://docs.python.org/3/library/constants.html#False), allows the assert/test to succeed if the required columns are present, irrespective of the order in which they appear.
- `check_row_order`: `bool` = `True`
  If [`False`](https://docs.python.org/3/library/constants.html#False), allows the assert/test to succeed if the required rows are present, irrespective of the order in which they appear; as this requires sorting, you cannot set on frames that contain un-sortable columns.

**Raises**

- `AssertionError`: If `left` does not equal `right`
- `MissingDependencyException`: If `chalkpy[runtime]` is not installed.

## `freeze_time`
source: https://docs.chalk.ai/api-docs#freeze_time

Class

### `freeze_time.__init__(at)`
source: https://docs.chalk.ai/api-docs#freeze_time.__init__

Used to freeze the 'now' value used to execute filters like `after(days_ago=30)`.

**Parameters**

- `at`: `datetime`
  The time to freeze to. Must be timezone aware.

**Examples**

```python
from chalk.features import online, DataFrame
from datetime import datetime, timedelta, timezone
@online
def get_average_spend_30d(
    spend: User.cards[after(days_ago=30)],
) -> User.average_spend_30d:
    return spend.mean()
with freeze_time(datetime(2021, 1, 1, tzinfo=timezone.utc)):
    now = datetime.now(tz=timezone.utc)
    get_average_spend_30d(
        spend=DataFrame([
            Card(spend=10, ts=now - timedelta(days=31)),
            Card(spend=20, ts=now - timedelta(days=29)),
            Card(spend=30, ts=now - timedelta(days=28)),
        ])
    )
```

### `freeze_time.time()`
source: https://docs.chalk.ai/api-docs#freeze_time.time

Returns the current time that filters will use.

**Returns**

`datetime`

The current time that filters will use.

**Examples**

```python
with freeze_time(datetime(2021, 1, 1, tzinfo=timezone.utc)) as ft:
    assert ft.time() == datetime(2021, 1, 1, tzinfo=timezone.utc)
```

### `freeze_time.__enter__()`
source: https://docs.chalk.ai/api-docs#freeze_time.__enter__

The freeze_time class is a context manager, so it can be used with the `with` statement. The `__enter__` method is called when entering the context manager.

### `freeze_time.__exit__(__exc_type, __exc_value, __traceback)`
source: https://docs.chalk.ai/api-docs#freeze_time.__exit__

The freeze_time class is a context manager, so it can be used with the `with` statement. The `__exit__` method is automatically called when exiting the context manager.
