def test_empty_string_vs_none(self): struct1 = TestStruct() struct2 = TestStruct() struct2.a = "" self.assertNotEquals(thrift_util.to_bytes(struct1), thrift_util.to_bytes(struct2)) self.assertNotEquals(struct1, struct2)
def test_to_from_bytes(self): struct = TestStruct() struct.a = "hello world" struct.b = 12345 self.assertEquals(struct, thrift_util.from_bytes(TestStruct, thrift_util.to_bytes(struct))) self.assertEquals(thrift_util.to_bytes(struct), thrift_util.to_bytes(thrift_util.from_bytes(TestStruct, thrift_util.to_bytes(struct))))