Patchwork D2353: py3: use dict.items() instead of dict.iteritems() in tests

login
register
mail settings
Submitter phabricator
Date Feb. 20, 2018, 1:34 p.m.
Message ID <7de658883e20442752d759232f01d3ee@localhost.localdomain>
Download mbox | patch
Permalink /patch/28170/
State Not Applicable
Headers show

Comments

phabricator - Feb. 20, 2018, 1:34 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG58c1368ab629: py3: use dict.items() instead of dict.iteritems() in tests (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2353?vs=5921&id=5931

REVISION DETAIL
  https://phab.mercurial-scm.org/D2353

AFFECTED FILES
  tests/fakedirstatewritetime.py
  tests/test-hgweb-auth.py
  tests/test-log.t
  tests/test-manifest.py
  tests/test-mdiff.py
  tests/test-pathencode.py
  tests/test-template-engine.t

CHANGE DETAILS




To: pulkit, #hg-reviewers, yuja
Cc: mercurial-devel

Patch

diff --git a/tests/test-template-engine.t b/tests/test-template-engine.t
--- a/tests/test-template-engine.t
+++ b/tests/test-template-engine.t
@@ -13,7 +13,7 @@ 
   >         tmpl = self.loader(t)
   >         props = self._defaults.copy()
   >         props.update(map)
-  >         for k, v in props.iteritems():
+  >         for k, v in props.items():
   >             if k in ('templ', 'ctx', 'repo', 'revcache', 'cache', 'troubles'):
   >                 continue
   >             if hasattr(v, '__call__'):
diff --git a/tests/test-pathencode.py b/tests/test-pathencode.py
--- a/tests/test-pathencode.py
+++ b/tests/test-pathencode.py
@@ -64,7 +64,7 @@ 
         counts.pop(c, None)
     t = sum(counts.itervalues()) / 100.0
     fp.write('probtable = (')
-    for i, (k, v) in enumerate(sorted(counts.iteritems(), key=lambda x: x[1],
+    for i, (k, v) in enumerate(sorted(counts.items(), key=lambda x: x[1],
                                       reverse=True)):
         if (i % 5) == 0:
             fp.write('\n    ')
diff --git a/tests/test-mdiff.py b/tests/test-mdiff.py
--- a/tests/test-mdiff.py
+++ b/tests/test-mdiff.py
@@ -16,7 +16,7 @@ 
                  '': [],
                  'abcabc': ['abcabc'],
                  }
-        for inp, want in cases.iteritems():
+        for inp, want in cases.items():
             self.assertEqual(mdiff.splitnewlines(inp), want)
 
 if __name__ == '__main__':
diff --git a/tests/test-manifest.py b/tests/test-manifest.py
--- a/tests/test-manifest.py
+++ b/tests/test-manifest.py
@@ -223,7 +223,7 @@ 
         self.assertEqual(want, m[b'foo'])
         self.assertEqual([(b'bar/baz/qux.py', BIN_HASH_2),
                           (b'foo', BIN_HASH_1 + b'a')],
-                         list(m.iteritems()))
+                         list(m.items()))
         # Sometimes it even tries a 22-byte fake hash, but we can
         # return 21 and it'll work out
         m[b'foo'] = want + b'+'
@@ -238,7 +238,7 @@ 
         # suffix with iteration
         self.assertEqual([(b'bar/baz/qux.py', BIN_HASH_2),
                           (b'foo', want)],
-                         list(m.iteritems()))
+                         list(m.items()))
 
         # shows up in diff
         self.assertEqual({b'foo': ((want, f), (h, b''))}, m.diff(clean))
diff --git a/tests/test-log.t b/tests/test-log.t
--- a/tests/test-log.t
+++ b/tests/test-log.t
@@ -2258,7 +2258,7 @@ 
   >     foo = {'foo': repo[0].node()}
   >     names = lambda r: foo.keys()
   >     namemap = lambda r, name: foo.get(name)
-  >     nodemap = lambda r, node: [name for name, n in foo.iteritems()
+  >     nodemap = lambda r, node: [name for name, n in foo.items()
   >                                if n == node]
   >     ns = namespaces.namespace(
   >         "bars", templatename="bar", logname="barlog",
diff --git a/tests/test-hgweb-auth.py b/tests/test-hgweb-auth.py
--- a/tests/test-hgweb-auth.py
+++ b/tests/test-hgweb-auth.py
@@ -19,7 +19,7 @@ 
 
 def writeauth(items):
     ui = origui.copy()
-    for name, value in items.iteritems():
+    for name, value in items.items():
         ui.setconfig('auth', name, value)
     return ui
 
@@ -36,7 +36,7 @@ 
         for name in ('.username', '.password'):
             if (p + name) not in auth:
                 auth[p + name] = p
-    auth = dict((k, v) for k, v in auth.iteritems() if v is not None)
+    auth = dict((k, v) for k, v in auth.items() if v is not None)
 
     ui = writeauth(auth)
 
diff --git a/tests/fakedirstatewritetime.py b/tests/fakedirstatewritetime.py
--- a/tests/fakedirstatewritetime.py
+++ b/tests/fakedirstatewritetime.py
@@ -29,7 +29,7 @@ 
     # execute what original parsers.pack_dirstate should do actually
     # for consistency
     actualnow = int(now)
-    for f, e in dmap.iteritems():
+    for f, e in dmap.items():
         if e[0] == 'n' and e[3] == actualnow:
             e = parsers.dirstatetuple(e[0], e[1], e[2], -1)
             dmap[f] = e