Skip to content

Commit

Permalink
Fixed test for python3.
Browse files Browse the repository at this point in the history
  • Loading branch information
eerimoq committed Aug 29, 2016
1 parent 6069a11 commit a8ca4e0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bitstruct.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import re
import struct

__version__ = "3.3.0"
__version__ = "3.3.1"


def _parse_format(fmt):
Expand Down
12 changes: 9 additions & 3 deletions tests/test_bitstruct.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import unittest
import timeit
import sys
from bitstruct import *


Expand Down Expand Up @@ -67,9 +68,14 @@ def test_pack(self):
pack('f32', "foo")
self.fail()
except ValueError as e:
self.assertEqual(
str(e),
'could not convert string to float: foo')
if sys.version_info[0] < 3:
self.assertEqual(
str(e),
'could not convert string to float: foo')
else:
self.assertEqual(
str(e),
"could not convert string to float: 'foo'")

# Cannot convert argument to bytearray.
try:
Expand Down

0 comments on commit a8ca4e0

Please sign in to comment.