def test_generate_prev(): replacements = {"e": ["H", "O"], "H": ["HO", "OH"], "O": ["HH"]} assert generate_prev("HOH", reverse_dict(replacements)) == {"HH"} assert generate_prev("HH", reverse_dict(replacements)) == {"O"} assert generate_prev("O", reverse_dict(replacements)) == {"e"}
def test_reverse_dict(): replacements = {"e": ["H", "O"], "H": ["HO", "OH"], "O": ["HH"]} assert reverse_dict(replacements) == {"H": ["e"], "O": ["e"], "HO": ["H"], "OH": ["H"], "HH": ["O"]}