Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG11d128a14ec0: tests: port test-hg-parseurl.py to unittest
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
| hg-reviewers |
| Lint Skipped |
| Unit Tests Skipped |
| Path | Packages | |||
|---|---|---|---|---|
| M | tests/test-hg-parseurl.py (37 lines) | |||
| D | M | tests/test-hg-parseurl.py.out (8 lines) |
| from __future__ import absolute_import, print_function | from __future__ import absolute_import, print_function | ||||
| import unittest | |||||
| from mercurial import ( | from mercurial import ( | ||||
| hg, | hg, | ||||
| ) | ) | ||||
| def testparse(url, branch=[]): | class ParseRequestTests(unittest.TestCase): | ||||
| print('%s, branches: %r' % hg.parseurl(url, branch)) | def testparse(self): | ||||
| self.assertEqual(hg.parseurl('http://example.com/no/anchor'), | |||||
| ('http://example.com/no/anchor', (None, []))) | |||||
| self.assertEqual(hg.parseurl('http://example.com/an/anchor#foo'), | |||||
| ('http://example.com/an/anchor', ('foo', []))) | |||||
| self.assertEqual( | |||||
| hg.parseurl('http://example.com/no/anchor/branches', ['foo']), | |||||
| ('http://example.com/no/anchor/branches', (None, ['foo']))) | |||||
| self.assertEqual( | |||||
| hg.parseurl('http://example.com/an/anchor/branches#bar', ['foo']), | |||||
| ('http://example.com/an/anchor/branches', ('bar', ['foo']))) | |||||
| self.assertEqual(hg.parseurl( | |||||
| 'http://example.com/an/anchor/branches-None#foo', None), | |||||
| ('http://example.com/an/anchor/branches-None', ('foo', []))) | |||||
| self.assertEqual(hg.parseurl('http://example.com/'), | |||||
| ('http://example.com/', (None, []))) | |||||
| self.assertEqual(hg.parseurl('http://example.com'), | |||||
| ('http://example.com/', (None, []))) | |||||
| self.assertEqual(hg.parseurl('http://example.com#foo'), | |||||
| ('http://example.com/', ('foo', []))) | |||||
| testparse('http://example.com/no/anchor') | if __name__ == '__main__': | ||||
| testparse('http://example.com/an/anchor#foo') | import silenttestrunner | ||||
| testparse('http://example.com/no/anchor/branches', branch=['foo']) | silenttestrunner.main(__name__) | ||||
| testparse('http://example.com/an/anchor/branches#bar', branch=['foo']) | |||||
| testparse('http://example.com/an/anchor/branches-None#foo', branch=None) | |||||
| testparse('http://example.com/') | |||||
| testparse('http://example.com') | |||||
| testparse('http://example.com#foo') | |||||
| http://example.com/no/anchor, branches: (None, []) | |||||
| http://example.com/an/anchor, branches: ('foo', []) | |||||
| http://example.com/no/anchor/branches, branches: (None, ['foo']) | |||||
| http://example.com/an/anchor/branches, branches: ('bar', ['foo']) | |||||
| http://example.com/an/anchor/branches-None, branches: ('foo', []) | |||||
| http://example.com/, branches: (None, []) | |||||
| http://example.com/, branches: (None, []) | |||||
| http://example.com/, branches: ('foo', []) | |||||