Permalink
Browse files

`eurl_repl` receives a match object argument.

As `eurl_repl` receives a match argument, it should do the transformation from
string to integer on the first group of the object, not the whole object.
  • Loading branch information...
1 parent bdeaf9c commit 0a74dd1c6d00b27c2557548cf8828c7f67971164 @fcuny fcuny committed May 24, 2012
Showing with 8 additions and 2 deletions.
  1. +1 −1 ddlockclient/__init__.py
  2. +7 −1 tests/test_client.py
View
@@ -8,7 +8,7 @@
def eurl_repl(m):
- return "%%%02X" % ord(m)
+ return "%%%02X" % ord(m.group(1))
def eurl(name):
View
@@ -1,6 +1,6 @@
import unittest
import re
-from ddlockclient import DDLockClient, DDLock
+from ddlockclient import DDLockClient, DDLock, eurl
servers = ['localhost']
@@ -87,3 +87,9 @@ def test_e(self):
lock = self._lock('test')
self.assertTrue(isinstance(lock, DDLock),
"able to lock 'test' again")
+
+ def test_eurl(self):
+ name = eurl('foo|bar')
+ self.assertEqual(name, "foo%7Cbar")
+ name = eurl('foo|bar/baz')
+ self.assertEqual(name, "foo%7Cbar%2Fbaz")

0 comments on commit 0a74dd1

Please sign in to comment.