예제 #1
0
    def test_simpler_string(self):
        struct = TestStruct()
        self.assertEquals("TestStruct()", thrift_util.simpler_string(struct))
        struct.a = "hello world"
        self.assertEquals("TestStruct(a='hello world')", thrift_util.simpler_string(struct))
        struct.a = ""
        struct.b = 12345
        self.assertEquals("TestStruct(a='', b=12345)", thrift_util.simpler_string(struct))
        struct.a = None
        self.assertEquals("TestStruct(b=12345)", thrift_util.simpler_string(struct))

        nested = TestNesting()
        nested.nested_struct = struct
        self.assertEquals("TestNesting(nested_struct=TestStruct(b=12345))", thrift_util.simpler_string(nested))
예제 #2
0
    def test_simpler_string(self):
        struct = TestStruct()
        self.assertEquals("TestStruct()", thrift_util.simpler_string(struct))
        struct.a = "hello world"
        self.assertEquals("TestStruct(a='hello world')",
                          thrift_util.simpler_string(struct))
        struct.a = ""
        struct.b = 12345
        self.assertEquals("TestStruct(a='', b=12345)",
                          thrift_util.simpler_string(struct))
        struct.a = None
        self.assertEquals("TestStruct(b=12345)",
                          thrift_util.simpler_string(struct))

        nested = TestNesting()
        nested.nested_struct = struct
        self.assertEquals("TestNesting(nested_struct=TestStruct(b=12345))",
                          thrift_util.simpler_string(nested))