Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set check_dtype=False for tests #745

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions lumen/tests/sources/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
except ImportError:
fastparquet = None

from ..utils import assert_frame_equal_no_dtype_check


@pytest.fixture
def source(make_filesource):
root = os.path.dirname(__file__)
Expand Down Expand Up @@ -95,7 +98,7 @@
column, value, _ = column_value_type
kwargs = {column: value, '__dask': dask}
filtered = source.get('test', **kwargs)
pd.testing.assert_frame_equal(filtered, expected_df)
assert_frame_equal_no_dtype_check(filtered, expected_df)


@pytest.mark.parametrize(
Expand All @@ -122,8 +125,8 @@
assert cache_key in source._cache
cached_df = source._cache[cache_key]
if dask:
cached_df = cached_df.compute()

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / core:test-core:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type1] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / core:test-core:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type2] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / core:test-core:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type3] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / core:test-core:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type0] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / core:test-core:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type5] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / core:test-core:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type7] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / core:test-core:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type6] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / core:test-core:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type4] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / core:test-core:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type8] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / core:test-core:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type10] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type0] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type1] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type2] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type5] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type3] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type4] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type6] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type9] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type10] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type7] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:macos-latest

test_file_source_get_query_cache[True-column_value_type2] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:macos-latest

test_file_source_get_query_cache[True-column_value_type1] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:macos-latest

test_file_source_get_query_cache[True-column_value_type0] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:macos-latest

test_file_source_get_query_cache[True-column_value_type5] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:macos-latest

test_file_source_get_query_cache[True-column_value_type3] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:macos-latest

test_file_source_get_query_cache[True-column_value_type4] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:macos-latest

test_file_source_get_query_cache[True-column_value_type7] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:macos-latest

test_file_source_get_query_cache[True-column_value_type6] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:macos-latest

test_file_source_get_query_cache[True-column_value_type9] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-310:macos-latest

test_file_source_get_query_cache[True-column_value_type10] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-312:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type0] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-312:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type1] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-312:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type3] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-312:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type2] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-312:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type4] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-312:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type5] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-312:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type6] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-312:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type7] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-312:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type9] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-312:ubuntu-latest

test_file_source_get_query_cache[True-column_value_type10] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-312:macos-latest

test_file_source_get_query_cache[True-column_value_type2] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-312:macos-latest

test_file_source_get_query_cache[True-column_value_type0] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-312:macos-latest

test_file_source_get_query_cache[True-column_value_type1] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-312:macos-latest

test_file_source_get_query_cache[True-column_value_type3] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-312:macos-latest

test_file_source_get_query_cache[True-column_value_type5] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-312:macos-latest

test_file_source_get_query_cache[True-column_value_type4] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-312:macos-latest

test_file_source_get_query_cache[True-column_value_type8] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-312:macos-latest

test_file_source_get_query_cache[True-column_value_type7] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-312:macos-latest

test_file_source_get_query_cache[True-column_value_type6] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?

Check failure on line 128 in lumen/tests/sources/test_base.py

View workflow job for this annotation

GitHub Actions / unit:test-312:macos-latest

test_file_source_get_query_cache[True-column_value_type10] AttributeError: 'DataFrame' object has no attribute 'compute'. Did you mean: 'compare'?
pd.testing.assert_frame_equal(cached_df, expected_df)
assert_frame_equal_no_dtype_check(cached_df, expected_df)
cache_key = source._get_key('test', **kwargs)
assert cache_key in source._cache

Expand Down Expand Up @@ -160,7 +163,7 @@

# Patch index names due to https://github.com/dask/fastparquet/issues/732
df.index.names = [None]
pd.testing.assert_frame_equal(
assert_frame_equal_no_dtype_check(
df,
makeMixedDataFrame().iloc[1:3]
)
Expand All @@ -177,7 +180,7 @@
state.variables.tables = {'test': 'test2.csv'}
df = source.get('test')
expected = mixed_df.iloc[::-1].reset_index(drop=True)
pd.testing.assert_frame_equal(df, expected)
assert_frame_equal_no_dtype_check(df, expected)


def test_extension_of_comlicated_url(source):
Expand Down
13 changes: 7 additions & 6 deletions lumen/tests/sources/test_derived.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import os

import pandas as pd
import pytest

from lumen.sources.base import DerivedSource, Source

from ..utils import assert_frame_equal_no_dtype_check


@pytest.fixture
def original(make_filesource):
Expand Down Expand Up @@ -60,7 +61,7 @@ def test_derived_mirror_source(original, mirror_mode_spec):
assert derived.get_tables() == original.get_tables()
assert derived.get_schema() == original.get_schema()
for table in original.get_tables():
pd.testing.assert_frame_equal(derived.get(table), original.get(table))
assert_frame_equal_no_dtype_check(derived.get(table), original.get(table))


@pytest.mark.parametrize("additional_spec", [
Expand All @@ -75,13 +76,13 @@ def test_derived_mirror_source_apply(
derived = Source.from_spec(mirror_mode_spec)
assert derived.get_tables() == original.get_tables()
assert derived.get_schema('test') == expected_schema
pd.testing.assert_frame_equal(derived.get('test'), expected_table)
assert_frame_equal_no_dtype_check(derived.get('test'), expected_table)


def test_derived_tables_source(original, tables_mode_spec, mixed_df):
derived = Source.from_spec(tables_mode_spec)
assert derived.get_tables() == ['derived']
pd.testing.assert_frame_equal(derived.get('derived'), mixed_df)
assert_frame_equal_no_dtype_check(derived.get('derived'), mixed_df)
assert original.get_schema('test') == derived.get_schema('derived')


Expand All @@ -96,7 +97,7 @@ def test_derived_tables_source_apply(
tables_mode_spec['tables']['derived'][spec_key] = spec_value
derived = Source.from_spec(tables_mode_spec)
assert derived.get_tables() == ['derived']
pd.testing.assert_frame_equal(derived.get('derived'), expected_table)
assert_frame_equal_no_dtype_check(derived.get('derived'), expected_table)
assert derived.get_schema('derived') == expected_schema


Expand All @@ -106,7 +107,7 @@ def test_derived_get_query_cache(original, mirror_mode_spec):
cache_key = derived._get_key('test')
assert cache_key in derived._cache
cached_df = derived._cache[cache_key]
pd.testing.assert_frame_equal(cached_df, df)
assert_frame_equal_no_dtype_check(cached_df, df)


def test_derived_clear_cache(original, mirror_mode_spec):
Expand Down
12 changes: 6 additions & 6 deletions lumen/tests/sources/test_duckdb.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import datetime as dt
import os

import pandas as pd
import pytest

from lumen.transforms.sql import SQLGroupBy
Expand All @@ -12,6 +11,7 @@
except ImportError:
pytestmark = pytest.mark.skip(reason="Duckdb is not installed")

from ..utils import assert_frame_equal_no_dtype_check


@pytest.fixture
Expand Down Expand Up @@ -49,7 +49,7 @@ def test_duckdb_get_tables(duckdb_source, source_tables):
tables = duckdb_source.get_tables()
assert not len(set(tables) - set(source_tables.keys()))
for table in tables:
pd.testing.assert_frame_equal(
assert_frame_equal_no_dtype_check(
duckdb_source.get(table),
source_tables[table],
)
Expand Down Expand Up @@ -119,7 +119,7 @@ def test_duckdb_filter(duckdb_source, table_column_value_type, dask, expected_fi
table, column, value, _ = table_column_value_type
kwargs = {column: value}
filtered = duckdb_source.get(table, __dask=dask, **kwargs)
pd.testing.assert_frame_equal(filtered, expected_filtered_df.reset_index(drop=True))
assert_frame_equal_no_dtype_check(filtered, expected_filtered_df.reset_index(drop=True))


@pytest.mark.flaky(reruns=3)
Expand All @@ -128,7 +128,7 @@ def test_duckdb_transforms(duckdb_source, source_tables):
transforms = [SQLGroupBy(by=['B'], aggregates={'SUM': 'A'})]
transformed = duckdb_source.get('test_sql', sql_transforms=transforms)
expected = df_test_sql.groupby('B')['A'].sum().reset_index()
pd.testing.assert_frame_equal(transformed, expected)
assert_frame_equal_no_dtype_check(transformed, expected)


@pytest.mark.flaky(reruns=3)
Expand All @@ -141,7 +141,7 @@ def test_duckdb_transforms_cache(duckdb_source, source_tables):
assert cache_key in duckdb_source._cache

expected = df_test_sql.groupby('B')['A'].sum().reset_index()
pd.testing.assert_frame_equal(duckdb_source._cache[cache_key], expected)
assert_frame_equal_no_dtype_check(duckdb_source._cache[cache_key], expected)

cache_key = duckdb_source._get_key('test_sql', sql_transforms=transforms)
assert cache_key in duckdb_source._cache
Expand All @@ -166,4 +166,4 @@ def test_duckdb_source_ephemeral_roundtrips(duckdb_memory_source, mixed_df):

def test_duckdb_source_mirrors_source(duckdb_source):
mirrored = DuckDBSource(uri=':memory:', mirrors={'mixed': (duckdb_source, 'test_sql')})
pd.testing.assert_frame_equal(duckdb_source.get('test_sql'), mirrored.get('mixed'))
assert_frame_equal_no_dtype_check(duckdb_source.get('test_sql'), mirrored.get('mixed'))
9 changes: 5 additions & 4 deletions lumen/tests/sources/test_intake.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import datetime as dt
import os

import pandas as pd
import pytest
import yaml

from lumen.sources.intake import IntakeSource

from ..utils import assert_frame_equal_no_dtype_check


@pytest.fixture
def source():
Expand Down Expand Up @@ -36,15 +37,15 @@ def test_intake_resolve_module_type():


def test_intake_source_from_file(source, mixed_df):
pd.testing.assert_frame_equal(source.get('test'), mixed_df)
assert_frame_equal_no_dtype_check(source.get('test'), mixed_df)


def test_intake_source_from_dict(mixed_df):
root = os.path.dirname(__file__)
with open(os.path.join(root, 'catalog.yml')) as f:
catalog = yaml.load(f, Loader=yaml.Loader)
source = IntakeSource(catalog=catalog, root=root)
pd.testing.assert_frame_equal(source.get('test'), mixed_df)
assert_frame_equal_no_dtype_check(source.get('test'), mixed_df)


@pytest.mark.parametrize(
Expand All @@ -65,4 +66,4 @@ def test_intake_filter(source, table_column_value_type, dask, expected_filtered_
table, column, value, _ = table_column_value_type
kwargs = {column: value}
filtered = source.get(table, __dask=dask, **kwargs)
pd.testing.assert_frame_equal(filtered, expected_filtered_df)
assert_frame_equal_no_dtype_check(filtered, expected_filtered_df)
11 changes: 6 additions & 5 deletions lumen/tests/sources/test_intake_sql.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import datetime as dt
import os

import pandas as pd
import pytest

try:
Expand All @@ -12,6 +11,8 @@
from lumen.sources.intake_sql import IntakeSQLSource
from lumen.transforms.sql import SQLGroupBy

from ..utils import assert_frame_equal_no_dtype_check


@pytest.fixture
def source():
Expand All @@ -31,7 +32,7 @@ def test_intake_sql_get_tables(source, source_tables):
tables = source.get_tables()
assert tables == list(source_tables.keys())
for table in tables:
pd.testing.assert_frame_equal(source.get(table), source_tables[table])
assert_frame_equal_no_dtype_check(source.get(table), source_tables[table])


def test_intake_sql_get_schema(source):
Expand Down Expand Up @@ -99,15 +100,15 @@ def test_intake_sql_filter(source, table_column_value_type, dask, expected_filte
table, column, value, _ = table_column_value_type
kwargs = {column: value}
filtered = source.get(table, __dask=dask, **kwargs)
pd.testing.assert_frame_equal(filtered, expected_filtered_df.reset_index(drop=True))
assert_frame_equal_no_dtype_check(filtered, expected_filtered_df.reset_index(drop=True))


def test_intake_sql_transforms(source, source_tables):
df_test_sql = source_tables['test_sql']
transforms = [SQLGroupBy(by=['B'], aggregates={'SUM': 'A'})]
transformed = source.get('test_sql', sql_transforms=transforms)
expected = df_test_sql.groupby('B')['A'].sum().reset_index()
pd.testing.assert_frame_equal(transformed, expected)
assert_frame_equal_no_dtype_check(transformed, expected)


def test_intake_sql_transforms_cache(source, source_tables):
Expand All @@ -119,7 +120,7 @@ def test_intake_sql_transforms_cache(source, source_tables):
assert cache_key in source._cache

expected = df_test_sql.groupby('B')['A'].sum().reset_index()
pd.testing.assert_frame_equal(source._cache[cache_key], expected)
assert_frame_equal_no_dtype_check(source._cache[cache_key], expected)

cache_key = source._get_key('test_sql', sql_transforms=transforms)
assert cache_key in source._cache
Expand Down
18 changes: 9 additions & 9 deletions lumen/tests/test_dashboard.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import pathlib

import pandas as pd
import panel as pn
import pytest

Expand All @@ -10,6 +9,7 @@
from lumen.validation import ValidationError

from .test_pipeline import sql_available
from .utils import assert_frame_equal_no_dtype_check


def test_dashboard_with_local_view(set_root):
Expand Down Expand Up @@ -131,11 +131,11 @@ def test_dashboard_with_sql_source_and_transforms(set_root, document, mixed_df_o
layout.update()

table = layout._cards[0]._card[0][0]
pd.testing.assert_frame_equal(table.value, mixed_df_object_type)
assert_frame_equal_no_dtype_check(table.value, mixed_df_object_type)

dashboard._sidebar[0][0][0]._widgets['limit'].value = 2

pd.testing.assert_frame_equal(table.value, mixed_df_object_type.iloc[:2])
assert_frame_equal_no_dtype_check(table.value, mixed_df_object_type.iloc[:2])

def test_dashboard_with_transform_variable(set_root, document, mixed_df):
root = pathlib.Path(__file__).parent / 'sample_dashboard'
Expand All @@ -146,11 +146,11 @@ def test_dashboard_with_transform_variable(set_root, document, mixed_df):
layout.update()

table = layout._cards[0]._card[0][0]
pd.testing.assert_frame_equal(table.value, mixed_df)
assert_frame_equal_no_dtype_check(table.value, mixed_df)

state.variables.length = 2

pd.testing.assert_frame_equal(table.value, mixed_df.iloc[:2])
assert_frame_equal_no_dtype_check(table.value, mixed_df.iloc[:2])

def test_dashboard_with_source_variable(set_root, document, mixed_df):
root = pathlib.Path(__file__).parent / 'sample_dashboard'
Expand All @@ -161,11 +161,11 @@ def test_dashboard_with_source_variable(set_root, document, mixed_df):
layout.update()

table = layout._cards[0]._card[0][0]
pd.testing.assert_frame_equal(table.value, mixed_df)
assert_frame_equal_no_dtype_check(table.value, mixed_df)

state.variables.tables = {'test': '../sources/test2.csv'}

pd.testing.assert_frame_equal(table.value, mixed_df.iloc[::-1].reset_index(drop=True))
assert_frame_equal_no_dtype_check(table.value, mixed_df.iloc[::-1].reset_index(drop=True))

def test_dashboard_with_nested_source_variable(set_root, document, mixed_df):
root = pathlib.Path(__file__).parent / 'sample_dashboard'
Expand All @@ -176,11 +176,11 @@ def test_dashboard_with_nested_source_variable(set_root, document, mixed_df):
layout.update()

table = layout._cards[0]._card[0][0]
pd.testing.assert_frame_equal(table.value, mixed_df)
assert_frame_equal_no_dtype_check(table.value, mixed_df)

state.variables.ticker = '../sources/test2.csv'

pd.testing.assert_frame_equal(table.value, mixed_df.iloc[::-1].reset_index(drop=True))
assert_frame_equal_no_dtype_check(table.value, mixed_df.iloc[::-1].reset_index(drop=True))

def test_dashboard_with_view_variable(set_root, document):
root = pathlib.Path(__file__).parent / 'sample_dashboard'
Expand Down
Loading
Loading