test_cmdhistory: Remove patching for prev/nextitem.
This commit is contained in:
parent
3fac246744
commit
ed9a29fb9a
@ -129,14 +129,9 @@ def test_nextitem_previtem_chain(hist):
|
|||||||
assert hist.nextitem() == 'fourth'
|
assert hist.nextitem() == 'fourth'
|
||||||
|
|
||||||
|
|
||||||
def raise_index_error():
|
|
||||||
raise IndexError()
|
|
||||||
|
|
||||||
|
|
||||||
def test_nextitem_index_error(hist):
|
def test_nextitem_index_error(hist):
|
||||||
""""Test nextitem() when _tmphist raises an IndexError"""
|
""""Test nextitem() when _tmphist raises an IndexError"""
|
||||||
hist.start('f')
|
hist.start('f')
|
||||||
hist._tmphist.nextitem = raise_index_error
|
|
||||||
with pytest.raises(cmdhistory.HistoryEndReachedError):
|
with pytest.raises(cmdhistory.HistoryEndReachedError):
|
||||||
hist.nextitem()
|
hist.nextitem()
|
||||||
|
|
||||||
@ -144,8 +139,8 @@ def test_nextitem_index_error(hist):
|
|||||||
def test_previtem_index_error(hist):
|
def test_previtem_index_error(hist):
|
||||||
""""Test previtem() when _tmphist raises an IndexError"""
|
""""Test previtem() when _tmphist raises an IndexError"""
|
||||||
hist.start('f')
|
hist.start('f')
|
||||||
hist._tmphist.previtem = raise_index_error
|
|
||||||
with pytest.raises(cmdhistory.HistoryEndReachedError):
|
with pytest.raises(cmdhistory.HistoryEndReachedError):
|
||||||
|
for _ in range(10):
|
||||||
hist.previtem()
|
hist.previtem()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user