annotate tests/test-hg-parseurl.py @ 46858:85e3a630cad9

revlog: move the details of revlog "v2" index inside revlog.utils.constants the revlog module is quite large and this kind of format information would handy for other module. So let us start to gather this information about the format in a more appropriate place. We update various reference to this information to use the new "source of truth" in the process. Differential Revision: https://phab.mercurial-scm.org/D10305
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 05 Apr 2021 12:21:12 +0200
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__)