| 1 |
import unittest |
| 2 |
|
| 3 |
from mercurial.utils import urlutil |
| 4 |
|
| 5 |
|
| 6 |
class ParseRequestTests(unittest.TestCase): |
| 7 |
def testparse(self): |
| 8 |
self.assertEqual( |
| 9 |
urlutil.parseurl(b'http://example.com/no/anchor'), |
| 10 |
(b'http://example.com/no/anchor', (None, [])), |
| 11 |
) |
| 12 |
self.assertEqual( |
| 13 |
urlutil.parseurl(b'http://example.com/an/anchor#foo'), |
| 14 |
(b'http://example.com/an/anchor', (b'foo', [])), |
| 15 |
) |
| 16 |
self.assertEqual( |
| 17 |
urlutil.parseurl( |
| 18 |
b'http://example.com/no/anchor/branches', [b'foo'] |
| 19 |
), |
| 20 |
(b'http://example.com/no/anchor/branches', (None, [b'foo'])), |
| 21 |
) |
| 22 |
self.assertEqual( |
| 23 |
urlutil.parseurl( |
| 24 |
b'http://example.com/an/anchor/branches#bar', [b'foo'] |
| 25 |
), |
| 26 |
(b'http://example.com/an/anchor/branches', (b'bar', [b'foo'])), |
| 27 |
) |
| 28 |
self.assertEqual( |
| 29 |
urlutil.parseurl( |
| 30 |
b'http://example.com/an/anchor/branches-None#foo', None |
| 31 |
), |
| 32 |
(b'http://example.com/an/anchor/branches-None', (b'foo', [])), |
| 33 |
) |
| 34 |
self.assertEqual( |
| 35 |
urlutil.parseurl(b'http://example.com/'), |
| 36 |
(b'http://example.com/', (None, [])), |
| 37 |
) |
| 38 |
self.assertEqual( |
| 39 |
urlutil.parseurl(b'http://example.com'), |
| 40 |
(b'http://example.com/', (None, [])), |
| 41 |
) |
| 42 |
self.assertEqual( |
| 43 |
urlutil.parseurl(b'http://example.com#foo'), |
| 44 |
(b'http://example.com/', (b'foo', [])), |
| 45 |
) |
| 46 |
|
| 47 |
|
| 48 |
if __name__ == '__main__': |
| 49 |
import silenttestrunner |
| 50 |
|
| 51 |
silenttestrunner.main(__name__) |