Exemplo n.º 1
0
def runner(x, base, chunk):
    for i, j in itertools.zip_longest(divmod_iter_chunking(x, base, chunk),
                                      divmod_iter_basic(x, base)):
        if i is None:
            print("phooey")
        else:
            assert i == j
Exemplo n.º 2
0
def runner(x, base, chunk):
    try:
        zip_longest = itertools.izip_longest
    except AttributeError:
        zip_longest = itertools.zip_longest
    for i, j in zip_longest(divmod_iter_chunking(x, base, chunk), divmod_iter_basic(x, base)):
        if i is None:
            print("phooey")
        else:
            assert i == j
Exemplo n.º 3
0
 def _runner(self, x, base, chunk):
     try:
         zip_longest = itertools.izip_longest
     except AttributeError:
         zip_longest = itertools.zip_longest
     for i, j in zip_longest(divmod_iter_chunking(x, base, chunk),
                             divmod_iter_basic(x, base)):
         if i is None:
             print("phooey")
             self.fail()
         else:
             self.assertEqual(i, j)
Exemplo n.º 4
0
 def test_divmod_iter_basic(self):
     v = divmod_iter_basic(1234, 10)
     self.assertEqual([4, 3, 2, 1], list(v))
Exemplo n.º 5
0
def runner(x, base, chunk):
    for i, j in itertools.zip_longest(divmod_iter_chunking(x, base, chunk), divmod_iter_basic(x, base)):
        if i is None:
            print("phooey")
        else:
            assert i == j
Exemplo n.º 6
0
 def test_divmod_iter_basic(self):
     v = divmod_iter_basic(1234, 10)
     self.assertEqual([4, 3, 2, 1], list(v))