summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorRafael H. Schloming <rhs@apache.org>2010-09-09 18:49:35 +0000
committerRafael H. Schloming <rhs@apache.org>2010-09-09 18:49:35 +0000
commit42021e9690fb54be369b34911841fb8c7e044684 (patch)
tree959c341bcef90bb599ecff6a537aa1ac40e78eb8 /python
parent1b0c4065a0e6906dfc12c123af8f411397c815cf (diff)
downloadqpid-python-42021e9690fb54be369b34911841fb8c7e044684.tar.gz
fixed bool encoding
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@995537 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python')
-rw-r--r--python/qpid/codec010.py1
-rw-r--r--python/qpid/tests/messaging/message.py12
2 files changed, 13 insertions, 0 deletions
diff --git a/python/qpid/codec010.py b/python/qpid/codec010.py
index 682743df19..d65f8c36f5 100644
--- a/python/qpid/codec010.py
+++ b/python/qpid/codec010.py
@@ -36,6 +36,7 @@ def map_str(s):
class Codec(Packer):
ENCODINGS = {
+ bool: direct("boolean"),
unicode: direct("str16"),
str: map_str,
buffer: direct("vbin32"),
diff --git a/python/qpid/tests/messaging/message.py b/python/qpid/tests/messaging/message.py
index eaa953e7d7..297374b82b 100644
--- a/python/qpid/tests/messaging/message.py
+++ b/python/qpid/tests/messaging/message.py
@@ -86,6 +86,8 @@ class MessageEchoTests(Base):
"key7": ["one", 2, 3.14],
"key8": [],
"key9": {"sub-key0": 3},
+ "key10": True,
+ "key11": False,
"x-amqp-0-10.app-id": "test-app-id",
"x-amqp-0-10.content-encoding": "test-content-encoding"}
@@ -141,3 +143,13 @@ class MessageEchoTests(Base):
def testReplyToTopicSubject(self):
self.check_rt("name/subject; {node: {type: topic}}")
+
+ def testBooleanEncoding(self):
+ msg = Message({"true": True, "false": False})
+ self.snd.send(msg)
+ echo = self.rcv.fetch(0)
+ self.assertEcho(msg, echo)
+ t = echo.content["true"]
+ f = echo.content["false"]
+ assert isinstance(t, bool), t
+ assert isinstance(f, bool), f