From a4ff1a45b205171663559b0f7003ecf84face2aa Mon Sep 17 00:00:00 2001 From: kotfu Date: Sun, 10 Mar 2019 21:43:20 -0600 Subject: Allow both history indices to be negative --- tests/test_history.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tests/test_history.py') diff --git a/tests/test_history.py b/tests/test_history.py index 1554df5e..d9918b7a 100644 --- a/tests/test_history.py +++ b/tests/test_history.py @@ -77,11 +77,14 @@ def test_history_class_span(hist): assert hist.span('1..3') == ['first', 'second', 'third'] assert hist.span('1:3') == ['first', 'second', 'third'] + assert hist.span('2:-1') == ['second', 'third'] + assert hist.span('-3:4') == ['second', 'third','fourth'] + assert hist.span('-4:-2') == ['first', 'second'] assert hist.span(':-2') == ['first', 'second'] assert hist.span('..-2') == ['first', 'second'] - value_errors = ['fred', 'fred:joe', 'a..b', '2 ..', '1 : 3', '-2..-3' ] + value_errors = ['fred', 'fred:joe', 'a..b', '2 ..', '1 : 3'] for tryit in value_errors: with pytest.raises(ValueError): hist.span(tryit) -- cgit v1.2.1