@@ -68,33 +68,13 @@ def test_xml_import_export_cycle(self):
6868 assert block .num_inputs == 3
6969 assert block .num_top_words == 100
7070
71- if settings .USE_EXTRACTED_WORD_CLOUD_BLOCK :
72- # For extracted XBlocks, we need to manually export the XML definition to a file to properly test the
73- # import/export cycle. This is because extracted XBlocks use XBlock core's `add_xml_to_node` method,
74- # which does not export the XML to a file like `XmlMixin.add_xml_to_node` does.
75- filepath = 'word_cloud/block_id.xml'
76- runtime .export_fs .makedirs (os .path .dirname (filepath ), recreate = True )
77- with runtime .export_fs .open (filepath , 'wb' ) as fileObj :
78- runtime .export_to_xml (block , fileObj )
79- else :
80- node = etree .Element ("unknown_root" )
81- # This will export the olx to a separate file.
82- block .add_xml_to_node (node )
71+ node = etree .Element ("unknown_root" )
72+ # This will export the olx to a separate file.
73+ block .add_xml_to_node (node )
8374
8475 with runtime .export_fs .open ('word_cloud/block_id.xml' ) as f :
8576 exported_xml = f .read ()
8677
87- if settings .USE_EXTRACTED_WORD_CLOUD_BLOCK :
88- # For extracted XBlocks, we need to remove the `xblock-family` attribute from the exported XML to ensure
89- # consistency with the original XML.
90- # This is because extracted XBlocks use the core XBlock's `add_xml_to_node` method, which includes this
91- # attribute, whereas `XmlMixin.add_xml_to_node` does not.
92- exported_xml_tree = etree .fromstring (exported_xml .encode ('utf-8' ))
93- etree .cleanup_namespaces (exported_xml_tree )
94- if 'xblock-family' in exported_xml_tree .attrib :
95- del exported_xml_tree .attrib ['xblock-family' ]
96- exported_xml = etree .tostring (exported_xml_tree , encoding = 'unicode' , pretty_print = True )
97-
9878 assert exported_xml == original_xml
9979
10080 def test_bad_ajax_request (self ):
0 commit comments