def test_check_for_label_duplicates_fails(): ASSET = "asset" A_LABEL = "a_label" dict_values = { ENERGY_PRODUCTION: { ASSET: { LABEL: A_LABEL } }, ENERGY_PROVIDERS: { ASSET: { LABEL: A_LABEL } }, } with pytest.raises(DuplicateLabels): C1.check_for_label_duplicates( dict_values ), f"Eventhough there is a duplicate value of label, no error is raised."
def test_check_for_label_duplicates_passes(): ASSET = "asset" A_LABEL = "a_label" B_LABEL = "b_label" dict_values = { ENERGY_PRODUCTION: { ASSET: { LABEL: A_LABEL } }, ENERGY_PROVIDERS: { ASSET: { LABEL: B_LABEL } }, } C1.check_for_label_duplicates(dict_values) assert ( 1 == 1 ), f"There is no duplicate value for label, but still an error is raised."