diff options
author | Lars Wirzenius <liw@liw.fi> | 2010-01-01 02:50:12 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2010-01-01 02:50:12 +0200 |
commit | 637153eef8c8af093caa13fb13a73380a8623bf1 (patch) | |
tree | 0bd8a16a5aa6a0b72280744409334ca02c43aad7 | |
parent | 550106cec6a5f5522517044b3e86997aac1cb33d (diff) | |
download | summain-637153eef8c8af093caa13fb13a73380a8623bf1.tar.gz |
Implement formatting of st_ino. Add unit test for it.
-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 2d75e14..53851fe 100644 --- a/summainlib.py +++ b/summainlib.py @@ -36,6 +36,7 @@ class FilesystemObject(object): self['Name'] = filename self['Mtime'] = self.format_time(stat_result.st_mtime) self['Mode'] = self.format_mode(stat_result.st_mode) + self['Ino'] = '%d' % stat_result.st_ino 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 d05e293..4a816e7 100644 --- a/summainlib_tests.py +++ b/summainlib_tests.py @@ -31,7 +31,8 @@ class FilesystemObjectTests(unittest.TestCase): def setUp(self): self.st = FakeStatResult(st_mtime=1262307723, - st_mode=stat.S_IFREG | 0644) + st_mode=stat.S_IFREG | 0644, + st_ino=12765) def new(self, name): return summainlib.FilesystemObject(name, stat_result=self.st) @@ -49,3 +50,6 @@ class FilesystemObjectTests(unittest.TestCase): def test_formats_mode_for_regular_file_correctly(self): self.assertEqual(self.new('foo')['Mode'], '100644') + def test_formats_inode_number_correctly(self): + self.assertEqual(self.new('foo')['Ino'], '12765') + |