Author: Ronan Lamy <ronan.l...@gmail.com> Branch: cleanup-test_lib_pypy Changeset: r95382:d2c59938bd7b Date: 2018-11-29 05:57 +0000 http://bitbucket.org/pypy/pypy/changeset/d2c59938bd7b/
Log: Make tests more py3-friendly diff --git a/extra_tests/test_sqlite3.py b/extra_tests/test_sqlite3.py --- a/extra_tests/test_sqlite3.py +++ b/extra_tests/test_sqlite3.py @@ -51,7 +51,7 @@ con = Connection(":memory:") with pytest.raises(_sqlite3.ProgrammingError) as excinfo: con.cursor() - assert '__init__' in excinfo.value.message + assert '__init__' in str(excinfo.value) def test_cursor_check_init(con): @@ -62,7 +62,8 @@ cur = Cursor(con) with pytest.raises(_sqlite3.ProgrammingError) as excinfo: cur.execute('select 1') - assert '__init__' in excinfo.value.message + assert '__init__' in str(excinfo.value) + def test_connection_after_close(con): with pytest.raises(TypeError): @@ -169,16 +170,16 @@ def test_statement_arg_checking(con): with pytest.raises(_sqlite3.Warning) as e: con(123) - assert str(e.value) == 'SQL is of wrong type. Must be string or unicode.' + assert str(e.value).startswith('SQL is of wrong type. Must be string') with pytest.raises(ValueError) as e: con.execute(123) - assert str(e.value) == 'operation parameter must be str or unicode' + assert str(e.value).startswith('operation parameter must be str') with pytest.raises(ValueError) as e: con.executemany(123, 123) - assert str(e.value) == 'operation parameter must be str or unicode' + assert str(e.value).startswith('operation parameter must be str') with pytest.raises(ValueError) as e: con.executescript(123) - assert str(e.value) == 'script argument must be unicode or string.' + assert str(e.value).startswith('script argument must be unicode') def test_statement_param_checking(con): con.execute('create table foo(x)') _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit