From f2253185ac531d4e8aa2593a8a28e4b981a54b3c Mon Sep 17 00:00:00 2001
From: Felix Kleinert <f.kleinert@fz-juelich.de>
Date: Fri, 6 Mar 2020 10:16:26 +0100
Subject: [PATCH] add an additional test fkt to check if ecorrect error is
 raised #68

---
 test/test_model_modules/test_keras_extensions.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/test/test_model_modules/test_keras_extensions.py b/test/test_model_modules/test_keras_extensions.py
index 17ab4f6d..35188933 100644
--- a/test/test_model_modules/test_keras_extensions.py
+++ b/test/test_model_modules/test_keras_extensions.py
@@ -179,6 +179,13 @@ class TestCallbackHandler:
                                                             {"name": "other_clbk", "other_clbk": "callback_other",
                                                              "path": "otherpath"}]
 
+    def test_add_callback_raise(self, clbk_handler):
+        clbk_handler.editable = False
+        with pytest.raises(PermissionError) as einfo:
+            clbk_handler.add_callback("callback_new_instance", "this_path")
+        assert 'CallbackHandler is protected and cannot be edited.' in str(einfo.value)
+
+
     def test_get_callbacks_as_dict(self, clbk_handler_with_dummies):
         clbk = clbk_handler_with_dummies
         assert clbk.get_callbacks() == [{"callback": "callback_new_instance", "path": "this_path"},
-- 
GitLab