##// END OF EJS Templates
py3: use dict.items() instead of dict.iteritems() in tests...
Pulkit Goyal -
r36345:58c1368a default
parent child Browse files
Show More
@@ -29,7 +29,7 b' def pack_dirstate(fakenow, orig, dmap, c'
29 # execute what original parsers.pack_dirstate should do actually
29 # execute what original parsers.pack_dirstate should do actually
30 # for consistency
30 # for consistency
31 actualnow = int(now)
31 actualnow = int(now)
32 for f, e in dmap.iteritems():
32 for f, e in dmap.items():
33 if e[0] == 'n' and e[3] == actualnow:
33 if e[0] == 'n' and e[3] == actualnow:
34 e = parsers.dirstatetuple(e[0], e[1], e[2], -1)
34 e = parsers.dirstatetuple(e[0], e[1], e[2], -1)
35 dmap[f] = e
35 dmap[f] = e
@@ -19,7 +19,7 b' origui = myui.load()'
19
19
20 def writeauth(items):
20 def writeauth(items):
21 ui = origui.copy()
21 ui = origui.copy()
22 for name, value in items.iteritems():
22 for name, value in items.items():
23 ui.setconfig('auth', name, value)
23 ui.setconfig('auth', name, value)
24 return ui
24 return ui
25
25
@@ -36,7 +36,7 b' def test(auth, urls=None):'
36 for name in ('.username', '.password'):
36 for name in ('.username', '.password'):
37 if (p + name) not in auth:
37 if (p + name) not in auth:
38 auth[p + name] = p
38 auth[p + name] = p
39 auth = dict((k, v) for k, v in auth.iteritems() if v is not None)
39 auth = dict((k, v) for k, v in auth.items() if v is not None)
40
40
41 ui = writeauth(auth)
41 ui = writeauth(auth)
42
42
@@ -2258,7 +2258,7 b' Check that adding an arbitrary name show'
2258 > foo = {'foo': repo[0].node()}
2258 > foo = {'foo': repo[0].node()}
2259 > names = lambda r: foo.keys()
2259 > names = lambda r: foo.keys()
2260 > namemap = lambda r, name: foo.get(name)
2260 > namemap = lambda r, name: foo.get(name)
2261 > nodemap = lambda r, node: [name for name, n in foo.iteritems()
2261 > nodemap = lambda r, node: [name for name, n in foo.items()
2262 > if n == node]
2262 > if n == node]
2263 > ns = namespaces.namespace(
2263 > ns = namespaces.namespace(
2264 > "bars", templatename="bar", logname="barlog",
2264 > "bars", templatename="bar", logname="barlog",
@@ -223,7 +223,7 b' class basemanifesttests(object):'
223 self.assertEqual(want, m[b'foo'])
223 self.assertEqual(want, m[b'foo'])
224 self.assertEqual([(b'bar/baz/qux.py', BIN_HASH_2),
224 self.assertEqual([(b'bar/baz/qux.py', BIN_HASH_2),
225 (b'foo', BIN_HASH_1 + b'a')],
225 (b'foo', BIN_HASH_1 + b'a')],
226 list(m.iteritems()))
226 list(m.items()))
227 # Sometimes it even tries a 22-byte fake hash, but we can
227 # Sometimes it even tries a 22-byte fake hash, but we can
228 # return 21 and it'll work out
228 # return 21 and it'll work out
229 m[b'foo'] = want + b'+'
229 m[b'foo'] = want + b'+'
@@ -238,7 +238,7 b' class basemanifesttests(object):'
238 # suffix with iteration
238 # suffix with iteration
239 self.assertEqual([(b'bar/baz/qux.py', BIN_HASH_2),
239 self.assertEqual([(b'bar/baz/qux.py', BIN_HASH_2),
240 (b'foo', want)],
240 (b'foo', want)],
241 list(m.iteritems()))
241 list(m.items()))
242
242
243 # shows up in diff
243 # shows up in diff
244 self.assertEqual({b'foo': ((want, f), (h, b''))}, m.diff(clean))
244 self.assertEqual({b'foo': ((want, f), (h, b''))}, m.diff(clean))
@@ -16,7 +16,7 b' class splitnewlinesTests(unittest.TestCa'
16 '': [],
16 '': [],
17 'abcabc': ['abcabc'],
17 'abcabc': ['abcabc'],
18 }
18 }
19 for inp, want in cases.iteritems():
19 for inp, want in cases.items():
20 self.assertEqual(mdiff.splitnewlines(inp), want)
20 self.assertEqual(mdiff.splitnewlines(inp), want)
21
21
22 if __name__ == '__main__':
22 if __name__ == '__main__':
@@ -64,7 +64,7 b" def buildprobtable(fp, cmd='hg manifest "
64 counts.pop(c, None)
64 counts.pop(c, None)
65 t = sum(counts.itervalues()) / 100.0
65 t = sum(counts.itervalues()) / 100.0
66 fp.write('probtable = (')
66 fp.write('probtable = (')
67 for i, (k, v) in enumerate(sorted(counts.iteritems(), key=lambda x: x[1],
67 for i, (k, v) in enumerate(sorted(counts.items(), key=lambda x: x[1],
68 reverse=True)):
68 reverse=True)):
69 if (i % 5) == 0:
69 if (i % 5) == 0:
70 fp.write('\n ')
70 fp.write('\n ')
@@ -13,7 +13,7 b''
13 > tmpl = self.loader(t)
13 > tmpl = self.loader(t)
14 > props = self._defaults.copy()
14 > props = self._defaults.copy()
15 > props.update(map)
15 > props.update(map)
16 > for k, v in props.iteritems():
16 > for k, v in props.items():
17 > if k in ('templ', 'ctx', 'repo', 'revcache', 'cache', 'troubles'):
17 > if k in ('templ', 'ctx', 'repo', 'revcache', 'cache', 'troubles'):
18 > continue
18 > continue
19 > if hasattr(v, '__call__'):
19 > if hasattr(v, '__call__'):
General Comments 0
You need to be logged in to leave comments. Login now