aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTommy Yu <tommy.yu@auckland.ac.nz>2019-07-11 22:21:14 +1200
committerTommy Yu <tommy.yu@auckland.ac.nz>2019-07-11 22:21:14 +1200
commit21afcf2c35f21034124a230abebd1157cbee8265 (patch)
tree2de1e55ee98132cc2046ff0f00734666fa701dc0
parent68064e2e8f60687674071f9c791603b0ae6a76a4 (diff)
downloaduritemplates-21afcf2c35f21034124a230abebd1157cbee8265.tar.gz
Tests covering current correct behaviors.
-rw-r--r--tests/test_uritemplate.py34
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]