def test_been(): """Test that exception is enabled with exception.""" md = MagicDot({}) with pytest.raises(NotFound): md.exception().nonexistent
def test_gate(): """Test that setting exception creates a new md""" md = MagicDot(1) assert md is not md.exception()
def test_bowl(): """Test that setting exception twice does note create a new md""" md = MagicDot(1, exception=True) assert md is md.exception()
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")