THRIFT-2757: py - checkIntegerLimits optimized

Client: Python
diff --git a/test/py/SerializationTest.py b/test/py/SerializationTest.py
index 946f848..40a52e6 100755
--- a/test/py/SerializationTest.py
+++ b/test/py/SerializationTest.py
@@ -267,6 +267,16 @@
     rep = repr(self.compact_struct)
     self.assertTrue(len(rep) > 0)
 
+  def testIntegerLimits(self):
+    bad_values = [CompactProtoTestStruct(a_byte=128), CompactProtoTestStruct(a_byte=-129),
+                  CompactProtoTestStruct(a_i16=32768), CompactProtoTestStruct(a_i16=-32769),
+                  CompactProtoTestStruct(a_i32=2147483648), CompactProtoTestStruct(a_i32=-2147483649),
+                  CompactProtoTestStruct(a_i64=9223372036854775808), CompactProtoTestStruct(a_i64=-9223372036854775809)
+                ]
+
+    for value in bad_values:
+      self.assertRaises(Exception, self._serialize, value)
+
 class NormalBinaryTest(AbstractTest):
   protocol_factory = TBinaryProtocol.TBinaryProtocolFactory()