Skip to content

Commit

Permalink
fixing tests for new check to decide if encoding is necessary during …
Browse files Browse the repository at this point in the history
…serialization.
  • Loading branch information
asmodehn committed Aug 11, 2017
1 parent 6869948 commit 047039c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/files/array/string_varlen_ser.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ length = len(data)
buff.write(_struct_I.pack(length))
for val0 in data:
length = len(val0)
if python3 or type(val0) == unicode:
if isinstance(val0, str if python3 else unicode):
val0 = val0.encode('utf-8')
length = len(val0)
buff.write(struct.pack('<I%ss'%length, length, val0))
2 changes: 1 addition & 1 deletion test/test_genpy_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def test_string_serializer_generator():
g = genpy.generator.string_serializer_generator('foo', 'string', 'var_name', True)
val = '\n'.join(g)
assert """length = len(var_name)
if python3 or type(var_name) == unicode:
if isinstance(var_name, str if python3 else unicode):
var_name = var_name.encode('utf-8')
length = len(var_name)
buff.write(struct.pack('<I%ss'%length, length, var_name))""" == val, val
Expand Down

0 comments on commit 047039c

Please sign in to comment.