annotate tests/test-hg-parseurl.py @ 43587:bf87f5ff2ebf stable

py3: avoid `b'%s' % type(...)` in a ProgrammingError Differential Revision: https://phab.mercurial-scm.org/D7363
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 08 Nov 2019 10:13:05 -0800
parents 2372284d9457
children 4452cb788404
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28746
de5808c57f58 py3: use print_function in test-hg-parseurl.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28745
diff changeset
1 from __future__ import absolute_import, print_function
28806
d26c4af27978 test-hg-parseurl: stop direct symbol import of mercurial.hg.parseurl
Yuya Nishihara <yuya@tcha.org>
parents: 28746
diff changeset
2
37713
11d128a14ec0 tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents: 28806
diff changeset
3 import unittest
11d128a14ec0 tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents: 28806
diff changeset
4
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
5 from mercurial import hg
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
6
8174
29bc5d18714a hg: allow hg.parseurl(url, None)
Martijn Pieters <mj@zopatista.com>
parents:
diff changeset
7
37713
11d128a14ec0 tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents: 28806
diff changeset
8 class ParseRequestTests(unittest.TestCase):
11d128a14ec0 tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents: 28806
diff changeset
9 def testparse(self):
8174
29bc5d18714a hg: allow hg.parseurl(url, None)
Martijn Pieters <mj@zopatista.com>
parents:
diff changeset
10
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
11 self.assertEqual(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
12 hg.parseurl(b'http://example.com/no/anchor'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
13 (b'http://example.com/no/anchor', (None, [])),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
14 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
15 self.assertEqual(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
16 hg.parseurl(b'http://example.com/an/anchor#foo'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
17 (b'http://example.com/an/anchor', (b'foo', [])),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
18 )
37713
11d128a14ec0 tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents: 28806
diff changeset
19 self.assertEqual(
37714
5dd71e9ae68a tests: add b prefixes to test-hg-parseurl.py
Augie Fackler <augie@google.com>
parents: 37713
diff changeset
20 hg.parseurl(b'http://example.com/no/anchor/branches', [b'foo']),
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
21 (b'http://example.com/no/anchor/branches', (None, [b'foo'])),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
22 )
37713
11d128a14ec0 tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents: 28806
diff changeset
23 self.assertEqual(
37714
5dd71e9ae68a tests: add b prefixes to test-hg-parseurl.py
Augie Fackler <augie@google.com>
parents: 37713
diff changeset
24 hg.parseurl(b'http://example.com/an/anchor/branches#bar', [b'foo']),
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
25 (b'http://example.com/an/anchor/branches', (b'bar', [b'foo'])),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
26 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
27 self.assertEqual(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
28 hg.parseurl(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
29 b'http://example.com/an/anchor/branches-None#foo', None
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
30 ),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
31 (b'http://example.com/an/anchor/branches-None', (b'foo', [])),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
32 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
33 self.assertEqual(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
34 hg.parseurl(b'http://example.com/'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
35 (b'http://example.com/', (None, [])),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
36 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
37 self.assertEqual(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
38 hg.parseurl(b'http://example.com'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
39 (b'http://example.com/', (None, [])),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
40 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
41 self.assertEqual(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
42 hg.parseurl(b'http://example.com#foo'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
43 (b'http://example.com/', (b'foo', [])),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
44 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
45
37713
11d128a14ec0 tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents: 28806
diff changeset
46
11d128a14ec0 tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents: 28806
diff changeset
47 if __name__ == '__main__':
11d128a14ec0 tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents: 28806
diff changeset
48 import silenttestrunner
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 37714
diff changeset
49
37713
11d128a14ec0 tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents: 28806
diff changeset
50 silenttestrunner.main(__name__)