From 654245213b3a09c57dc0604669a538f49ffa47db Mon Sep 17 00:00:00 2001 From: Sebastian Grabowski Date: Thu, 7 Mar 2024 11:42:53 +0100 Subject: [PATCH] Fix broken tests after relocating parse_tag_list This annotates the method as `staticmethod`, so it can be used and tested again without requiring an instance of `ModifyTagsDialog`. --- GTG/gtk/browser/modify_tags.py | 3 ++- tests/tools/test_tags.py | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/GTG/gtk/browser/modify_tags.py b/GTG/gtk/browser/modify_tags.py index fbd6e8a1b..f591269f2 100644 --- a/GTG/gtk/browser/modify_tags.py +++ b/GTG/gtk/browser/modify_tags.py @@ -47,7 +47,8 @@ def __init__(self, tag_completion, app): self.last_apply_to_subtasks = False - def parse_tag_list(self, text): + @staticmethod + def parse_tag_list(text): """ Parse a line of a list of tasks. User can specify if the tag is positive or not by prepending '!'. diff --git a/tests/tools/test_tags.py b/tests/tools/test_tags.py index 52bd6f31e..0ef165821 100644 --- a/tests/tools/test_tags.py +++ b/tests/tools/test_tags.py @@ -20,7 +20,7 @@ from unittest import TestCase from GTG.core.tags import extract_tags_from_text - +from GTG.gtk.browser.modify_tags import ModifyTagsDialog class TestExtractTags(TestCase): """ extract_tags_from_text """ @@ -75,8 +75,9 @@ def test_accepts_ampersand_in_tag(self): self.assertTags("@home&work", ["@home&work"]) -@unittest.skip('TODO these need to move now that parse_tag_list is inside' - ' ModifyTagsDialog') +# parse_tag_list was previously a free function +parse_tag_list = ModifyTagsDialog.parse_tag_list + class TestParseTagList(TestCase): """ parse_tag_list """