Skip to content

Commit

Permalink
Add test for protectAllClassesRaises
Browse files Browse the repository at this point in the history
  • Loading branch information
juan-g-bonilla committed Jun 6, 2024
1 parent 021dd16 commit 24b3f09
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/tests/test_protectAllClasses.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

from Basilisk.moduleTemplates import cModuleTemplate
from Basilisk.moduleTemplates import cppModuleTemplate

import numpy.testing as npt

def test_protectAllClassesRaises():
mod1 = cModuleTemplate.cModuleTemplate()
mod2 = cppModuleTemplate.CppModuleTemplate()

expected_ex = "You tried to add this variable(.*)"

with npt.assert_raises_regex(ValueError, expected_ex):
mod1.error = "error"

with npt.assert_raises_regex(ValueError, expected_ex):
mod2.error = "error"

if __name__ == "__main__":
test_protectAllClassesRaises()

0 comments on commit 24b3f09

Please sign in to comment.