diff options
author | willmcgugan@gmail.com <willmcgugan@gmail.com@67cdc799-7952-0410-af00-57a81ceafa0f> | 2013-10-18 17:33:00 +0000 |
---|---|---|
committer | willmcgugan@gmail.com <willmcgugan@gmail.com@67cdc799-7952-0410-af00-57a81ceafa0f> | 2013-10-18 17:33:00 +0000 |
commit | 9b4fcbd538179a02874007a6d85b36549e86d3c9 (patch) | |
tree | c353f115264c7cfe0e2f00a3e86652f46b0b68a5 /fs/tests/__init__.py | |
parent | 89628de519ad4858ee969e809f177abebcdf8a3d (diff) | |
download | pyfilesystem-9b4fcbd538179a02874007a6d85b36549e86d3c9.tar.gz |
Tests for getinfokeys
git-svn-id: http://pyfilesystem.googlecode.com/svn/trunk@882 67cdc799-7952-0410-af00-57a81ceafa0f
Diffstat (limited to 'fs/tests/__init__.py')
-rw-r--r-- | fs/tests/__init__.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/fs/tests/__init__.py b/fs/tests/__init__.py index 42f396f..86cb656 100644 --- a/fs/tests/__init__.py +++ b/fs/tests/__init__.py @@ -514,8 +514,23 @@ class FSTestCases(object): self.assertRaises( ResourceNotFoundError, self.fs.getinfo, "info.txt/inval") + def test_infokeys(self): + test_str = b("Hello, World!") + self.fs.setcontents("info.txt", test_str) + info = self.fs.getinfo("info.txt") + for k, v in info.iteritems(): + self.assertEqual(self.fs.getinfokeys('info.txt', k), {k: v}) + + test_info = {} + if 'modified_time' in info: + test_info['modified_time'] = info['modified_time'] + if 'size' in info: + test_info['size'] = info['size'] + self.assertEqual(self.fs.getinfokeys('info.txt', 'size', 'modified_time'), test_info) + self.assertEqual(self.fs.getinfokeys('info.txt', 'thiscantpossiblyexistininfo'), {}) + def test_getsize(self): - test_str = b("*")*23 + test_str = b("*") * 23 self.fs.setcontents("info.txt", test_str) size = self.fs.getsize("info.txt") self.assertEqual(size, len(test_str)) @@ -900,7 +915,7 @@ class FSTestCases(object): def test_zero_read(self): """Test read(0) returns empty string""" - self.fs.setcontents('foo.txt', b('Hello, World') ) + self.fs.setcontents('foo.txt', b('Hello, World')) with self.fs.open('foo.txt', 'rb') as f: self.assert_(len(f.read(0)) == 0) with self.fs.open('foo.txt', 'rt') as f: |