Skip to content
Snippets Groups Projects
Commit 9888516e authored by Alfen, T. van (Tanja)'s avatar Alfen, T. van (Tanja)
Browse files

Fix for AttributeError in id_regex match.group()

parent e12808e1
No related branches found
No related tags found
No related merge requests found
...@@ -45,18 +45,18 @@ class ControllerTest(pyfakefs.fake_filesystem_unittest.TestCase): ...@@ -45,18 +45,18 @@ class ControllerTest(pyfakefs.fake_filesystem_unittest.TestCase):
self.assertEqual(controller._source_files, []) self.assertEqual(controller._source_files, [])
self.assertEqual(controller._shadow_files, []) self.assertEqual(controller._shadow_files, [])
# def test_compare_files_view(self): def test_compare_files_view(self):
# model, view, controller = self.makeMVC() model, view, controller = self.makeMVC()
# controller._source_files = ["foo"] controller._source_files = ["foo"]
# controller._compare_files() controller._compare_files()
# view.update_message.assert_called_with("no shadow") view.update_message.assert_called_with("no shadow")
# controller._shadow_files = ["bar"] controller._shadow_files = ["bar"]
# controller._compare_files() controller._compare_files()
# calls = [mock.call("no shadow"), mock.call("files ok"), mock.call("comparison complete")] calls = [mock.call("no shadow"), mock.call("files ok"), mock.call("comparison complete")]
# view.update_message.assert_has_calls(calls) view.update_message.assert_has_calls(calls)
# calls_but = [mock.call("save", "normal"), mock.call("compare", "disabled")] calls_but = [mock.call("save", "normal"), mock.call("compare", "disabled")]
# view.button_status.assert_has_calls(calls_but) view.button_status.assert_has_calls(calls_but)
#
# def test_read_folder_source(self): # def test_read_folder_source(self):
# model, view, controller = self.makeMVC() # model, view, controller = self.makeMVC()
# model.get_multi_data.return_value = {} # model.get_multi_data.return_value = {}
......
...@@ -85,7 +85,10 @@ class Utils: ...@@ -85,7 +85,10 @@ class Utils:
the found id for the file the found id for the file
""" """
match = re.search(r"\d+\.T", path) match = re.search(r"\d+\.T", path)
identifier = match.group() if match:
identifier = match.group()
else:
identifier = "" # match is None when no such path found
return identifier[:-2] return identifier[:-2]
@staticmethod @staticmethod
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment