diff options
author | Lars Wirzenius <liw@liw.fi> | 2011-02-12 23:44:39 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2011-02-12 23:44:39 +0000 |
commit | e6357e4ee0d95eac3973452723010017eacf04a4 (patch) | |
tree | a0edcbcb3d2fdc67be9e507cb83517b42369e84b /summainlib_tests.py | |
parent | c843b1d069f1d82cf4a8758ffa3a3325fd5a82fd (diff) | |
download | summain-e6357e4ee0d95eac3973452723010017eacf04a4.tar.gz |
Don't report size for directories.
It is meaningless.
Diffstat (limited to 'summainlib_tests.py')
-rw-r--r-- | summainlib_tests.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/summainlib_tests.py b/summainlib_tests.py index 8068b53..313b3a4 100644 --- a/summainlib_tests.py +++ b/summainlib_tests.py @@ -1,4 +1,4 @@ -# Copyright (C) 2010 Lars Wirzenius +# Copyright (C) 2010, 2011 Lars Wirzenius # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -78,7 +78,9 @@ class FilesystemObjectTests(unittest.TestCase): self.nn = summainlib.NumberNormalizer() - def new(self, name): + def new(self, name, mode=None): + if mode is not None: + self.st.st_mode = mode return summainlib.FilesystemObject(name, self.nn, stat_result=self.st, sha1=FakeSha1(), @@ -137,6 +139,11 @@ class FilesystemObjectTests(unittest.TestCase): def test_formats_target_correctly_for_regular_file(self): self.assertEqual(self.new('foo')['Target'], '') + + def test_does_not_output_size_for_directory(self): + fso = self.new('foo', mode=stat.S_IFDIR | 0777) + output = fso.format() + self.assert_('Size:' not in output) class FilesystemObjectNormalizedNumbersTests(unittest.TestCase): |