Skip to content

Commit

Permalink
Give tests the same pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
JCZuurmond committed Aug 28, 2024
1 parent 213a12e commit 87a3370
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions tests/unit/hive_metastore/test_view_migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,27 +65,26 @@ def test_migrate_no_view_returns_empty_sequence(tables):

@pytest.mark.parametrize("tables", [("db1.t1", "db1.v1")], indirect=True)
def test_migrate_direct_view_returns_singleton_sequence(tables) -> None:
expected = ["hive_metastore.db1.v1"]
migration_index = MigrationIndex([MigrationStatus("db1", "t1", "cat1", "db1", "t1")])
sequencer = ViewsMigrationSequencer(tables, migration_index=migration_index)

batches = sequencer.sequence_batches()

sequence = list(flatten(batches))
assert len(sequence) == 1
assert sequence[0].src.key == "hive_metastore.db1.v1"
assert [t.src.key for t in flatten(batches)] == expected


@pytest.mark.parametrize("tables", [("db1.t1", "db1.v1", "db1.t2", "db1.v2")], indirect=True)
def test_migrate_direct_views_returns_sequence(tables) -> None:
expected = {"hive_metastore.db1.v1", "hive_metastore.db1.v2"}
expected = ["hive_metastore.db1.v1", "hive_metastore.db1.v2"]
migration_index = MigrationIndex(
[MigrationStatus("db1", "t1", "cat1", "db1", "t1"), MigrationStatus("db1", "t2", "cat1", "db1", "t2")]
)
sequencer = ViewsMigrationSequencer(tables, migration_index=migration_index)

batches = sequencer.sequence_batches()

assert {t.src.key for t in flatten(batches)} == expected
assert [t.src.key for t in flatten(batches)] == expected


@pytest.mark.parametrize("tables", [("db1.t1", "db1.v1", "db1.v4")], indirect=True)
Expand Down

0 comments on commit 87a3370

Please sign in to comment.