diff options
author | Michael Trier <mtrier@gmail.com> | 2008-05-17 13:06:57 -0400 |
---|---|---|
committer | Michael Trier <mtrier@gmail.com> | 2008-05-17 13:06:57 -0400 |
commit | 062aafa396866d4dfe8f3fd2f32d46fa7c01b6dd (patch) | |
tree | 1b8f14cbee09dfce1a8f224e793bc4e44ab96793 /test/git/test_blob.py | |
parent | ea6af04977c197fd07ab812d394dcb61feebaf67 (diff) | |
download | gitpython-062aafa396866d4dfe8f3fd2f32d46fa7c01b6dd.tar.gz |
Corrected problem with tree.__len__ getting confused with zero length files. Thanks Alan Briolat.
Diffstat (limited to 'test/git/test_blob.py')
-rw-r--r-- | test/git/test_blob.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/git/test_blob.py b/test/git/test_blob.py index 1d84e1d8..ee546ab4 100644 --- a/test/git/test_blob.py +++ b/test/git/test_blob.py @@ -28,9 +28,19 @@ class TestBlob(object): def test_should_return_file_size(self, git): git.return_value = fixture('cat_file_blob_size') blob = Blob(self.repo, **{'id': 'abc'}) - assert_equal(11, len(blob)) + assert_equal(11, blob.size) assert_true(git.called) assert_equal(git.call_args, (('cat_file', 'abc'), {'s': True})) + + @patch(Git, 'method_missing') + def test_should_cache_file_size(self, git): + git.return_value = fixture('cat_file_blob_size') + blob = Blob(self.repo, **{'id': 'abc'}) + assert_equal(11, blob.size) + assert_equal(11, blob.size) + assert_true(git.called) + assert_equal(git.call_count, 1) + assert_equal(git.call_args, (('cat_file', 'abc'), {'s': True})) def test_mime_type_should_return_mime_type_for_known_types(self): blob = Blob(self.repo, **{'id': 'abc', 'name': 'foo.png'}) |