def test_dictionary_property_invalid_key(d): dict_prop = DictionaryProperty() with pytest.raises(DictionaryKeyError) as excinfo: dict_prop.clean(d[0]) assert str(excinfo.value) == d[1]
def test_dictionary_property_valid(d): dict_prop = DictionaryProperty() assert dict_prop.clean(d)
def test_dictionary_property(): p = DictionaryProperty(StringProperty) assert p.clean({'spec_version': '2.1'}) with pytest.raises(ValueError): p.clean({})
def test_dictionary_property_invalid(d): dict_prop = DictionaryProperty(spec_version='2.1') with pytest.raises(ValueError) as excinfo: dict_prop.clean(d[0]) assert str(excinfo.value) == d[1]
def test_dictionary_no_longer_raises(d): dict_prop = DictionaryProperty(spec_version='2.1') dict_prop.clean(d[0])
def test_dictionary_property_valid(d): dict_prop = DictionaryProperty(spec_version='2.1') assert dict_prop.clean(d)