Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CaosDB Crawler
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
CaosDB Crawler
Commits
3bb7861a
Commit
3bb7861a
authored
8 months ago
by
Alexander Schlemmer
Browse files
Options
Downloads
Patches
Plain Diff
TST: adapted tests to new xml converter
parent
0ddc150f
No related branches found
No related tags found
2 merge requests
!181
Release 0.9.0
,
!174
XML Converter
Pipeline
#54371
failed
8 months ago
Stage: info
Stage: setup
Stage: cert
Stage: style
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
unittests/test_xml_converter.py
+9
-8
9 additions, 8 deletions
unittests/test_xml_converter.py
with
9 additions
and
8 deletions
unittests/test_xml_converter.py
+
9
−
8
View file @
3bb7861a
...
...
@@ -134,8 +134,9 @@ def test_simple_xml(basic_xmltag_converter):
"""
xml
=
fromstring
(
xml_text
)
tag
=
XMLTagElement
(
xml
)
assert
tag
.
name
==
"
.
"
tag
=
XMLTagElement
(
xml
.
getroot
(),
xml
)
m
=
basic_xmltag_converter
.
match
(
tag
)
assert
m
is
not
None
...
...
@@ -145,7 +146,7 @@ def test_simple_xml(basic_xmltag_converter):
def
test_not_matching
(
basic_xmltag_converter
):
m
=
basic_xmltag_converter
.
match
(
XMLTagElement
(
"
tag
"
,
fromstring
(
"""
m
=
basic_xmltag_converter
.
match
(
XMLTagElement
(
fromstring
(
"""
<a href=
"
test1
"
>
test <img src=
"
test2
"
/>
</a>
...
...
@@ -153,7 +154,7 @@ def test_not_matching(basic_xmltag_converter):
assert
m
is
None
# alt-attribute was missing
m
=
basic_xmltag_converter
.
match
(
XMLTagElement
(
"
tag
"
,
fromstring
(
"""
m
=
basic_xmltag_converter
.
match
(
XMLTagElement
(
fromstring
(
"""
<a href=
"
test
"
alt=
"
no link
"
>
test <img src=
"
test2
"
/>
</a>
...
...
@@ -161,7 +162,7 @@ def test_not_matching(basic_xmltag_converter):
assert
m
is
None
# href attribute did not match
m
=
basic_xmltag_converter
.
match
(
XMLTagElement
(
"
tag
"
,
fromstring
(
"""
m
=
basic_xmltag_converter
.
match
(
XMLTagElement
(
fromstring
(
"""
<a href=
"
test1
"
url=
"
http
"
alt=
"
no link
"
>
test <img src=
"
test2
"
/>
</a>
...
...
@@ -169,13 +170,13 @@ def test_not_matching(basic_xmltag_converter):
assert
m
is
None
# href and url must not be present simultaneously
m
=
basic_xmltag_converter
.
match
(
XMLTagElement
(
"
tag
"
,
fromstring
(
"""
m
=
basic_xmltag_converter
.
match
(
XMLTagElement
(
fromstring
(
"""
<a href=
"
test1
"
alt=
"
no link
"
><img src=
"
test2
"
/></a>
"""
)))
assert
m
is
None
# text node is empty
m
=
basic_xmltag_converter
.
match
(
XMLTagElement
(
"
tag
"
,
fromstring
(
"""
m
=
basic_xmltag_converter
.
match
(
XMLTagElement
(
fromstring
(
"""
<a href=
"
test1
"
alt=
"
no link
"
/>
"""
)))
...
...
@@ -197,7 +198,7 @@ def test_nested_simple_xml(basic_xmltag_converter):
</a>
"""
tag
=
XMLTagElement
(
"
tag
"
,
fromstring
(
xml_text
))
tag
=
XMLTagElement
(
fromstring
(
xml_text
))
m
=
basic_xmltag_converter
.
match
(
tag
)
assert
m
is
not
None
...
...
@@ -207,4 +208,4 @@ def test_nested_simple_xml(basic_xmltag_converter):
assert
len
(
children
)
==
1
assert
isinstance
(
children
[
0
],
XMLTagElement
)
assert
children
.
name
==
"
/a/
img
"
assert
children
[
0
]
.
name
==
"
img
"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment