diff options
author | Tommy Yu <tommy.yu@auckland.ac.nz> | 2019-07-11 22:21:14 +1200 |
---|---|---|
committer | Tommy Yu <tommy.yu@auckland.ac.nz> | 2019-07-11 22:21:14 +1200 |
commit | 21afcf2c35f21034124a230abebd1157cbee8265 (patch) | |
tree | 2de1e55ee98132cc2046ff0f00734666fa701dc0 | |
parent | 68064e2e8f60687674071f9c791603b0ae6a76a4 (diff) | |
download | uritemplates-21afcf2c35f21034124a230abebd1157cbee8265.tar.gz |
Tests covering current correct behaviors.
-rw-r--r-- | tests/test_uritemplate.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/test_uritemplate.py b/tests/test_uritemplate.py index 7448be0..9977ef7 100644 --- a/tests/test_uritemplate.py +++ b/tests/test_uritemplate.py @@ -464,6 +464,40 @@ class TestURITemplate(RFCTemplateExamples('RFCMeta', (TestCase,), {})): None ) + def test_label_path_expansion_explode_slash(self): + t = URITemplate('{/foo*}') + self.assertEqual(t.variables[0]._label_path_expansion( + 'foo', [], True, '/'), None + ) + self.assertEqual(t.variables[0]._label_path_expansion( + 'foo', ['one'], True, '/'), 'one' + ) + self.assertEqual(t.variables[0]._label_path_expansion( + 'foo', ['one', 'two'], True, '/'), 'one/two' + ) + self.assertEqual(t.variables[0]._label_path_expansion( + 'foo', ['', ''], True, '/'), '/' + ) + + self.assertEqual(t.variables[0]._label_path_expansion( + 'foo', {}, True, '/'), None + ) + self.assertEqual(t.variables[0]._label_path_expansion( + 'foo', {'one': ''}, True, '/'), 'one=' + ) + self.assertEqual(t.variables[0]._label_path_expansion( + 'foo', {'one': '', 'two': ''}, True, '/'), 'one=/two=' + ) + self.assertEqual(t.variables[0]._label_path_expansion( + 'foo', {'one': None}, True, '/'), None + ) + self.assertEqual(t.variables[0]._label_path_expansion( + 'foo', {'one': None, 'two': 'two'}, True, '/'), 'two=two' + ) + self.assertEqual(t.variables[0]._label_path_expansion( + 'foo', {'one': None, 'two': None}, True, '/'), None + ) + def test_semi_path_expansion(self): t = URITemplate('{foo}') v = t.variables[0] |