def test_parse_single_key(keystr, expected): if expected is utils.KeyParseError: with pytest.raises(utils.KeyParseError): utils._parse_single_key(keystr) else: assert utils._parse_single_key(keystr) == expected