def test_nonnull_overrides_orelse(self): with pytest.raises(NullValueError): NullNode().nonnull().orelse(3).val()
def test_dump(self): assert isinstance(NullNode().dump(x=Q + 3), Null)
def test_find_all(self): assert isinstance(NullNode().find_all('a'), NullCollection)
def test_select(self): assert isinstance(NullNode().select('a'), NullCollection)
def test_find_single_multi(self, method): assert isinstance(getattr(NullNode(), method)('a'), NullCollection)
def test_find(self): assert isinstance(NullNode().find('a'), NullNode)
def test_orelse_returns_other(self): assert NullNode().orelse(3).val() == 3
def test_setitem(self): node = NullNode() node['a'] = 3
def test_collection_props(self, attr): node = NullNode() with pytest.raises(NullValueError): getattr(node, attr).val()
def test_scalar_props(self, attr): node = NullNode() assert isinstance(getattr(node, attr), Null)
def test_val_raises(self): with pytest.raises(NullValueError): assert NullNode().val()
def test_len(self): assert len(NullNode()) == 0
def test_str(self): assert str(NullNode()) == "NullNode()"
def test_prettify(self): assert NullNode().prettify() == "Null Node"
def test_find_single(self, method): assert isinstance(getattr(NullNode(), method)('a'), NullNode)
def test_isnull(self): assert NullNode().isnull()
def test_hash(self): # hashing uses the type assert hash(Null()) == hash(Null()) assert hash(Null()) != hash(NullNode())