Mercurial > hg
comparison tests/test-hg-parseurl.py @ 37713:11d128a14ec0
tests: port test-hg-parseurl.py to unittest
Differential Revision: https://phab.mercurial-scm.org/D3373
author | Augie Fackler <augie@google.com> |
---|---|
date | Sat, 14 Apr 2018 11:04:58 -0400 |
parents | d26c4af27978 |
children | 5dd71e9ae68a |
comparison
equal
deleted
inserted
replaced
37712:a728e3695325 | 37713:11d128a14ec0 |
---|---|
1 from __future__ import absolute_import, print_function | 1 from __future__ import absolute_import, print_function |
2 | |
3 import unittest | |
2 | 4 |
3 from mercurial import ( | 5 from mercurial import ( |
4 hg, | 6 hg, |
5 ) | 7 ) |
6 | 8 |
7 def testparse(url, branch=[]): | 9 class ParseRequestTests(unittest.TestCase): |
8 print('%s, branches: %r' % hg.parseurl(url, branch)) | 10 def testparse(self): |
9 | 11 |
10 testparse('http://example.com/no/anchor') | 12 self.assertEqual(hg.parseurl('http://example.com/no/anchor'), |
11 testparse('http://example.com/an/anchor#foo') | 13 ('http://example.com/no/anchor', (None, []))) |
12 testparse('http://example.com/no/anchor/branches', branch=['foo']) | 14 self.assertEqual(hg.parseurl('http://example.com/an/anchor#foo'), |
13 testparse('http://example.com/an/anchor/branches#bar', branch=['foo']) | 15 ('http://example.com/an/anchor', ('foo', []))) |
14 testparse('http://example.com/an/anchor/branches-None#foo', branch=None) | 16 self.assertEqual( |
15 testparse('http://example.com/') | 17 hg.parseurl('http://example.com/no/anchor/branches', ['foo']), |
16 testparse('http://example.com') | 18 ('http://example.com/no/anchor/branches', (None, ['foo']))) |
17 testparse('http://example.com#foo') | 19 self.assertEqual( |
20 hg.parseurl('http://example.com/an/anchor/branches#bar', ['foo']), | |
21 ('http://example.com/an/anchor/branches', ('bar', ['foo']))) | |
22 self.assertEqual(hg.parseurl( | |
23 'http://example.com/an/anchor/branches-None#foo', None), | |
24 ('http://example.com/an/anchor/branches-None', ('foo', []))) | |
25 self.assertEqual(hg.parseurl('http://example.com/'), | |
26 ('http://example.com/', (None, []))) | |
27 self.assertEqual(hg.parseurl('http://example.com'), | |
28 ('http://example.com/', (None, []))) | |
29 self.assertEqual(hg.parseurl('http://example.com#foo'), | |
30 ('http://example.com/', ('foo', []))) | |
31 | |
32 if __name__ == '__main__': | |
33 import silenttestrunner | |
34 silenttestrunner.main(__name__) |