Exemplo n.º 1
0
def test_simple():
    d = dict()
    f = Func(inc, dec, d)
    f['x'] = 10
    assert f['x'] == 10
    assert d['x'] == 11

    assert 'x' in f
    assert list(f) == ['x']
    assert list(f.values()) == [10]
    assert list(f.items()) == [('x', 10)]

    assert all(s in str(f) for s in ['inc', 'dec', 'x', 'Func'])
    assert all(s in repr(f) for s in ['inc', 'dec', 'x', 'Func'])

    del f['x']
    assert 'x' not in d
Exemplo n.º 2
0
def test_simple():
    d = dict()
    f = Func(inc, dec, d)
    f['x'] = 10
    assert f['x'] == 10
    assert d['x'] == 11

    assert 'x' in f
    assert list(f) == ['x']
    assert list(f.values()) == [10]
    assert list(f.items()) == [('x', 10)]

    assert all(s in str(f) for s in ['inc', 'dec', 'x', 'Func'])
    assert all(s in repr(f) for s in ['inc', 'dec', 'x', 'Func'])

    del f['x']
    assert 'x' not in d
Exemplo n.º 3
0
def test_simple():
    d = dict()
    f = Func(inc, dec, d)
    f["x"] = 10
    assert f["x"] == 10
    assert d["x"] == 11

    assert "x" in f
    assert list(f) == ["x"]
    assert list(f.values()) == [10]
    assert list(f.items()) == [("x", 10)]

    assert all(s in str(f) for s in ["inc", "dec", "x", "Func"])
    assert all(s in repr(f) for s in ["inc", "dec", "x", "Func"])

    del f["x"]
    assert "x" not in d