fix: Fix test fixtures for new annotation structure

This commit is contained in:
Marty Oehme 2024-01-24 11:14:45 +01:00
parent 67bfc30396
commit 333bd279b9
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
2 changed files with 10 additions and 9 deletions

View file

@ -1,5 +1,6 @@
from papis.document import Document
import pytest import pytest
from papis.document import Document
from papis_extract.annotation import Annotation from papis_extract.annotation import Annotation
@ -20,8 +21,8 @@ from papis_extract.annotation import Annotation
def test_formatting_replacements(fmt_string, expected): def test_formatting_replacements(fmt_string, expected):
sut = Annotation( sut = Annotation(
"myfile", "myfile",
text="I am the text value", content="I am the text value",
content="Whereas I represent the note", note="Whereas I represent the note",
) )
assert sut.format(fmt_string) == expected assert sut.format(fmt_string) == expected
@ -38,8 +39,8 @@ def test_formatting_replacements(fmt_string, expected):
def test_formatting_document_access(fmt_string, expected): def test_formatting_document_access(fmt_string, expected):
sut = Annotation( sut = Annotation(
"myfile", "myfile",
text="I am the text value", content="I am the text value",
content="Whereas I represent the note", note="Whereas I represent the note",
) )
doc = Document(data={"title": "document-title", "author": "document-author"}) doc = Document(data={"title": "document-title", "author": "document-author"})
@ -47,7 +48,7 @@ def test_formatting_document_access(fmt_string, expected):
def test_colorname_matches_exact(): def test_colorname_matches_exact():
sut = Annotation("testfile", colors=(1.0, 0.0, 0.0), minimum_similarity_color=1.0) sut = Annotation("testfile", color=(1.0, 0.0, 0.0), minimum_similarity_color=1.0)
c_name = sut.colorname c_name = sut.colorname
assert c_name == "red" assert c_name == "red"
@ -64,6 +65,6 @@ def test_colorname_matches_exact():
], ],
) )
def test_matches_inexact_colorname(color_value): def test_matches_inexact_colorname(color_value):
sut = Annotation("testfile", colors=color_value, minimum_similarity_color=0.833) sut = Annotation("testfile", color=color_value, minimum_similarity_color=0.833)
c_name = sut.colorname c_name = sut.colorname
assert c_name == "red" assert c_name == "red"

View file

@ -11,8 +11,8 @@ from papis_extract.formatter import (
document = Document(data={"author": "document-author", "title": "document-title"}) document = Document(data={"author": "document-author", "title": "document-title"})
annotations = [ annotations = [
Annotation("myfile.pdf", text="my lovely text"), Annotation("myfile.pdf", content="my lovely text"),
Annotation("myfile.pdf", text="my second text", content="with note"), Annotation("myfile.pdf", content="my second text", note="with note"),
] ]
md_default_output = """============== --------------- md_default_output = """============== ---------------
document-title - document-author document-title - document-author