From 3fac246744999fb52627a449f95dc4633e0e92ea Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 27 Aug 2015 06:36:40 +0200 Subject: [PATCH] test_cmdhistory: Add test for __getitem__. --- tests/unit/misc/test_cmdhistory.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/unit/misc/test_cmdhistory.py b/tests/unit/misc/test_cmdhistory.py index 5b0e72459..31e1da298 100644 --- a/tests/unit/misc/test_cmdhistory.py +++ b/tests/unit/misc/test_cmdhistory.py @@ -88,6 +88,14 @@ def test_getitem(hist): assert hist[i] == HISTORY[i] +def test_setitem(hist): + """Test __setitem__.""" + with pytest.raises(TypeError) as excinfo: + hist[0] = 'foo' + expected = "'History' object does not support item assignment" + assert str(excinfo.value) == expected + + def test_not_browsing_error(hist): """Test that next/previtem throws a ValueError""" with pytest.raises(ValueError) as error1: @@ -152,7 +160,6 @@ def test_append_private_mode(hist, config_stub): def test_append(hist, config_stub): """Test append outside private mode.""" - # Private mode is disabled (general.private-browsing is set to False) config_stub.data = CONFIG_NOT_PRIVATE hist.append('new item')