diff options
author | Matthias Baumgartner <dev@igsor.net> | 2022-12-18 13:42:34 +0100 |
---|---|---|
committer | Matthias Baumgartner <dev@igsor.net> | 2022-12-18 13:42:34 +0100 |
commit | 0e52514639b043454425a9cc2317d27e628a1027 (patch) | |
tree | e9630257a423521ec3aa6c83f6b56a0b2a581bc2 /test/utils | |
parent | 21a02197d73f263ae222f2ccc49248d8617e2d7d (diff) | |
download | bsfs-0e52514639b043454425a9cc2317d27e628a1027.tar.gz bsfs-0e52514639b043454425a9cc2317d27e628a1027.tar.bz2 bsfs-0e52514639b043454425a9cc2317d27e628a1027.zip |
namespace and uri extensions
Diffstat (limited to 'test/utils')
-rw-r--r-- | test/utils/test_uri.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/utils/test_uri.py b/test/utils/test_uri.py index 976e75d..770e65a 100644 --- a/test/utils/test_uri.py +++ b/test/utils/test_uri.py @@ -5,6 +5,7 @@ A copy of the license is provided with the project. Author: Matthias Baumgartner, 2022 """ # imports +import operator import unittest # objects to test @@ -161,6 +162,23 @@ class TestURI(unittest.TestCase): # empty URI self.assertRaises(ValueError, getattr, URI(''), 'fragment') + def test_overloaded(self): + # composition + self.assertIsInstance(URI('http://user@www.example.com:1234/{}/path1?{}#fragment') + 'hello', URI) + self.assertIsInstance(URI('http://user@www.example.com:1234/{}/path1?{}#fragment') * 2, URI) + self.assertIsInstance(2 * URI('http://user@www.example.com:1234/{}/path1?{}#fragment'), URI) # rmul + self.assertIsInstance(URI('http://user@www.example.com:1234/{}/path1?{}#fragment').join(['hello', 'world']) , URI) + # stripping + self.assertIsInstance(URI('http://user@www.example.com:1234/path0/path1?query#fragment').strip(), URI) + self.assertIsInstance(URI('http://user@www.example.com:1234/path0/path1?query#fragment').lstrip(), URI) + self.assertIsInstance(URI('http://user@www.example.com:1234/path0/path1?query#fragment').rstrip(), URI) + # case fold + self.assertIsInstance(URI('http://user@www.example.com:1234/path0/path1?query#fragment').lower(), URI) + self.assertIsInstance(URI('http://user@www.example.com:1234/path0/path1?query#fragment').upper(), URI) + # formatting + self.assertIsInstance(URI('http://user@www.example.com:1234/{}/path1?{}#fragment').format('hello', 'world'), URI) + self.assertIsInstance(URI('http://user@www.example.com:1234/%s/path1?%s#fragment') % ('hello', 'world'), URI) + self.assertIsInstance(URI('http://user@www.example.com:1234/path0/path1?query#fragment').replace('path0', 'pathX'), URI) ## main ## |