1. Monwara LLC
  2. Untitled project
  3. django-url-tools

Commits

Branko Vukelic  committed d8a9309

Cover usage of del_params with no arguments

  • Participants
  • Parent commits 894ec63
  • Branches master

Comments (0)

Files changed (2)

File tests/test_url_helper.py

View file
  • Ignore whitespace
         u.del_params('foo', 'baz')  # baz doesn't exist
         self.assertEqual(u.get_full_path(), '/foo/bar?bar=2')
 
+    def test_delete_multiple_without_arguments(self):
+        u = UrlHelper('/foo/bar?foo=1&bar=2')
+        u.del_params()
+        self.assertEqual(u.get_full_path(), '/foo/bar')

File url_tools/helper.py

View file
  • Ignore whitespace
             pass # Fail silently
 
     def del_params(self, *params):
+        if not params:
+            self.query = {}
+            return
         for param in params:
             self.del_param(param)