Пример #1
0
 def test_too_large_int(self):
     self.assertFalse(encode.DEPRECATED_RABBITMQ_SUPPORT)
     with self.assertRaises(TypeError):
         encode.table_integer(9223372036854775809)
     encode.support_deprecated_rabbitmq(True)
     self.assertTrue(encode.DEPRECATED_RABBITMQ_SUPPORT)
     with self.assertRaises(TypeError):
         encode.table_integer(9223372036854775809)
Пример #2
0
 def test_deprecated_table_integer(self):
     tests = {
         'short-short': (32, b'b '),
         'short': (1024, b's\x04\x00'),
         'short-negative': (-1024, b's\xfc\x00'),
         'long': (65536, b'I\x00\x01\x00\x00'),
         'long-negative': (65536, b'I\x00\x01\x00\x00'),
         'long-long': (2147483648, b'l\x00\x00\x00\x00\x80\x00\x00\x00'),
     }
     encode.support_deprecated_rabbitmq()
     for key, value in tests.items():
         result = encode.table_integer(value[0])
         self.assertEqual(result, value[1],
                          'encode {} mismatch ({!r} != {!r})'.format(
                              key, result, value[1]))
Пример #3
0
 def test_deprecated_table_integer(self):
     tests = {
         'short-short': (32, b'b '),
         'short': (1024, b's\x04\x00'),
         'short-negative': (-1024, b's\xfc\x00'),
         'long': (65536, b'I\x00\x01\x00\x00'),
         'long-negative': (65536, b'I\x00\x01\x00\x00'),
         'long-long': (2147483648, b'l\x00\x00\x00\x00\x80\x00\x00\x00'),
     }
     encode.support_deprecated_rabbitmq()
     for key, value in tests.items():
         result = encode.table_integer(value[0])
         self.assertEqual(
             result, value[1], 'encode {} mismatch ({!r} != {!r})'.format(
                 key, result, value[1]))
Пример #4
0
 def test_deprecated_table_integer(self):
     self.assertFalse(encode.DEPRECATED_RABBITMQ_SUPPORT)
     encode.support_deprecated_rabbitmq(True)
     self.assertTrue(encode.DEPRECATED_RABBITMQ_SUPPORT)
     tests = {
         'short-short': (32, b'b '),
         'short': (1024, b's\x04\x00'),
         'short-negative': (-1024, b's\xfc\x00'),
         'long': (65536, b'I\x00\x01\x00\x00'),
         'long-negative': (65536, b'I\x00\x01\x00\x00'),
         'long-long': (2147483648, b'l\x00\x00\x00\x00\x80\x00\x00\x00'),
     }
     for key, value in tests.items():
         result = encode.table_integer(value[0])
         self.assertEqual(
             result, value[1],
             'encode {} mismatch of {!r} ({!r} != {!r})'.format(
                 key, value[0], result, value[1]))
Пример #5
0
 def tearDown(self):
     encode.support_deprecated_rabbitmq(False)
Пример #6
0
 def setUp(self):
     encode.support_deprecated_rabbitmq(False)