From 3847331e9dcee0bb78963b6a7cbe10ac16c32fba Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Wed, 14 Jun 2023 11:46:39 +0100 Subject: [PATCH] Added pytest.mark.paramterize to floor tests --- epc_data/tests/test_floor_attributes.py | 18 ++++++++++-------- epc_data/tests/test_roof_attributes.py | 1 - 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/epc_data/tests/test_floor_attributes.py b/epc_data/tests/test_floor_attributes.py index 0fd1bf2a..7e8f5b4c 100644 --- a/epc_data/tests/test_floor_attributes.py +++ b/epc_data/tests/test_floor_attributes.py @@ -19,14 +19,16 @@ class TestCleanFloor: with pytest.raises(ValueError): FloorAttributes('description without keywords') - def test_process_floor(self): - for test_case in clean_floor_cases: - result = FloorAttributes(test_case['original_description']).process() - # Ensure the output ordering is correct - expected_result = {key: test_case[key] for key in result.keys()} - expected_result["desc"] = test_case["original_description"] - result["desc"] = test_case["original_description"] - assert result == expected_result + @pytest.mark.parametrize( + "test_case", + clean_floor_cases + ) + def test_process_floor(self, test_case): + expected_result = test_case.copy() + del expected_result["original_description"] + result = FloorAttributes(test_case['original_description']).process() + # Ensure the output ordering is correct + assert sorted(result.items()) == sorted(expected_result.items()) def test_invalid_description(self): # Test that invalid descriptions raise a ValueError diff --git a/epc_data/tests/test_roof_attributes.py b/epc_data/tests/test_roof_attributes.py index 8d0a1e3e..246e40a2 100644 --- a/epc_data/tests/test_roof_attributes.py +++ b/epc_data/tests/test_roof_attributes.py @@ -61,7 +61,6 @@ class TestRoofAttributes: del expected_result["original_description"] result = RoofAttributes(test_case['original_description']).process() # Ensure the output ordering is correct - # Ensure the output ordering is correct assert sorted(result.items()) == sorted(expected_result.items()) def test_clean_roof_with_dwelling_above(self):