def testMapAll(self): decoded = self.check("map", {"string": "this is a test", "unicode": u"this is a unicode test", "binary": "\x7f\xb4R^\xe5\xf0:\x89\x96E1\xf6\xfe\xb9\x1b\xf5", "int": 3, "long": 2**32, "timestamp": timestamp(0), "none": None, "map": {"string": "nested map"}, "list": [1, "two", 3.0, -4], "uuid": uuid4()}) assert isinstance(decoded["timestamp"], timestamp)
def testMapAll(self): decoded = self.check( "map", { "string": "this is a test", "unicode": u"this is a unicode test", "binary": "\x7f\xb4R^\xe5\xf0:\x89\x96E1\xf6\xfe\xb9\x1b\xf5", "int": 3, "long": 2**32, "timestamp": timestamp(0), "none": None, "map": { "string": "nested map" }, "list": [1, "two", 3.0, -4], "uuid": uuid4() }) assert isinstance(decoded["timestamp"], timestamp)
def testMapDatetime(self): decoded = self.check("map", {"datetime": timestamp(0).datetime()}, compare=False) assert isinstance(decoded["datetime"], timestamp) assert decoded["datetime"] == 0.0
def testMapTimestamp(self): decoded = self.check("map", {"timestamp": timestamp(0)}) assert isinstance(decoded["timestamp"], timestamp)
def testDatetime(self): self.check("datetime", timestamp(0)) self.check("datetime", timestamp(long(time.time())))
Double_pi = 3.1415926535897932384626433832795 Double_neg = -1E4 Double_big = 1267.43233E12 Double_small = 12.78e-2 Double_neg0 = -0 Double_pos0 = 0 Double_INF = float('inf') Double_Negative_INF = float('-inf') char_1byte = u'0024' # $ char_2byte = u'00A2' # ¢ char_3byte = u'20AC' # € char_4byte = u'10ABCD' timestamp = timestamp() UUID = uuid4() String_Greek = u"ἐξίσταντο δὲ πάντες καὶ διηπόρουν, ἄλλος πρὸς ἄλλον λέγοντες, Τί θέλει τοῦτο εἶναι;" String_Empty = "" #----- A few functions ---------------------------------------------------------- def near_enough(float1, float2, delta): return abs(float1-float2) < delta def set_application_headers(message_properties): message_properties.application_headers = {}