Example #1
0
 def test_get(self):
     assert isinstance(NullCollection()[0], NullNode)
Example #2
0
 def test_first(self):
     assert isinstance(NullCollection().first(), NullNode)
Example #3
0
 def test_slice(self):
     assert isinstance(NullCollection()[::2], NullCollection)
Example #4
0
 def test_collection_to_collection_methods(self, func):
     result = getattr(NullCollection(), func)(lambda x: 1)
     assert isinstance(result, NullCollection)
Example #5
0
 def test_dump(self):
     with pytest.raises(NullValueError):
         return NullCollection().dump().val()
Example #6
0
 def test_iter_val(self):
     with pytest.raises(NullValueError):
         return NullCollection().iter_val()
Example #7
0
    def test_count(self):

        assert Collection([]).count().val() == 0
        assert Collection([Scalar(1)]).count().val() == 1
        assert NullCollection().count().val() == 0