aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Jon Bernard <jbernard@tuxion.com> 2015-12-30 06:45:25 -0500
committerGravatar Jon Bernard <jbernard@tuxion.com> 2015-12-30 07:30:06 -0500
commit4a7d81b333740b7944279e192b99d46bf109fbb0 (patch)
treeca9aa0b2e813f30dbc1e321eeb945e43e8bf7fa2
parenta32eb6600300d6351666ba6f1b695c3663338d4b (diff)
downloaddotfiles-4a7d81b333740b7944279e192b99d46bf109fbb0.tar.gz
dotfiles-4a7d81b333740b7944279e192b99d46bf109fbb0.tar.bz2
dotfiles-4a7d81b333740b7944279e192b99d46bf109fbb0.zip
Strip leading newline from list output
-rw-r--r--dotfiles/repository.py2
-rw-r--r--tests/test_repository.py8
2 files changed, 5 insertions, 5 deletions
diff --git a/dotfiles/repository.py b/dotfiles/repository.py
index aa42c65..3f7bd00 100644
--- a/dotfiles/repository.py
+++ b/dotfiles/repository.py
@@ -34,7 +34,7 @@ class Repository:
for dotfile in self.dotfiles:
if all or dotfile.invalid():
listing += '\n{}'.format(dotfile)
- return listing
+ return listing.lstrip()
def __str__(self):
"""Returns a string list the all dotfiles in this repository."""
diff --git a/tests/test_repository.py b/tests/test_repository.py
index 60c4cc4..098704b 100644
--- a/tests/test_repository.py
+++ b/tests/test_repository.py
@@ -14,8 +14,7 @@ def test_list(tmpdir):
# manual discovery
repository.dotfiles = [dotfile, dotfile, dotfile]
- expected_list = ("\n"
- ".vimrc -> Dotfiles/vimrc (unknown)\n"
+ expected_list = (".vimrc -> Dotfiles/vimrc (unknown)\n"
".vimrc -> Dotfiles/vimrc (unknown)\n"
".vimrc -> Dotfiles/vimrc (unknown)")
@@ -27,12 +26,13 @@ def test_discovery(tmpdir):
repo = tmpdir.ensure("Dotfiles", dir=1)
tmpdir.join('.bashrc').mksymlinkto(repo.ensure('bashrc'))
+ tmpdir.join('.inputrc').mksymlinkto(repo.ensure('inputrc'))
tmpdir.join('.vimrc').mksymlinkto(repo.ensure('vimrc'))
repository = Repository(repo, tmpdir)
- expected_list = ("\n"
- ".bashrc -> Dotfiles/bashrc (unknown)\n"
+ expected_list = (".bashrc -> Dotfiles/bashrc (unknown)\n"
+ ".inputrc -> Dotfiles/inputrc (unknown)\n"
".vimrc -> Dotfiles/vimrc (unknown)")
assert expected_list == str(repository)