def test_load_fp(): thrift = None with open('parser-cases/shared.thrift') as thrift_fp: thrift = load_fp(thrift_fp, 'shared_thrift') assert thrift.__name__ == 'shared_thrift' assert thrift.__thrift_file__ is None assert thrift.__thrift_meta__['structs'] == [thrift.SharedStruct] assert thrift.__thrift_meta__['services'] == [thrift.SharedService]
def test_e_load_fp(): with pytest.raises(ThriftParserError) as excinfo: with open('parser-cases/tutorial.thrift') as thrift_fp: load_fp(thrift_fp, 'tutorial_thrift') assert ('Unexpected include statement while loading ' 'from file like object.') == str(excinfo.value)