Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
python_DSI_Parser
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Benedikt
python_DSI_Parser
Commits
fbb1e825
Commit
fbb1e825
authored
1 year ago
by
Vanessa Stehr
Browse files
Options
Downloads
Patches
Plain Diff
Add test for empty "per"
parent
ab65ddfe
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#31563
passed
1 year ago
Stage: test
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_main.py
+7
-0
7 additions, 0 deletions
tests/test_main.py
with
7 additions
and
0 deletions
tests/test_main.py
+
7
−
0
View file @
fbb1e825
...
...
@@ -91,6 +91,13 @@ def test_fraction():
assert
len
(
tree
.
warnings
)
==
1
assert
tree
.
warnings
==
[
r
'
The dsi string contains more than one \per, does not match specs! Given string: \metre\per\metre\per\metre
'
]
# empty fraction
with
pytest
.
warns
(
RuntimeWarning
,
match
=
r
'
The dsi string contains a \\per missing a numerator or denominator! Given string: \\per\\one
'
):
tree
=
p
.
parse
(
r
'
\per\one
'
)
assert
tree
.
toLatex
()
==
r
'
$$1$$
'
assert
not
tree
.
valid
assert
len
(
tree
.
warnings
)
==
1
def
test_empty
():
with
pytest
.
warns
(
RuntimeWarning
,
match
=
'
Given D-SI string is empty!
'
):
assert
p
.
parse
(
''
).
toLatex
()
==
''
...
...
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