示例#1
0
def test_money():
    """Tests pluck of keys and nonexistent data."""
    d = {"x": 1}
    md = MagicDot([d, None, d])
    assert md.pluck("x").get() == [1, NOT_FOUND, 1]
示例#2
0
def test_vote():
    """Tests that pluck of noniterable gives type_error"""
    md = MagicDot(1)
    with pytest.raises(TypeError):
        md.pluck('z')
示例#3
0
def test_sign():
    """Tests pluck of attributes and nonexistent data."""
    nt = namedtuple("NT", "x")(1)
    md = MagicDot([nt, None, nt])
    assert md.pluck("x").get() == [1, NOT_FOUND, 1]