From f2125b4c19f465c64c420f1458a57275a73a2c04 Mon Sep 17 00:00:00 2001 From: Olivier Mangin Date: Thu, 11 Sep 2014 18:47:11 +0200 Subject: [PATCH] Tags have to be printed in alphabetical order. --- pubs/commands/tag_cmd.py | 4 ++-- pubs/pretty.py | 2 +- tests/test_usecase.py | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pubs/commands/tag_cmd.py b/pubs/commands/tag_cmd.py index 3f700ee..c5b2ae2 100644 --- a/pubs/commands/tag_cmd.py +++ b/pubs/commands/tag_cmd.py @@ -83,12 +83,12 @@ def command(args): rp = Repository(config()) if citekeyOrTag is None: - ui.print_(color.dye(' '.join(rp.get_tags()), color=color.blue)) + ui.print_(color.dye(' '.join(sorted(rp.get_tags())), color=color.blue)) else: if rp.databroker.exists(citekeyOrTag): p = rp.pull_paper(citekeyOrTag) if tags == []: - ui.print_(color.dye(' '.join(p.tags), + ui.print_(color.dye(' '.join(sorted(p.tags)), color=color.blue)) else: add_tags, remove_tags = _tag_groups(_parse_tags(tags)) diff --git a/pubs/pretty.py b/pubs/pretty.py index bc3a333..bd45872 100644 --- a/pubs/pretty.py +++ b/pubs/pretty.py @@ -56,6 +56,6 @@ def paper_oneliner(p, citekey_only = False): return u'[{citekey}] {descr} {tags}'.format( citekey=color.dye(p.citekey, color.purple), descr=bibdesc, - tags=color.dye(' '.join(p.tags), + tags=color.dye(' '.join(sorted(p.tags)), color.tag, bold=False), ) diff --git a/tests/test_usecase.py b/tests/test_usecase.py index 6964305..3e82b7b 100644 --- a/tests/test_usecase.py +++ b/tests/test_usecase.py @@ -246,13 +246,13 @@ class TestList(DataCommandTestCase): class TestUsecase(DataCommandTestCase): def test_first(self): - correct = [b'Initializing pubs in /paper_first\n', - b'', - b'[Page99] Page, Lawrence et al. "The PageRank Citation Ranking: Bringing Order to the Web." (1999) \n', - b'\n', - b'', - b'search network\n', - b'[Page99] Page, Lawrence et al. "The PageRank Citation Ranking: Bringing Order to the Web." (1999) search network\n' + correct = ['Initializing pubs in /paper_first\n', + '', + '[Page99] Page, Lawrence et al. "The PageRank Citation Ranking: Bringing Order to the Web." (1999) \n', + '\n', + '', + 'network search\n', + '[Page99] Page, Lawrence et al. "The PageRank Citation Ranking: Bringing Order to the Web." (1999) network search\n' ] cmds = ['pubs init -p paper_first/',