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

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