def buffer_inherit():
    import binascii
    # SF bug [#470040] ParseTuple t# vs subclasses.
    if verbose:
        print "Testing that buffer interface is inherited ..."

    class MyStr(str):
        pass
    base = 'abc'
    m = MyStr(base)
    # b2a_hex uses the buffer interface to get its argument's value, via
    # PyArg_ParseTuple 't#' code.
    vereq(binascii.b2a_hex(m), binascii.b2a_hex(base))

    # It's not clear that unicode will continue to support the character
    # buffer interface, and this test will fail if that's taken away.
    class MyUni(unicode):
        pass
    base = u'abc'
    m = MyUni(base)
    vereq(binascii.b2a_hex(m), binascii.b2a_hex(base))

    class MyInt(int):
        pass
    m = MyInt(42)
    try:
        binascii.b2a_hex(m)
        raise TestFailed('subclass of int should not have a buffer interface')
    except __HOLE__:
        pass
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/test/test_descr.py/buffer_inherit