Skip to content

Commit

Permalink
tests: handle float in repr
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Jul 21, 2023
1 parent 568da03 commit 3b958af
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions tests/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,19 @@

def assert_equal_dump_no_whitespace_no_byte(data_a, data_b):
def repl(x):
return x.replace(
" ", "").replace(
"b'", "'").replace(
"\n", "").replace(
"float32", "'>f4'")
for old, new in [
[" ", ""], # ignore whitespaces
["b'", "'"], # ignore bytes vs str
["\n", ""], # ignore newlines
# teat all floats as equal
["float32", "float"],
["float64", "float"],
["'>f4'", "float"],
["'>f8'", "float"],
]:
x = x.replace(old, new)
return x

a = repl(data_a)
b = repl(data_b)
print("DBUG data_a: ", a)
Expand Down

0 comments on commit 3b958af

Please sign in to comment.