Merge pull request #22954 from VadimLevin:dev/vlevin/fix-merge-artifacts-in-python-misc-tests

fix: remove function duplicates in test_misc.py
pull/22966/head
Alexander Smorkalov 2 years ago committed by GitHub
commit 52709c7771
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 38
      modules/python/test/test_misc.py

@ -645,35 +645,14 @@ class Arguments(NewOpenCVTests):
msg="Classes from submodules and global module don't refer " msg="Classes from submodules and global module don't refer "
"to the same type") "to the same type")
def test_inner_class_has_global_alias(self):
self.assertTrue(hasattr(cv.SimpleBlobDetector, "Params"),
msg="Class is not registered as inner class")
self.assertEqual(cv.SimpleBlobDetector.Params, cv.SimpleBlobDetector_Params,
msg="Inner class and class in global module don't refer "
"to the same type")
self.assertTrue(hasattr(cv, "SimpleBlobDetector_Params"),
msg="Inner class doesn't have alias in the global module")
def test_class_from_submodule_has_global_alias(self):
self.assertTrue(hasattr(cv.ml, "Boost"),
msg="Class is not registered in the submodule")
self.assertTrue(hasattr(cv, "ml_Boost"),
msg="Class from submodule doesn't have alias in the "
"global module")
self.assertEqual(cv.ml.Boost, cv.ml_Boost,
msg="Classes from submodules and global module don't refer "
"to the same type")
def test_inner_class_has_global_alias(self): def test_inner_class_has_global_alias(self):
self.assertTrue(hasattr(cv.SimpleBlobDetector, "Params"), self.assertTrue(hasattr(cv.SimpleBlobDetector, "Params"),
msg="Class is not registered as inner class") msg="Class is not registered as inner class")
self.assertTrue(hasattr(cv, "SimpleBlobDetector_Params"), self.assertTrue(hasattr(cv, "SimpleBlobDetector_Params"),
msg="Inner class doesn't have alias in the global module") msg="Inner class doesn't have alias in the global module")
self.assertEqual(cv.SimpleBlobDetector.Params, cv.SimpleBlobDetector_Params, self.assertEqual(cv.SimpleBlobDetector.Params, cv.SimpleBlobDetector_Params,
msg="Inner class and class in global module don't refer " msg="Inner class and class in global module don't refer "
"to the same type") "to the same type")
self.assertTrue(hasattr(cv, "SimpleBlobDetector_Params"),
msg="Inner class doesn't have alias in the global module")
def test_export_class_with_different_name(self): def test_export_class_with_different_name(self):
self.assertTrue(hasattr(cv.utils.nested, "ExportClassName"), self.assertTrue(hasattr(cv.utils.nested, "ExportClassName"),
@ -694,7 +673,8 @@ class Arguments(NewOpenCVTests):
def test_export_inner_class_of_class_exported_with_different_name(self): def test_export_inner_class_of_class_exported_with_different_name(self):
if not hasattr(cv.utils.nested, "ExportClassName"): if not hasattr(cv.utils.nested, "ExportClassName"):
raise unittest.SkipTest("Outer class with export alias is not registered in the submodule") raise unittest.SkipTest(
"Outer class with export alias is not registered in the submodule")
self.assertTrue(hasattr(cv.utils.nested.ExportClassName, "Params"), self.assertTrue(hasattr(cv.utils.nested.ExportClassName, "Params"),
msg="Inner class with export alias is not registered in " msg="Inner class with export alias is not registered in "
@ -712,13 +692,15 @@ class Arguments(NewOpenCVTests):
self.assertEqual( self.assertEqual(
params.int_value, instance.getIntParam(), params.int_value, instance.getIntParam(),
msg="Class initialized with wrong integer parameter. Expected: {}. Actual: {}".format( msg="Class initialized with wrong integer parameter. Expected: {}. Actual: {}".format(
params.int_value, instance.getIntParam() params.int_value, instance.getIntParam()
)) )
)
self.assertEqual( self.assertEqual(
params.float_value, instance.getFloatParam(), params.float_value, instance.getFloatParam(),
msg="Class initialized with wrong integer parameter. Expected: {}. Actual: {}".format( msg="Class initialized with wrong integer parameter. Expected: {}. Actual: {}".format(
params.float_value, instance.getFloatParam() params.float_value, instance.getFloatParam()
)) )
)
class SamplesFindFile(NewOpenCVTests): class SamplesFindFile(NewOpenCVTests):

Loading…
Cancel
Save