Skip to content
This repository has been archived by the owner on Sep 1, 2021. It is now read-only.

TextualAdapter builds incorrect 0 and negative numbers #21

Closed
aarrtteemm opened this issue Mar 19, 2012 · 0 comments
Closed

TextualAdapter builds incorrect 0 and negative numbers #21

aarrtteemm opened this issue Mar 19, 2012 · 0 comments

Comments

@aarrtteemm
Copy link

the next tests fail:

>>> from construct import *

from construct.text import *
TextualIntAdapter(Field("textintadapter", 3)).build(-12)
'12-'
TextualIntAdapter(Field("textintadapter", 1)).build(0)
Traceback (most recent call last):
File "", line 1, in
File "construct/core.py", line 206, in build
self.build_stream(obj, stream)
File "construct/core.py", line 214, in build_stream
self._build(obj, stream, Container())
File "construct/core.py", line 284, in _build
self.subcon._build(self._encode(obj, context), stream, context)
File "construct/core.py", line 324, in _build
_write_stream(stream, self.length, obj)
File "construct/core.py", line 306, in _write_stream
raise FieldError("expected %d, found %d" % (length, len(data)))
construct.core.FieldError: expected 1, found 0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant