Compare commits
1 Commits
5ebb9f3295
...
da01a94a1e
| Author | SHA1 | Date | |
|---|---|---|---|
| da01a94a1e |
@ -124,8 +124,6 @@ class TagLine(str):
|
|||||||
filtered based on prefix or contained string.
|
filtered based on prefix or contained string.
|
||||||
"""
|
"""
|
||||||
tagstr = self[len(self.prefix):].strip()
|
tagstr = self[len(self.prefix):].strip()
|
||||||
if tagstr == '':
|
|
||||||
return set() # no tags, only prefix
|
|
||||||
separator = Tag.default_separator
|
separator = Tag.default_separator
|
||||||
# look for alternative separators and use the first one found
|
# look for alternative separators and use the first one found
|
||||||
# -> we don't support different separators in the same TagLine
|
# -> we don't support different separators in the same TagLine
|
||||||
|
|||||||
@ -556,15 +556,6 @@ This is an answer.
|
|||||||
This is a question.
|
This is a question.
|
||||||
{Answer.txt_header}
|
{Answer.txt_header}
|
||||||
This is an answer.
|
This is an answer.
|
||||||
""")
|
|
||||||
self.file_txt_tags_empty = tempfile.NamedTemporaryFile(delete=False, suffix='.txt')
|
|
||||||
self.file_path_txt_tags_empty = pathlib.Path(self.file_txt_tags_empty.name)
|
|
||||||
with open(self.file_path_txt_tags_empty, "w") as fd:
|
|
||||||
fd.write(f"""TAGS:
|
|
||||||
{Question.txt_header}
|
|
||||||
This is a question.
|
|
||||||
{Answer.txt_header}
|
|
||||||
This is an answer.
|
|
||||||
""")
|
""")
|
||||||
self.file_yaml = tempfile.NamedTemporaryFile(delete=False, suffix='.yaml')
|
self.file_yaml = tempfile.NamedTemporaryFile(delete=False, suffix='.yaml')
|
||||||
self.file_path_yaml = pathlib.Path(self.file_yaml.name)
|
self.file_path_yaml = pathlib.Path(self.file_yaml.name)
|
||||||
@ -603,10 +594,6 @@ This is an answer.
|
|||||||
tags = Message.tags_from_file(self.file_path_txt_no_tags)
|
tags = Message.tags_from_file(self.file_path_txt_no_tags)
|
||||||
self.assertSetEqual(tags, set())
|
self.assertSetEqual(tags, set())
|
||||||
|
|
||||||
def test_tags_from_file_txt_tags_empty(self) -> None:
|
|
||||||
tags = Message.tags_from_file(self.file_path_txt_tags_empty)
|
|
||||||
self.assertSetEqual(tags, set())
|
|
||||||
|
|
||||||
def test_tags_from_file_yaml(self) -> None:
|
def test_tags_from_file_yaml(self) -> None:
|
||||||
tags = Message.tags_from_file(self.file_path_yaml)
|
tags = Message.tags_from_file(self.file_path_yaml)
|
||||||
self.assertSetEqual(tags, {Tag('tag1'), Tag('tag2'), Tag('ptag3')})
|
self.assertSetEqual(tags, {Tag('tag1'), Tag('tag2'), Tag('ptag3')})
|
||||||
|
|||||||
@ -44,10 +44,6 @@ class TestTagLine(CmmTestCase):
|
|||||||
tags = tagline.tags()
|
tags = tagline.tags()
|
||||||
self.assertEqual(tags, {Tag('atag1'), Tag('btag2')})
|
self.assertEqual(tags, {Tag('atag1'), Tag('btag2')})
|
||||||
|
|
||||||
def test_tags_empty(self) -> None:
|
|
||||||
tagline = TagLine('TAGS:')
|
|
||||||
self.assertSetEqual(tagline.tags(), set())
|
|
||||||
|
|
||||||
def test_tags_with_newline(self) -> None:
|
def test_tags_with_newline(self) -> None:
|
||||||
tagline = TagLine('TAGS: tag1\n tag2')
|
tagline = TagLine('TAGS: tag1\n tag2')
|
||||||
tags = tagline.tags()
|
tags = tagline.tags()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user