def test_ordered_dict_key_validator():
"""Test ordered_dict key validator."""
schema = vol.Schema(cv.ordered_dict(cv.match_all, cv.string))
with pytest.raises(vol.Invalid):
schema({None: 1})
schema({'hello': 'world'})
schema = vol.Schema(cv.ordered_dict(cv.match_all, int))
with pytest.raises(vol.Invalid):
schema({'hello': 1})
schema({1: 'works'})
评论列表
文章目录