Fix comparisons between single elements and tuples of one element

This commit is contained in:
baldurk
2020-02-21 17:23:56 +00:00
parent 81110ceca3
commit db04c797d1
+5
View File
@@ -250,6 +250,11 @@ FLT_EPSILON = 2.0*1.19209290E-07
def value_compare(ref, data, eps=FLT_EPSILON):
# if we're comparing scalar to a 1-length tuple or list, compare against the first element. We only expect this for
# data where it's possibly autogenerated
if (type(data) == list or type(data) == tuple) and len(data) == 1 and type(data[0]) == type(ref):
return value_compare(ref, data[0], eps)
if type(ref) == float or type(data) == float:
# if the types are different this is probably 0.0 == 0 or something. Just compare straight by casting to floats
if type(data) != type(data):