Esempio n. 1
0
def test_optional_dict_like_error():
    match = r"value must be a dict or dict_like \(i.e., a Mapping\)"
    with pytest.raises(TypeError, match=match):
        dict_like([], "value", optional=True)
    with pytest.raises(TypeError, match=match):
        dict_like({"a"}, "value", optional=True)
    with pytest.raises(TypeError, match=match):
        dict_like("a", "value", optional=True)
Esempio n. 2
0
def test_optional_dict_like_error():
    match = r'value must be a dict or dict_like \(i.e., a Mapping\)'
    with pytest.raises(TypeError, match=match):
        dict_like([], 'value', optional=True)
    with pytest.raises(TypeError, match=match):
        dict_like({'a'}, 'value', optional=True)
    with pytest.raises(TypeError, match=match):
        dict_like('a', 'value', optional=True)
Esempio n. 3
0
def test_optional_dict_like(dict_type):
    val = dict_type() if dict_type is not None else dict_type
    out = dict_like(val, "value", optional=True)
    assert isinstance(out, type(val))