aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_errors.py
blob: 853755159a78008b5c1a3dc0b18f9b8be91c7eaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import xml.etree.ElementTree

import pytest

from grobid_tei_xml import parse_citation_list_xml


def test_doc_parse_error() -> None:
    """
    This XML document has a bare '&' (should be '&') and results in a parse
    error.

    See also: https://github.com/kermitt2/grobid/issues/848

    The intent of this test is to ensure that the exception raised is the one
    expected, especially if that behavior changes in the future.
    """

    with open("tests/files/citation_list/parse_error.tei.xml", "r") as f:
        tei_xml = f.read()

    with pytest.raises(xml.etree.ElementTree.ParseError):
        parse_citation_list_xml(tei_xml)