Exemplo n.º 1
0
    def test_write_xml_is_sane(self):
        """Check that EventWriter.write_xml_document writes sensible
        XML to the output stream."""
        out = StringIO()
        err = StringIO()

        ew = EventWriter(out, err)

        expected_xml = ET.parse(data_open("data/event_maximal.xml")).getroot()

        ew.write_xml_document(expected_xml)
        found_xml = ET.fromstring(out.getvalue())

        self.assertTrue(xml_compare(expected_xml, found_xml))
Exemplo n.º 2
0
    def test_write_xml_is_sane(self):
        """Check that EventWriter.write_xml_document writes sensible
        XML to the output stream."""
        out = StringIO()
        err = StringIO()

        ew = EventWriter(out, err)

        expected_xml = ET.parse(data_open("data/event_maximal.xml")).getroot()

        ew.write_xml_document(expected_xml)
        found_xml = ET.fromstring(out.getvalue())

        self.assertTrue(xml_compare(expected_xml, found_xml))
Exemplo n.º 3
0
def test_write_xml_is_sane(capsys):
    """Check that EventWriter.write_xml_document writes sensible
    XML to the output stream."""

    ew = EventWriter(sys.stdout, sys.stderr)

    with data_open("data/event_maximal.xml") as data:
        expected_xml = ET.parse(data).getroot()

        ew.write_xml_document(expected_xml)
        captured = capsys.readouterr()
        found_xml = ET.fromstring(captured.out)

        assert xml_compare(expected_xml, found_xml)