diff options
author | Lars Wirzenius <liw@liw.fi> | 2010-01-01 02:54:20 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2010-01-01 02:54:20 +0200 |
commit | 5c8f4e685a147cf7fe33b97c70673928d1485db5 (patch) | |
tree | 822466726b680e13a00e276b219772759f4067c9 | |
parent | 36940fc907cc552e13c6d5d35ae3b23d859840ac (diff) | |
download | summain-5c8f4e685a147cf7fe33b97c70673928d1485db5.tar.gz |
Implement st_nlink formatting. With unit test.
-rw-r--r-- | summainlib.py | 1 | ||||
-rw-r--r-- | summainlib_tests.py | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/summainlib.py b/summainlib.py index f0f61ed..02ad695 100644 --- a/summainlib.py +++ b/summainlib.py @@ -38,6 +38,7 @@ class FilesystemObject(object): self['Mode'] = '%o' % stat_result.st_mode self['Ino'] = '%d' % stat_result.st_ino self['Dev'] = '%d' % stat_result.st_dev + self['Nlink'] = '%d' % stat_result.st_nlink def format_time(self, timestamp): return time.strftime('%Y-%m-%d %H:%M:%S +0000', diff --git a/summainlib_tests.py b/summainlib_tests.py index c3bcf4b..b9849d2 100644 --- a/summainlib_tests.py +++ b/summainlib_tests.py @@ -33,7 +33,8 @@ class FilesystemObjectTests(unittest.TestCase): self.st = FakeStatResult(st_mtime=1262307723, st_mode=stat.S_IFREG | 0644, st_ino=12765, - st_dev=42) + st_dev=42, + st_nlink=2) def new(self, name): return summainlib.FilesystemObject(name, stat_result=self.st) @@ -57,3 +58,6 @@ class FilesystemObjectTests(unittest.TestCase): def test_formats_device_number_correctly(self): self.assertEqual(self.new('foo')['Dev'], '42') + def test_formats_link_count_correctly(self): + self.assertEqual(self.new('foo')['Nlink'], '2') + |