Had the same issue, renamed my funcion "hex()" to "to_hex" and then it worked. Thanks!
No answer after 2 months, closing.
Maybe you're overwriting a built-in function, and that's why it happens.
I'm getting: Testing random values: 67 ,118 ,-4: '437600' should equal '000000', which can't be correct.