Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix excel2xml testdata #921

Merged
merged 4 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dsp_tools/resources/schema/data.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<!-- data type for knora uri -->
<xs:simpleType name="knorauri_type">
<xs:restriction base="xs:string">
<xs:pattern value="([a-z][a-z0-9+.\-]*):(//([\w_.\-~:\[\]]+)(:\d{0,6})?)(/[\w_.\-~:%()]*)*(\?[\w_.,;/\-:%=*&amp;]+)*(#[\w_.\-~:/]*)?"/>
<xs:pattern value="([a-z][a-z0-9+.\-]*):(//([\w_.\-~:\[\]]+)(:\d{0,6})?)(/[\w_.\-~:%()]*)*(\?[\w_.,;/\-:%=*&amp;]+)*(#[\w_.\-,~:/]*)?"/>
</xs:restriction>
</xs:simpleType>

Expand Down
18 changes: 15 additions & 3 deletions test/integration/commands/excel2xml/test_excel2xml_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,31 @@ def expected_output() -> str:

class TestDifferentExtensions:
def test_xlsx(self, expected_output: str) -> None:
excel2xml_cli.excel2xml("testdata/excel2xml/excel2xml-testdata.xlsx", "1234", "excel2xml-output")
success, problems = excel2xml_cli.excel2xml(
"testdata/excel2xml/excel2xml-testdata.xlsx", "1234", "excel2xml-output"
)
assert success
assert not problems
returned = Path("excel2xml-output-data.xml")
assert returned.read_text() == expected_output
returned.unlink(missing_ok=True)

def test_xls(self, expected_output: str) -> None:
excel2xml_cli.excel2xml("testdata/excel2xml/excel2xml-testdata.xls", "1234", "excel2xml-output")
success, problems = excel2xml_cli.excel2xml(
"testdata/excel2xml/excel2xml-testdata.xls", "1234", "excel2xml-output"
)
assert success
assert not problems
returned = Path("excel2xml-output-data.xml")
assert returned.read_text() == expected_output
returned.unlink(missing_ok=True)

def test_csv(self, expected_output: str) -> None:
excel2xml_cli.excel2xml("testdata/excel2xml/excel2xml-testdata.csv", "1234", "excel2xml-output")
success, problems = excel2xml_cli.excel2xml(
"testdata/excel2xml/excel2xml-testdata.csv", "1234", "excel2xml-output"
)
assert success
assert not problems
returned = Path("excel2xml-output-data.xml")
assert returned.read_text() == expected_output
returned.unlink(missing_ok=True)
Expand Down
9 changes: 4 additions & 5 deletions testdata/excel2xml/excel2xml-expected-output.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
<text permissions="prop-default" encoding="utf8">Homer</text>
<text permissions="prop-default" encoding="utf8">Ὅμηρος</text>
<text permissions="prop-default" encoding="utf8">??</text>
<text permissions="prop-default" encoding="utf8">-</text>
</text-prop>
<uri-prop name=":hasIdentifier">
<uri permissions="prop-default">https://en.wiktionary.org/wiki/Ῥόδος</uri>
Expand Down Expand Up @@ -61,7 +60,7 @@
</resource>
<annotation label="Annotation to Homer" id="annotation_0" permissions="res-default">
<text-prop name="hasComment">
<text permissions="prop-default" encoding="utf8">This is an annotation to the resource Homer</text>
<text permissions="prop-default" encoding="xml">This is an annotation to the resource Homer</text>
</text-prop>
<resptr-prop name="isAnnotationOf">
<resptr permissions="prop-default">person_0</resptr>
Expand Down Expand Up @@ -92,8 +91,8 @@
</resource>
<region label="Region of img_obj_6" id="region_0" permissions="res-restricted" iri="http://rdfh.ch/4123/54SYvWF0QUW6a">
<text-prop name="hasComment">
<text permissions="prop-restricted" encoding="utf8">This is an annotation to Testthing.</text>
<text permissions="prop-restricted" encoding="utf8">Second comment</text>
<text permissions="prop-restricted" encoding="xml">This is an annotation to Testthing.</text>
<text permissions="prop-restricted" encoding="xml">Second comment</text>
</text-prop>
<color-prop name="hasColor">
<color permissions="prop-restricted">#5d1f1e</color>
Expand Down Expand Up @@ -147,7 +146,7 @@
</resource>
<link label="Link between person_0 and img_obj_6" id="link_thing_0" permissions="res-default" ark="ark:/72163/4123-31ec6eab334-a.202280">
<text-prop name="hasComment">
<text permissions="prop-default" encoding="utf8">This is a link between Homer and Iliad Prooem</text>
<text permissions="prop-default" encoding="xml">This is a link between Homer and Iliad Prooem</text>
</text-prop>
<resptr-prop name="hasLinkTo">
<resptr permissions="prop-default">person_0</resptr>
Expand Down