示例#1
0
def test_been():
    """Test that exception is enabled with exception."""
    md = MagicDot({})
    with pytest.raises(NotFound):
        md.exception().nonexistent
示例#2
0
def test_gate():
    """Test that setting exception creates a new md"""
    md = MagicDot(1)
    assert md is not md.exception()
示例#3
0
def test_bowl():
    """Test that setting exception twice does note create a new md"""
    md = MagicDot(1, exception=True)
    assert md is md.exception()
示例#4
0
def test_yellow():
    """Test that a pluck of NOT_FOUND data raises an NotFound exception if .exception is set"""
    nt = namedtuple("NT", "x")(1)
    md = MagicDot([nt, None, nt])
    with pytest.raises(NotFound):
        md.exception().pluck("x")