Rename library
Signed-off-by: András Schmelczer <andras@schmelczer.dev>
This commit is contained in:
parent
01befc54a6
commit
04404f2fc4
141 changed files with 844 additions and 842 deletions
|
|
@ -1,44 +0,0 @@
|
|||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from src.good_ai.utilities.publication_tei import PublicationTEI
|
||||
|
||||
from .data.parsed import authors, content, metadata, sentences
|
||||
|
||||
DATA_PATH = Path(__file__).parent.resolve() / "data"
|
||||
|
||||
|
||||
class TestPublicationTEI(unittest.TestCase):
|
||||
test_xml: str
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls) -> None:
|
||||
with open(
|
||||
DATA_PATH / "10.1136_bmjspcare-2021-003026.pdf.tei.xml", encoding="utf-8"
|
||||
) as f:
|
||||
cls.test_xml = f.read()
|
||||
|
||||
def test_metadata_extraction(self) -> None:
|
||||
self.assertEqual(PublicationTEI(self.test_xml).publication_metadata, metadata)
|
||||
|
||||
def test_authors(self) -> None:
|
||||
self.assertEqual(PublicationTEI(self.test_xml).authors, authors)
|
||||
|
||||
def test_content(self) -> None:
|
||||
self.assertEqual(PublicationTEI(self.test_xml).content, content)
|
||||
|
||||
def test_sentences(self) -> None:
|
||||
self.assertEqual(PublicationTEI(self.test_xml).sentences, sentences)
|
||||
|
||||
def test_empty1(self) -> None:
|
||||
tei = PublicationTEI("<TEI/>")
|
||||
tei.publication_metadata, tei.publication_metadata, tei.authors, tei.content, tei.sentences
|
||||
|
||||
def test_empty2(self) -> None:
|
||||
tei = PublicationTEI("")
|
||||
tei.publication_metadata, tei.publication_metadata, tei.authors, tei.content, tei.sentences
|
||||
|
||||
def test_missing_fields(self) -> None:
|
||||
with open(DATA_PATH / "bad.tei.xml", encoding="utf-8") as f:
|
||||
tei = PublicationTEI(f.read())
|
||||
tei.publication_metadata, tei.publication_metadata, tei.authors, tei.content, tei.sentences
|
||||
Loading…
Add table
Add a link
Reference in a new issue