summaryrefslogtreecommitdiffstats
path: root/contrib/python/PyHamcrest/py3/hamcrest/core/helpers
diff options
context:
space:
mode:
authorrobot-piglet <[email protected]>2025-09-10 15:34:55 +0300
committerrobot-piglet <[email protected]>2025-09-10 15:52:03 +0300
commitb0091b5ec4e788ed216c0a23786c921307b79b0a (patch)
tree4da0bd43ceae17f84820956bcd3801cdb8c0ebb8 /contrib/python/PyHamcrest/py3/hamcrest/core/helpers
parent3f573d26f7b92eb46dfff503d68a5897c96386ce (diff)
Intermediate changes
commit_hash:6b9536340f4f2533b62d862c22cbfeb121d4fa3f
Diffstat (limited to 'contrib/python/PyHamcrest/py3/hamcrest/core/helpers')
-rw-r--r--contrib/python/PyHamcrest/py3/hamcrest/core/helpers/ismock.py15
-rw-r--r--contrib/python/PyHamcrest/py3/hamcrest/core/helpers/wrap_matcher.py4
2 files changed, 16 insertions, 3 deletions
diff --git a/contrib/python/PyHamcrest/py3/hamcrest/core/helpers/ismock.py b/contrib/python/PyHamcrest/py3/hamcrest/core/helpers/ismock.py
new file mode 100644
index 00000000000..318e0d4f9cb
--- /dev/null
+++ b/contrib/python/PyHamcrest/py3/hamcrest/core/helpers/ismock.py
@@ -0,0 +1,15 @@
+MOCKTYPES = ()
+try:
+ from mock import Mock
+ MOCKTYPES += (Mock,)
+except ImportError:
+ pass
+try:
+ from unittest.mock import Mock
+ MOCKTYPES += (Mock,)
+except ImportError:
+ pass
+
+
+def ismock(obj):
+ return isinstance(obj, MOCKTYPES)
diff --git a/contrib/python/PyHamcrest/py3/hamcrest/core/helpers/wrap_matcher.py b/contrib/python/PyHamcrest/py3/hamcrest/core/helpers/wrap_matcher.py
index a5b506fb395..587ae4c6101 100644
--- a/contrib/python/PyHamcrest/py3/hamcrest/core/helpers/wrap_matcher.py
+++ b/contrib/python/PyHamcrest/py3/hamcrest/core/helpers/wrap_matcher.py
@@ -28,9 +28,7 @@ def is_matchable_type(expected_type):
if isinstance(expected_type, six.class_types):
return True
- if isinstance(expected_type, tuple) and \
- expected_type and \
- all(map(is_matchable_type, expected_type)):
+ if isinstance(expected_type, tuple) and all(map(is_matchable_type, expected_type)):
return True
return False