Home - Summaries: (main) : (py3.11) : (py3.12) : Everything - Nightly builds - Benchmarks - RPython - Builders - About

test_dbm:test_nonstring

tmpdir = local('/tmp/pytest-of-buildslave/pytest-13/test_nonstring0')

    def test_nonstring(tmpdir):
        path = str(tmpdir.join('test_dbm_extra.test_nonstring'))
        d = dbm.open(path, 'c')
        if isinstance(d, dbm.dumb._Database):
            pytest.skip('Needs adpatation for failure of d[123]')
        with pytest.raises(TypeError):
            d[123] = 'xyz'
        with pytest.raises(TypeError):
            d['xyz'] = 123
        with pytest.raises(TypeError):
            d['xyz'] = None
        with pytest.raises(TypeError):
            del d[123]
        with pytest.raises(TypeError):
            d[123]
        with pytest.raises(TypeError):
            123 in d
        with pytest.raises(AttributeError):
>           d.has_key(123)

../build/extra_tests/test_dbm.py:39: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../build/lib_pypy/_dbm.py:108: in __contains__
    dat = datum(key)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <_dbm.datum object at 0x00007f2c91969670>, text = 123

    def __init__(self, text):
        if isinstance(text, str):
            text = text.encode(sys.getdefaultencoding())
        elif not isinstance(text, bytes):
            msg = "dbm mapping keys must be a string or bytes object, not {!r}"
>           raise TypeError(msg.format(type(text).__name__))
E           TypeError: dbm mapping keys must be a string or bytes object, not 'int'

../build/lib_pypy/_dbm.py:26: TypeError
builder: pypy-c-jit-linux-x86-64 build #11964+
test: test_dbm:test_nonstring