Skip to content

Commit

Permalink
Adds support for tuple in _FROM_TYPES mapping. (#91)
Browse files Browse the repository at this point in the history
Fixes #85
  • Loading branch information
almann committed Jun 12, 2019
1 parent b5d0122 commit 7651c7a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions amazon/ion/simpleion.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ def dump(obj, fp, imports=None, binary=True, sequence_as_stream=False, skipkeys=
six.binary_type: IonType.BLOB,
SymbolToken: IonType.SYMBOL,
list: IonType.LIST,
tuple: IonType.LIST,
dict: IonType.STRUCT
}),
six.iteritems(
Expand Down
14 changes: 14 additions & 0 deletions tests/test_simpleion.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ def bytes_of(*args, **kwargs):
[[], ],
_Expected(b'\xB0', b'[]')
),
(
[(), ],
_Expected(b'\xB0', b'[]')
),
(
[IonPyList.from_value(IonType.LIST, []), ],
_Expected(b'\xB0', b'[]')
Expand All @@ -74,6 +78,16 @@ def bytes_of(*args, **kwargs):
b'[0]'
)
),
(
[(0,), ],
_Expected(
bytes_of([
0xB0 | 0x01, # Int value 0 fits in 1 byte.
ION_ENCODED_INT_ZERO
]),
b'[0]'
)
),
(
[IonPyList.from_value(IonType.LIST, [0]), ],
_Expected(
Expand Down

0 comments on commit 7651c7a

Please sign in to comment.