Skip to content

Commit

Permalink
Add test extending table filters to JSON/invented tables
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeknep committed May 30, 2023
1 parent db12169 commit 07bcdb1
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/relational/test_train_synthetics.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,28 @@ def test_train_synthetics_multiple_calls_additive(ecom, tmpdir):
assert set(mt._synthetics_train.models.keys()) == {"products", "users"}


def test_train_synthetics_models_for_dbs_with_invented_tables(documents, tmpdir):
mt = MultiTable(documents, project_display_name=tmpdir)
mt.train_synthetics()

assert set(mt._synthetics_train.models.keys()) == {
"users",
"payments",
"purchases-sfx",
"purchases-data-years-sfx",
}


def test_train_synthetics_table_filters_cascade_to_invented_tables(documents, tmpdir):
# When a user provides the ("public") name of a table that contained JSON and led
# to the creation of invented tables, we recognize that as implicitly applying to
# all the tables internally created from that source table.
mt = MultiTable(documents, project_display_name=tmpdir)
mt.train_synthetics(ignore={"purchases"})

assert set(mt._synthetics_train.models.keys()) == {"users", "payments"}


def test_train_synthetics_multiple_calls_overwrite(ecom, tmpdir, project):
project.create_model_obj.return_value = "m1"

Expand Down

0 comments on commit 07bcdb1

Please sign in to comment.