Skip to content

Commit

Permalink
combine concatenator delim attribute unit tests, and reset values
Browse files Browse the repository at this point in the history
  • Loading branch information
danielfromearth committed Jul 1, 2024
1 parent 5253857 commit 23dc2fb
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions tests/unit/test_attribute_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,28 @@ def test_coordinate_attribute_regrouping():
)


def test_concatenator_options_getting():
assert concatenator.group_delim == "__"
assert concatenator.coord_delim == " "
assert concatenator.__options__.group_delim == "__"
with pytest.raises(AttributeError):
_ = concatenator.nonexistent_attribute


def test_concatenator_options_setting():
def test_concatenator_options_getting_and_setting():
"""Test setting attributes for the concatenator module.
Note that currently, new attributes can be defined dynamically.
Note also, that attributes must be reset before further testing because they are global.
"""
default_group_delim = "__"
assert concatenator.group_delim == default_group_delim
concatenator.group_delim = "%"
assert concatenator.group_delim == "%"
concatenator.group_delim = default_group_delim
assert concatenator.group_delim == default_group_delim

default_coord_delim = " "
assert concatenator.coord_delim == default_coord_delim
concatenator.coord_delim = "---"
assert concatenator.coord_delim == "---"
concatenator.group_delim = default_coord_delim
assert concatenator.group_delim == default_coord_delim

concatenator.nonexistent_attribute = "---"
assert concatenator.nonexistent_attribute == "---"
del concatenator.nonexistent_attribute
with pytest.raises(AttributeError):
_ = concatenator.nonexistent_attribute

0 comments on commit 23dc2fb

Please sign in to comment.