def test_setitem(hist):
 with pytest.raises(TypeError) as excinfo:
  hist[0] = 'foo'
 expected = "'History' object does not support item assignment"
 assert (str(excinfo.value) == expected)

def test_setitem ( hist ) : with pytest . raises ( TypeError ) as excinfo : hist [ 0 ] = 'foo' expected = "'History' object does not support item assignment" assert ( str ( excinfo . value ) == expected )
test __setitem__ .