1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-25 13:23:02 +04:00

Merge branch 4.x

This commit is contained in:
Alexander Alekhin
2022-02-22 19:33:07 +00:00
256 changed files with 10503 additions and 5119 deletions
+27
View File
@@ -1,6 +1,7 @@
#!/usr/bin/env python
from __future__ import print_function
import sys
import ctypes
from functools import partial
from collections import namedtuple
@@ -607,6 +608,32 @@ class Arguments(NewOpenCVTests):
self.assertTrue(isinstance(rr, tuple), msg=type(rrv))
self.assertEqual(len(rr), 3)
def test_nested_function_availability(self):
self.assertTrue(hasattr(cv.utils, "nested"),
msg="Module is not generated for nested namespace")
self.assertTrue(hasattr(cv.utils.nested, "testEchoBooleanFunction"),
msg="Function in nested module is not available")
if sys.version_info[0] < 3:
# Nested submodule is managed only by the global submodules dictionary
# and parent native module
expected_ref_count = 2
else:
# Nested submodule is managed by the global submodules dictionary,
# parent native module and Python part of the submodule
expected_ref_count = 3
# `getrefcount` temporary increases reference counter by 1
actual_ref_count = sys.getrefcount(cv.utils.nested) - 1
self.assertEqual(actual_ref_count, expected_ref_count,
msg="Nested submodule reference counter has wrong value\n"
"Expected: {}. Actual: {}".format(expected_ref_count, actual_ref_count))
for flag in (True, False):
self.assertEqual(flag, cv.utils.nested.testEchoBooleanFunction(flag),
msg="Function in nested module returns wrong result")
class CanUsePurePythonModuleFunction(NewOpenCVTests):
def test_can_get_ocv_version(self):
import sys