From 062aafa396866d4dfe8f3fd2f32d46fa7c01b6dd Mon Sep 17 00:00:00 2001 From: Michael Trier Date: Sat, 17 May 2008 13:06:57 -0400 Subject: Corrected problem with tree.__len__ getting confused with zero length files. Thanks Alan Briolat. --- test/git/test_blob.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'test/git/test_blob.py') 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'}) -- cgit v1.2.1