예제 #1
0
파일: test_misc.py 프로젝트: yAoOw/odoo
 def test_repeated(self):
     """ Once the CountingStream has stopped iterating, the index should not
     increase anymore (the internal state should not be allowed to change)
     """
     s = misc.CountingStream(iter([]))
     self.assertIsNone(next(s, None))
     self.assertEqual(s.index, 0)
     self.assertIsNone(next(s, None))
     self.assertEqual(s.index, 0)
예제 #2
0
파일: test_misc.py 프로젝트: yAoOw/odoo
 def test_single(self):
     s = misc.CountingStream(range(1))
     self.assertEqual(s.index, -1)
     self.assertEqual(next(s, None), 0)
     self.assertIsNone(next(s, None))
     self.assertEqual(s.index, 1)
예제 #3
0
파일: test_misc.py 프로젝트: yAoOw/odoo
 def test_full(self):
     s = misc.CountingStream(range(42))
     for _ in s:
         pass
     self.assertEqual(s.index, 42)
예제 #4
0
파일: test_misc.py 프로젝트: yAoOw/odoo
 def test_empty_stream(self):
     s = misc.CountingStream(iter([]))
     self.assertEqual(s.index, -1)
     self.assertIsNone(next(s, None))
     self.assertEqual(s.index, 0)