Beispiel #1
0
    def test_of(self):

        self.assertEqual(Stream.of(1, 2, 3).count(), 3)
        self.assertTrue(Stream.of(1, 2, 3).findAny().isPresent())
        self.assertEqual(Stream.of(1, 2, 3).findAny().get(), 1)

        self.assertEqual(Stream.ofNullable(None), Stream.empty())

        self.assertEqual(Stream.of(), Stream.empty())
Beispiel #2
0
 def test_empty(self):
     s = Stream.empty()
     self.assertEqual(s.count(), 0)
Beispiel #3
0
 def test_count(self):
     self.assertEqual(Stream.of(1, 2, 3, 4).count(), 4)
     self.assertEqual(Stream.empty().count(), 0)
     self.assertEqual(Stream.generate(lambda: 1).limit(10).count(), 10)