11308: Fix arvfile append mode: write() changes the file pointer.
[arvados.git] / sdk / python / tests / test_keep_locator.py
index 273992aba7f1dd7d793a255fa98f861a3980e140..9b9c4b6ab324f185a471c781f7d4d9a80157a140 100644 (file)
@@ -1,6 +1,7 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
+from builtins import next
+from builtins import zip
+from builtins import str
+from builtins import range
 import datetime
 import itertools
 import random
@@ -14,7 +15,7 @@ class ArvadosKeepLocatorTest(unittest.TestCase):
     def numstrs(fmtstr, base, exponent):
         def genstrs(self, count=None):
             return (fmtstr.format(random.randint(0, base ** exponent))
-                    for c in xrange(count or self.DEFAULT_TEST_COUNT))
+                    for c in range(count or self.DEFAULT_TEST_COUNT))
         return genstrs
 
     checksums = numstrs('{:032x}', 16, 32)
@@ -24,17 +25,17 @@ class ArvadosKeepLocatorTest(unittest.TestCase):
 
     def base_locators(self, count=DEFAULT_TEST_COUNT):
         return ('+'.join(pair) for pair in
-                itertools.izip(self.checksums(count), self.sizes(count)))
+                zip(self.checksums(count), self.sizes(count)))
 
     def perm_hints(self, count=DEFAULT_TEST_COUNT):
-        for sig, ts in itertools.izip(self.signatures(count),
+        for sig, ts in zip(self.signatures(count),
                                       self.timestamps(count)):
             yield 'A{}@{}'.format(sig, ts)
 
     def test_good_locators_returned(self):
         for hint_gens in [(), (self.sizes(),),
                           (self.sizes(), self.perm_hints())]:
-            for loc_data in itertools.izip(self.checksums(), *hint_gens):
+            for loc_data in zip(self.checksums(), *hint_gens):
                 locator = '+'.join(loc_data)
                 self.assertEqual(locator, str(KeepLocator(locator)))