##// END OF EJS Templates
tests: port test-hg-parseurl.py to unittest...
Augie Fackler -
r37731:11d128a1 default
parent child Browse files
Show More
@@ -1,17 +1,34 b''
1 from __future__ import absolute_import, print_function
1 from __future__ import absolute_import, print_function
2
2
3 import unittest
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__)
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now