Skip to content

Commit

Permalink
test all none exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Aug 25, 2023
1 parent 9552178 commit a88206e
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions unittests/test_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

from spinn_utilities.config_setup import unittest_setup
from spinn_utilities.config_holder import (
get_config_bool, get_config_float_or_none, get_config_int_or_none,
get_config_bool, get_config_bool_or_none, get_config_float,
get_config_float_or_none, get_config_int, get_config_int_or_none,
get_config_str, get_config_str_or_none, set_config)
from spinn_utilities.exceptions import ConfigException, SpiNNUtilsException

Expand All @@ -24,12 +25,27 @@ def test_configs_None():
set_config("Mode", "Foo", "None")
set_config("Mode", "Bar", "none")
assert get_config_str_or_none("Mode", "Foo") is None
try:
assert get_config_str("Mode", "Foo") is None
raise SpiNNUtilsException("Expected ConfigException")
except ConfigException:
pass
assert get_config_str_or_none("Mode", "bar") is None
assert get_config_int_or_none("Mode", "Foo") is None
try:
assert get_config_int("Mode", "Foo") is None
raise SpiNNUtilsException("Expected ConfigException")
except ConfigException:
pass
assert get_config_float_or_none("Mode", "Foo") is None
#assert get_config_bool("Mode", "Foo") is None
try:
assert get_config_str("Mode", "Foo") is None
assert get_config_float("Mode", "Foo") is None
raise SpiNNUtilsException("Expected ConfigException")
except ConfigException:
pass
assert get_config_bool_or_none("Mode", "Foo") is None
try:
assert get_config_bool("Mode", "Foo") is None
raise SpiNNUtilsException("Expected ConfigException")
except ConfigException:
pass

0 comments on commit a88206e

Please sign in to comment.