I have an application that takes an xml file as input and converts this data into a specific data structure. I would like to write a test for this application, but instead of using an external xml file I would like to define the xml data inside the test file and then pass this data to the function, so originally my idea was to do something like this:
data = pd.DataFrame([#insert data here])
in_memory_xml = io.BytesIO()
xml_file = original.to_xml(in_memory_xml)
my_function(xml_file)
However, pandas DataFrame objects do not have a "to_xml" function, so the xml data needs to be defined differently.Is there good way to solve this problem that doesn't involve the use of an external xml file?