Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Dynamic Exposure
OpenBuildingMap
rabotnik-obm
Commits
4edb8fde
Commit
4edb8fde
authored
Sep 16, 2021
by
Marius Kriegerowski
Browse files
fix tags
parent
5f4a1124
Changes
3
Hide whitespace changes
Inline
Side-by-side
rabotnikobm/rules/gem_occupancy/mapping.py
View file @
4edb8fde
...
...
@@ -47,9 +47,10 @@ class GEMTag:
def
from_string
(
cls
,
tag_as_string
:
str
)
->
GEMTag
:
"""Instantiate `GEMClassification`s from GEM occupancy string."""
matched
=
re
.
search
(
REGEX_GEM_GROUP
,
tag_as_string
,
re
.
IGNORECASE
)
assert
matched
is
not
None
,
f
"could not convert '
{
tag_as_string
}
' to GEMTag"
group
=
str
(
matched
.
group
(
"group"
))
assert
len
(
group
)
>
0
,
f
"could not extract
a GEM
group from
{
tag_as_string
}
"
assert
group
,
f
"could not extract
`
group
`
from
{
tag_as_string
}
"
sub_group
=
matched
.
group
(
"sub_group"
)
sub_group
=
int
(
sub_group
)
if
sub_group
!=
""
else
None
...
...
tests/test_get_gem_occupancy.py
View file @
4edb8fde
...
...
@@ -56,11 +56,9 @@ def test_overriding_occupancy(overriding_occupancies):
assert
occupancy
==
GEMTag
.
from_string
(
"COM10"
)
def
test_overriding_occupancy_unknown
(
overriding_occupancies
):
"""Rule #1"""
demo_tags
=
TagStatistics
.
from_strings
([
"unknown tag"
])
occupancy
=
overriding_occupancies
.
apply
(
demo_tags
)
assert
occupancy
is
None
def
test_overriding_occupancy_unknown
():
with
pytest
.
raises
(
AssertionError
):
TagStatistics
.
from_strings
([
"unknown tag"
])
def
test_unique_tags
():
...
...
tests/test_occupancy_mapping.py
View file @
4edb8fde
...
...
@@ -47,6 +47,11 @@ def test_gem_classification_parser():
assert
GEMTag
.
from_string
(
"UNDECIDABLE"
).
sub_group
is
None
with
pytest
.
raises
(
AssertionError
):
# Tag must not contain whitespace
GEMTag
.
from_string
(
"unknown tag"
)
with
pytest
.
raises
(
AssertionError
):
# Tag must start with character (group)
GEMTag
.
from_string
(
"1"
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment