def test_basic_write_and_read(self):
		(sentinel, schema_root) = self.__create_tree()
		out = StringIO.StringIO()
		writer = XMLTreeWriter(out)
		writer.write(sentinel)
		out_str = out.getvalue()
		in_ = StringIO.StringIO(out_str)
		reader = XMLTreeReader(in_)
		new_sentinel = StandardNode()
		reader.read(new_sentinel)
		self.assert_(subtrees_equal(schema_root, new_sentinel.get_child("root")))
		out2 = StringIO.StringIO()
		writer2 = XMLTreeWriter(out2)
		writer2.write(new_sentinel)
		out2_str = out2.getvalue()
		self.assertEqual(out_str, out2_str)
Example #2
0
 def test_basic_write_and_read(self):
     (sentinel, schema_root) = self.__create_tree()
     out = StringIO.StringIO()
     writer = XMLTreeWriter(out)
     writer.write(sentinel)
     out_str = out.getvalue()
     in_ = StringIO.StringIO(out_str)
     reader = XMLTreeReader(in_)
     new_sentinel = StandardNode()
     reader.read(new_sentinel)
     self.assert_(
         subtrees_equal(schema_root, new_sentinel.get_child("root")))
     out2 = StringIO.StringIO()
     writer2 = XMLTreeWriter(out2)
     writer2.write(new_sentinel)
     out2_str = out2.getvalue()
     self.assertEqual(out_str, out2_str)
 def __load_state_file(file_path, sentinel):
     with open(file_path) as f:
         reader = XMLTreeReader(f)
         reader.read(sentinel)
     MultithreadedCrawler.__change_state_from_PROCESSING_to_OPEN(
         sentinel.get_child("root"))
	def __load_state_file(file_path, sentinel):
		with open(file_path) as f:
			reader = XMLTreeReader(f)
			reader.read(sentinel)
		MultithreadedCrawler.__change_state_from_PROCESSING_to_OPEN(
			sentinel.get_child("root"))