def test_simplest_xml(self): p = pxml.Pipeline() p.source = pxml.Reader('foo') xml = p.xml() self.assertEqual(xml.getroot().attrib['version'], version.as_string()) self.assertEqual( xml.find('Reader').attrib['type'], 'drivers.foo.reader')
def test_reader_source_error(self): reader = pxml.Reader('foo') otherreader = pxml.Reader('bar') self.assertRaises(ValueError, setattr, reader, 'source', otherreader)
def test_multifilter_source(self): mfilter = pxml.MultiFilter('multi') mfilter.source = [pxml.Reader('foo'), pxml.Reader('bar')] xml = mfilter.xml() self.assertEqual(len(xml.findall('Reader')), 2)
def test_writer_source(self): writer = pxml.Writer('foo') writer.source = pxml.Reader('bar') xml = writer.xml() self.assert_(xml.find('Reader') is not None)