Пример #1
0
 def marshal_list(node):
     while node != ffi.NULL:
         yield ffi.string(ffi.cast('char*', node.data)).decode()
         node = node.next
Пример #2
0
def test_joinstring(input):
    args = [ffi.new('char[]', x) for x in input]
    args.append(ffi.NULL)

    result = lib.joinstring(*args)
    assert ffi.string(result) == b''.join(input)
Пример #3
0
 def __get__(self, obj, cls):
     attr = getattr(obj._struct, self.field)
     if attr == ffi.NULL:
         return None
     return ffi.string(attr).decode()
Пример #4
0
def test_strstrip(input):
    arg = ffi.new('char[]', input)

    result = lib.strstrip(arg)
    assert ffi.string(result) == input.strip()
Пример #5
0
def test_joinstring(input):
    args = [ffi.new('char[]', x) for x in input]
    args.append(ffi.NULL)

    result = lib.joinstring(*args)
    assert ffi.string(result) == b''.join(input)
Пример #6
0
def test_strstrip(input):
    arg = ffi.new('char[]', input)

    result = lib.strstrip(arg)
    assert ffi.string(result) == input.strip()
Пример #7
0
 def marshal_list(node):
     while node != ffi.NULL:
         yield ffi.string(ffi.cast('char*', node.data)).decode()
         node = node.next
Пример #8
0
 def __get__(self, obj, cls):
     attr = getattr(obj._struct, self.field)
     if attr == ffi.NULL:
         return None
     return ffi.string(attr).decode()