From db04c797d14ae51c771712953e5df0e4696a7cec Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 21 Feb 2020 17:23:56 +0000 Subject: [PATCH] Fix comparisons between single elements and tuples of one element --- util/test/rdtest/util.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/util/test/rdtest/util.py b/util/test/rdtest/util.py index 6174e1b18..542b784a8 100644 --- a/util/test/rdtest/util.py +++ b/util/test/rdtest/util.py @@ -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):