test-hg-parseurl.py
51 lines
| 1.6 KiB
| text/x-python
|
PythonLexer
/ tests / test-hg-parseurl.py
Augie Fackler
|
r37731 | import unittest | ||
r47670 | from mercurial.utils import urlutil | |||
Augie Fackler
|
r43346 | |||
Martijn Pieters
|
r8174 | |||
Augie Fackler
|
r37731 | class ParseRequestTests(unittest.TestCase): | ||
def testparse(self): | ||||
Augie Fackler
|
r43346 | self.assertEqual( | ||
r47670 | urlutil.parseurl(b'http://example.com/no/anchor'), | |||
Augie Fackler
|
r43346 | (b'http://example.com/no/anchor', (None, [])), | ||
) | ||||
self.assertEqual( | ||||
r47670 | urlutil.parseurl(b'http://example.com/an/anchor#foo'), | |||
Augie Fackler
|
r43346 | (b'http://example.com/an/anchor', (b'foo', [])), | ||
) | ||||
Augie Fackler
|
r37731 | self.assertEqual( | ||
r47670 | urlutil.parseurl( | |||
b'http://example.com/no/anchor/branches', [b'foo'] | ||||
), | ||||
Augie Fackler
|
r43346 | (b'http://example.com/no/anchor/branches', (None, [b'foo'])), | ||
) | ||||
Augie Fackler
|
r37731 | self.assertEqual( | ||
r47670 | urlutil.parseurl( | |||
b'http://example.com/an/anchor/branches#bar', [b'foo'] | ||||
), | ||||
Augie Fackler
|
r43346 | (b'http://example.com/an/anchor/branches', (b'bar', [b'foo'])), | ||
) | ||||
self.assertEqual( | ||||
r47670 | urlutil.parseurl( | |||
Augie Fackler
|
r43346 | b'http://example.com/an/anchor/branches-None#foo', None | ||
), | ||||
(b'http://example.com/an/anchor/branches-None', (b'foo', [])), | ||||
) | ||||
self.assertEqual( | ||||
r47670 | urlutil.parseurl(b'http://example.com/'), | |||
Augie Fackler
|
r43346 | (b'http://example.com/', (None, [])), | ||
) | ||||
self.assertEqual( | ||||
r47670 | urlutil.parseurl(b'http://example.com'), | |||
Augie Fackler
|
r43346 | (b'http://example.com/', (None, [])), | ||
) | ||||
self.assertEqual( | ||||
r47670 | urlutil.parseurl(b'http://example.com#foo'), | |||
Augie Fackler
|
r43346 | (b'http://example.com/', (b'foo', [])), | ||
) | ||||
Augie Fackler
|
r37731 | |||
if __name__ == '__main__': | ||||
import silenttestrunner | ||||
Augie Fackler
|
r43346 | |||
Augie Fackler
|
r37731 | silenttestrunner.main(__name__) | ||