From 7f2f2b95a0b0e304f2003ea13063884ebe55fd40 Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Mon, 1 Jun 2026 09:34:35 +0000 Subject: [PATCH] update tests to reflect wall types --- ..._wall_type_override_postgres_repository.py | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/repositories/landlord_overrides/postgres/test_landlord_wall_type_override_postgres_repository.py b/tests/repositories/landlord_overrides/postgres/test_landlord_wall_type_override_postgres_repository.py index 2aae83dd..4cee6f5a 100644 --- a/tests/repositories/landlord_overrides/postgres/test_landlord_wall_type_override_postgres_repository.py +++ b/tests/repositories/landlord_overrides/postgres/test_landlord_wall_type_override_postgres_repository.py @@ -49,13 +49,13 @@ def test_inserts_a_fresh_row_with_source_classifier(session: Session) -> None: # act repo.upsert_all( - portfolio_id=1, descriptions_to_values={"cavity insulated": WallType.CAVITY} + portfolio_id=1, descriptions_to_values={"cavity insulated": WallType.CAVITY_FILLED} ) session.commit() # assert row = _select_row(session, portfolio_id=1, description="cavity insulated") - assert row.value is WallType.CAVITY + assert row.value is WallType.CAVITY_FILLED assert row.source == OverrideSource.CLASSIFIER @@ -63,19 +63,19 @@ def test_reupsert_overwrites_a_classifier_row(session: Session) -> None: # arrange: a stale classifier row exists. repo = LandlordWallTypeOverridePostgresRepository(session) repo.upsert_all( - portfolio_id=1, descriptions_to_values={"old red brick": WallType.CAVITY} + portfolio_id=1, descriptions_to_values={"old red brick": WallType.CAVITY_FILLED} ) session.commit() # act: re-classify with a different category. repo.upsert_all( - portfolio_id=1, descriptions_to_values={"old red brick": WallType.SOLID_BRICK} + portfolio_id=1, descriptions_to_values={"old red brick": WallType.SOLID_BRICK_AS_BUILT_NO_INSULATION_ASSUMED} ) session.commit() # assert: the new classification wins. row = _select_row(session, portfolio_id=1, description="old red brick") - assert row.value is WallType.SOLID_BRICK + assert row.value is WallType.SOLID_BRICK_AS_BUILT_NO_INSULATION_ASSUMED assert row.source == OverrideSource.CLASSIFIER @@ -86,7 +86,7 @@ def test_reupsert_does_not_overwrite_a_user_row(session: Session) -> None: user_row = LandlordWallTypeOverrideRow( portfolio_id=1, description="old red brick", - value=WallType.SANDSTONE, + value=WallType.SANDSTONE_AS_BUILT_NO_INSULATION_ASSUMED, source=OverrideSource.USER, ) session.add(user_row) @@ -97,13 +97,13 @@ def test_reupsert_does_not_overwrite_a_user_row(session: Session) -> None: # be silently skipped -- user edits beat classifier reruns. repo = LandlordWallTypeOverridePostgresRepository(session) repo.upsert_all( - portfolio_id=1, descriptions_to_values={"old red brick": WallType.SOLID_BRICK} + portfolio_id=1, descriptions_to_values={"old red brick": WallType.SOLID_BRICK_AS_BUILT_NO_INSULATION_ASSUMED} ) session.commit() # assert: the user row is unchanged. row = _select_row(session, portfolio_id=1, description="old red brick") - assert row.value is WallType.SANDSTONE + assert row.value is WallType.SANDSTONE_AS_BUILT_NO_INSULATION_ASSUMED assert row.source == OverrideSource.USER @@ -114,16 +114,16 @@ def test_upsert_keeps_other_portfolios_descriptions_independent( # same description for two different portfolios must coexist as two rows. repo = LandlordWallTypeOverridePostgresRepository(session) repo.upsert_all( - portfolio_id=1, descriptions_to_values={"old red brick": WallType.CAVITY} + portfolio_id=1, descriptions_to_values={"old red brick": WallType.CAVITY_FILLED} ) repo.upsert_all( - portfolio_id=2, descriptions_to_values={"old red brick": WallType.SOLID_BRICK} + portfolio_id=2, descriptions_to_values={"old red brick": WallType.SOLID_BRICK_AS_BUILT_NO_INSULATION_ASSUMED} ) session.commit() # assert: both rows survive with their own values. - assert _select_row(session, 1, "old red brick").value is WallType.CAVITY - assert _select_row(session, 2, "old red brick").value is WallType.SOLID_BRICK + assert _select_row(session, 1, "old red brick").value is WallType.CAVITY_FILLED + assert _select_row(session, 2, "old red brick").value is WallType.SOLID_BRICK_AS_BUILT_NO_INSULATION_ASSUMED def test_upsert_persists_unknown_so_a_user_can_resolve_it_later(