Skip to content

Commit

Permalink
tests for --add-tag and --tag filtering #30
Browse files Browse the repository at this point in the history
  • Loading branch information
perrette committed Apr 28, 2023
1 parent 444af61 commit 6354ed6
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion tests/test_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,19 @@ def test_list_year(self):
out = self.papers(f'list --year 2011 --strict', sp_cmd='check_output')
self.assertMultiLineEqual(out, self.initial_content)

def test_list_tag(self):
out = self.papers(f'list --tag kiwi', sp_cmd='check_output')
self.assertMultiLineEqual(out, self.initial_content)

out = self.papers(f'list --tag kiwi ocean', sp_cmd='check_output')
self.assertMultiLineEqual(out, self.initial_content)

out = self.papers(f'list --tag kiwi bonobo', sp_cmd='check_output')
self.assertEqual(out, "")

out = self.papers(f'list --tag kiwi bonobo --any', sp_cmd='check_output')
self.assertMultiLineEqual(out, self.initial_content)


def test_list_combined(self):
out = self.papers(f'list --year 2011 --author perrette', sp_cmd='check_output')
Expand Down Expand Up @@ -129,4 +142,16 @@ def test_delete(self):
self.assertEqual(out, "")

out = self.papers(f'list', sp_cmd='check_output')
self.assertEqual(out, "")
self.assertEqual(out, "")


def test_add_tag(self):

out = self.papers(f'list --tag newtag', sp_cmd='check_output')
self.assertEqual(out, "")

self.papers(f'list --author perrette --add-tag newtag -1')
# self.assertEqual(strip_colors(out), "Perrette_2011: Near-ubiquity of ice-edge blooms in the Arctic (doi:10.5194/bg-8-515-2011, files:2, kiwi | ocean | newtag)")

out = self.papers(f'list --tag newtag -1', sp_cmd='check_output')
self.assertEqual(strip_colors(out), "Perrette_2011: Near-ubiquity of ice-edge blooms in the Arctic (doi:10.5194/bg-8-515-2011, files:2, kiwi | ocean | newtag)")

0 comments on commit 6354ed6

Please sign in to comment.