Merge pull request #23969 from asmorkalov:as/python2_test_fix

Fixed tests execution with Python 2.7
This commit is contained in:
Alexander Smorkalov 2023-07-11 20:53:01 +03:00 committed by GitHub
commit 53af876999
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -71,7 +71,7 @@ public:
}
operator bool() {
return static_cast<bool>(obj_);
return obj_ != nullptr;
}
PyObject* release()

View File

@ -223,9 +223,14 @@ class Arguments(NewOpenCVTests):
for dtype in (object, str, np.complex128):
test_array = np.zeros((4, 4, 3), dtype=dtype)
msg = ".*type = {} is not supported".format(test_array.dtype)
self.assertRaisesRegex(
Exception, msg, cv.utils.dumpInputArray, test_array
)
if sys.version_info[0] < 3:
self.assertRaisesRegexp(
Exception, msg, cv.utils.dumpInputArray, test_array
)
else:
self.assertRaisesRegex(
Exception, msg, cv.utils.dumpInputArray, test_array
)
def test_20968(self):
pixel = np.uint8([[[40, 50, 200]]])