def test_potential_get_matching_entry(): entry1 = PotentialEntry().add(0, 'on').add(1, 'on') entry2 = PotentialEntry().add(0, 'on').add(1, 'off') entry3 = PotentialEntry().add(0, 'off').add(1, 'on') entry4 = PotentialEntry().add(0, 'off').add(1, 'off') entry5 = PotentialEntry().add(3, 'off').add(1, 'off') potential = Potential()\ .add_entry(entry1)\ .add_entry(entry2)\ .add_entry(entry3)\ .add_entry(entry4) assert len(potential.get_matching_entries(entry1)) == 1 assert len(potential.get_matching_entries(entry2)) == 1 assert len(potential.get_matching_entries(entry3)) == 1 assert len(potential.get_matching_entries(entry4)) == 1 assert len(potential.get_matching_entries(entry5)) == 0
def test_potential_get_matching_entry(): """ Tests get matching entry from potential. :return: None. """ entry1 = PotentialEntry().add(0, 'on').add(1, 'on') entry2 = PotentialEntry().add(0, 'on').add(1, 'off') entry3 = PotentialEntry().add(0, 'off').add(1, 'on') entry4 = PotentialEntry().add(0, 'off').add(1, 'off') entry5 = PotentialEntry().add(3, 'off').add(1, 'off') potential = Potential() \ .add_entry(entry1) \ .add_entry(entry2) \ .add_entry(entry3) \ .add_entry(entry4) assert len(potential.get_matching_entries(entry1)) == 1 assert len(potential.get_matching_entries(entry2)) == 1 assert len(potential.get_matching_entries(entry3)) == 1 assert len(potential.get_matching_entries(entry4)) == 1 assert len(potential.get_matching_entries(entry5)) == 0