Skip to content

Commit

Permalink
Add some tests around repr for long values
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebakken committed Dec 10, 2019
1 parent 3df9d33 commit 6189f4f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/unit/data_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,7 @@ def test_decode_raises(self):
self.assertRaises(exceptions.InvalidFieldTypeException,
data.decode_table,
b'\x00\x00\x00\t\x03fooZ\x00\x00\x04\xd2', 0)

def test_long_repr(self):
value = long(912598613)
self.assertEqual(repr(value), '912598613L')
8 changes: 8 additions & 0 deletions tests/unit/spec_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import unittest

from pika import spec
from pika.compat import long


class BasicPropertiesTests(unittest.TestCase):
Expand All @@ -24,3 +25,10 @@ def test_equality(self):

b.correlation_id = 'abc123'
self.assertEqual(a, b)

def test_headers_repr(self):
hdr = 'timestamp_in_ms'
v = long(912598613)
h = { hdr : v }
p = spec.BasicProperties(content_type='text/plain', headers=h)
self.assertEqual(repr(p.headers[hdr]), '912598613L')

0 comments on commit 6189f4f

Please sign in to comment.