Beispiel #1
0
def test_StoreIO_type_check__works_on_multiple_types():
    """
    _type check should return True when attr type is correct
    """
    abcd = namedtuple('abc', ['a', 'b', 'c', "d"])
    x = abcd(1, 2.0, "3", {"k": 1})
    S = StoreIO(**x._asdict())
    assert S._type_check("a", int)
    assert S._type_check("b", float)
    assert S._type_check("c", str)
    assert S._type_check("d", dict)
Beispiel #2
0
def test_StoreIO_type_check__raises_TypeError():
    """
    _type_check() should raise Type erorr if attr is not correct type
    """
    abcd = namedtuple('abc', ['a', 'b', 'c', "d"])
    x = abcd(1, 2.0, "3", {"k": 1})
    S = StoreIO(**x._asdict())
    with pytest.raises(TypeError):
        assert S._type_check("a", str)
    with pytest.raises(TypeError):
        assert S._type_check("b", int)
    with pytest.raises(TypeError):
        assert S._type_check("c", int)
    with pytest.raises(TypeError):
        assert S._type_check("d", int)