def test_list_of_strings(self): """ Tests unicode and non-unicode strings. (This test arose as a bug.) """ self.assertBackAndForth(TestManyTypes(a_string_list=["alpha", "beta"])) self.assertBackAndForth(TestManyTypes(a_string_list=[u"alpha", u"beta"]))
def test_map(self): x = TestManyTypes() x.a_map = dict([ (i, TestStruct(b=i)) for i in range(4) ]) self.assertBackAndForth(x)
def test_list(self): x = TestManyTypes() x.a_list = [ TestStruct(b=i) for i in range(4) ] self.assertBackAndForth(x)
def test_set(self): x = TestManyTypes() x.a_set=set([1,2,3,4,5]) self.assertBackAndForth(x)
def test_struct(self): x = TestManyTypes() inner = TestStruct(a="foo") x.a_struct = inner self.assertBackAndForth(x)
def test_map(self): x = TestManyTypes() x.a_map = dict([(i, TestStruct(b=i)) for i in range(4)]) self.assertBackAndForth(x)
def test_list(self): x = TestManyTypes() x.a_list = [TestStruct(b=i) for i in range(4)] self.assertBackAndForth(x)
def test_set(self): x = TestManyTypes() x.a_set = set([1, 2, 3, 4, 5]) self.assertBackAndForth(x)
def test_default(self): x = jsonable2thrift(dict(), TestManyTypes) self.assertEquals(TestManyTypes(a_string_with_default="the_default"), x)
def help(key, value, expect_failure=False): x = TestManyTypes() setattr(x, key, value) self.assertBackAndForth(x)