From 98a313305f0d554a179b93695d333199feb5266c Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Wed, 24 Nov 2010 19:36:34 +0100 Subject: RefLog: added entry_at method, which is a faster way of reading single entries, including test --- test/test_reflog.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test') diff --git a/test/test_reflog.py b/test/test_reflog.py index 520be590..5c4a21b8 100644 --- a/test/test_reflog.py +++ b/test/test_reflog.py @@ -79,6 +79,19 @@ class TestRefLog(TestBase): assert entry.newhexsha == 'f'*40 assert entry.message == msg assert RefLog.from_file(tfile)[-1] == entry + + # index entry + # raises on invalid index + self.failUnlessRaises(IndexError, RefLog.entry_at, rlp, 10000) + + # indices can be positive ... + assert isinstance(RefLog.entry_at(rlp, 0), RefLogEntry) + RefLog.entry_at(rlp, 23) + + # ... and negative + for idx in (-1, -24): + RefLog.entry_at(rlp, idx) + #END for each index to read # END for each reflog -- cgit v1.2.1