Skip to content

Commit

Permalink
use assertIn idiom for readonly attribute test
Browse files Browse the repository at this point in the history
  • Loading branch information
filimarc committed Dec 22, 2023
1 parent c429fcb commit 8431968
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions tests/test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,9 @@ def test_readonly_attributes(self):
with self.assertRaises(CastError) as ec:
Configuration(tree)
# Need a further check since CastError is raised before AttributeError
if "Configuration attribute key 'region' conflicts with readonly" in str(
ec.exception
):
pass
else:
raise AttributeError("Readonly class attribute conflicts")
check_str = "Configuration attribute key 'region' conflicts with readonly"
msg_str = "Readonly class attribute conflicts"
self.assertIn(check_str, str(ec.exception), msg_str)


class TestConfigAttrs(unittest.TestCase):
Expand Down

0 comments on commit 8431968

Please sign in to comment.