Skip to content

Commit

Permalink
fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan committed Aug 10, 2024
1 parent aee8228 commit e0e6de3
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tests/unit/lib/test_datachain.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,21 @@ def test_from_features(test_session):
def test_from_records_empty_chain_with_schema(test_session):
schema = {"my_file": File, "my_col": int}
ds = DataChain.from_records([], schema=schema, session=test_session)
ds_sys = ds.settings(sys=True)

ds_name = "my_ds"
ds.save(ds_name)
ds = DataChain(name=ds_name)

assert isinstance(ds.feature_schema, dict)
assert isinstance(ds.signals_schema, SignalSchema)
assert ds.schema.keys() == {"my_file", "my_col"}
assert set(ds.schema.values()) == {File, int}
assert ds.schema == {"my_file": File, "my_col": int}
assert ds.count() == 0

# check that columns have actually been created from schema

def test_from_records_empty_chain_with_schema_columns_created(test_session):
schema = {"my_file": File, "my_col": int}
ds_name = "my_ds"
ds = DataChain.from_records([], schema=schema, session=test_session).save(ds_name)
ds_sys = ds.settings(sys=True)

dr = ds_sys.catalog.warehouse.dataset_rows(ds_sys.catalog.get_dataset(ds_name))
assert sorted([c.name for c in dr.c]) == sorted(ds.signals_schema.db_signals())

Expand Down

0 comments on commit e0e6de3

Please sign in to comment.