def test_multiple_components(self):

        test_input = [('bob', 'foo'), ('b', 'bar'), ('sr', 'foobar')]
        expected_xml = '<TokenSequence><foo>bob</foo> <bar>b</bar> <foobar>sr</foobar></TokenSequence>'

        assert etree.tostring(sequence2XML(
            test_input, 'TokenSequence')).decode('utf-8') == expected_xml
Example #2
0
def XMLequals(labeled_sequence, xml):
    correct_xml = '<TokenSequence>' + xml + '</TokenSequence>'
    generated_xml = etree.tostring(
        sequence2XML(labeled_sequence, 'TokenSequence')).decode('utf-8')
    print('Correct:   %s' % correct_xml)
    print('Generated: %s' % generated_xml)
    assert correct_xml == generated_xml
    def test_single_component(self):

        test_input = [("bob", "foo")]
        expected_xml = "<TokenSequence><foo>bob</foo></TokenSequence>"
        assert etree.tostring(sequence2XML(test_input, "TokenSequence")).decode("utf-8") == expected_xml
    def test_multiple_components(self):

        test_input = [("bob", "foo"), ("b", "bar"), ("sr", "foobar")]
        expected_xml = "<TokenSequence><foo>bob</foo> <bar>b</bar> <foobar>sr</foobar></TokenSequence>"

        assert etree.tostring(sequence2XML(test_input, "TokenSequence")).decode("utf-8") == expected_xml
    def test_single_component(self):

        test_input = [('bob', 'foo')]
        expected_xml = '<TokenSequence><foo>bob</foo></TokenSequence>'
        assert etree.tostring(sequence2XML(
            test_input, 'TokenSequence')).decode('utf-8') == expected_xml
Example #6
0
def XMLequals(labeled_sequence, xml):
    correct_xml = '<TokenSequence>' + xml + '</TokenSequence>'
    generated_xml = etree.tostring( sequence2XML(labeled_sequence, 'TokenSequence') ).decode('utf-8')
    print('Correct:   %s' %correct_xml)
    print('Generated: %s' %generated_xml)
    assert correct_xml == generated_xml
Example #7
0
    def test_two_components(self):

        test_input = [('bob', 'foo'), ('b', 'bar')]
        expected_xml = b'<TokenSequence><foo>bob</foo> <bar>b</bar></TokenSequence>'
        assert etree.tostring(sequence2XML(test_input,
                                           'TokenSequence')) == expected_xml
    def test_single_component(self) :

        test_input = [ ('bob', 'foo') ]
        expected_xml = '<TokenSequence><foo>bob</foo></TokenSequence>'
        assert etree.tostring( sequence2XML(test_input, 'TokenSequence') ) == expected_xml
    def test_multiple_components(self) :

        test_input = [ ('bob', 'foo'), ('b', 'bar'), ('sr', 'foobar') ]
        expected_xml = '<TokenSequence><foo>bob</foo> <bar>b</bar> <foobar>sr</foobar></TokenSequence>'

        assert etree.tostring( sequence2XML(test_input, 'TokenSequence') ) == expected_xml