Exemple #1
0
def test_member_variable():
    obj = m.Dummy(12)
    with pytest.raises(AttributeError):
        obj.member  # pylint: disable=pointless-statement
    assert obj.member_ is True
Exemple #2
0
def test_member_function():
    obj = m.Dummy(42)
    with pytest.raises(AttributeError):
        obj.hash  # pylint: disable=pointless-statement
    assert obj.__hash__() == 42
    assert hash(obj) == 42
Exemple #3
0
def test_member_variable():
    obj = m.Dummy(12)
    assert not hasattr(obj, "member")
    assert obj.member_ is True
Exemple #4
0
def test_conversion_operator():
    obj = m.Dummy(5)
    assert obj.__int__() == 5
    assert int(obj) == 5
Exemple #5
0
def test_member_function():
    obj = m.Dummy(42)
    assert not hasattr(obj, "hash")
    assert obj.__hash__() == 42
    assert hash(obj) == 42