def test_dict_response(): assert { "dog": 7, "cat": 5 } == thrift_manager.translate_thrift_response({ "dog": 7, "cat": 5 })
def test_struct_response(): struct_thrift_module = load_thrift_from_testdir("structThrift.thrift") assert { "__thrift_struct_class__": "MyStruct", "myIntStruct": 4, "myOtherStruct": { "__thrift_struct_class__": "MyOtherStruct", "ints": [9, 4, 1, 11], "id": "test", }, } == thrift_manager.translate_thrift_response( struct_thrift_module.MyStruct( myIntStruct=4, myOtherStruct=struct_thrift_module.MyOtherStruct( id="test", ints=[9, 4, 1, 11]), ))
def test_list_response(): assert [1, 2, 3] == thrift_manager.translate_thrift_response([1, 2, 3])
def test_set_response(): assert {1, 2, 3} == thrift_manager.translate_thrift_response({1, 2, 3})
def test_translate_basic_response(): assert 4 == thrift_manager.translate_thrift_response(4)