# Path: nimoy/assertions/mocks.py
# class MockAssertions:
#     def assert_mock(self, number_of_invocations, mock, method, *args):
#         if not hasattr(mock, method) and number_of_invocations > 0:
#             raise AssertionError(method + " was never invoked") from None
# 
#         mocked_method = getattr(mock, method)
# 
#         if (number_of_invocations == 0) and (mocked_method.call_count == 0):
#             return
# 
#         if (number_of_invocations >= 0) and (mocked_method.call_count != number_of_invocations):
#             raise AssertionError(
#                 method + " was to be invoked " + str(number_of_invocations) + " times but was invoked " + str(
#                     mocked_method.call_count)) from None
# 
#         for value, expected_value in zip(mocked_method.call_args[0], args):
#             if expected_value not in ('__nimoy_argument_wildcard', value):
#                 raise AssertionError(
#                     method + " expected argument " + str(expected_value) + " but was invoked with " + str(
#                         value)) from None
# 
# Path: nimoy/specification.py
# class Specification(TestCase, metaclass=DataDrivenSpecification):
# 
#     def __init__(self, methodName='runTest'):
#         super().__init__(methodName)
#         self.thrown_exceptions = []
# 
#     def _feature_block_context(self, block_name):
#         return FeatureBlock(block_name, self.thrown_exceptions)
# 
#     def _compare(self, left, right, comparison_type_name):
#         Compare().compare(left, right, comparison_type_name)
# 
#     def _power_assert(self, expression: Dict):
#         PowerAssertions().assert_and_raise(expression)
# 
#     def _assert_mock(self, number_of_invocations, mock, method, *args):
#         MockAssertions().assert_mock(number_of_invocations, mock, method, *args)
# 
#     def _exception_thrown(self, expected_exception_type):
#         return ExceptionAssertions().assert_exception(self.thrown_exceptions, expected_exception_type)


from nimoy.assertions.mocks import MockAssertions
from nimoy.specification import Specification
from unittest import mock


class MockAssertionsSpec(Specification):

    def mock_was_never_called(self):
        with setup:
            the_mock = mock.Mock()
        with when:
            MockAssertions().assert_mock(4, the_mock, 'non_existing')
        with then:
            thrown(AssertionError)

    def mock_was_never_called_and_zero_interactions_expected(self):
        with setup:
            the_mock = mock.Mock()
        with expect:

# Path: nimoy/assertions/mocks.py
# class MockAssertions:
#     def assert_mock(self, number_of_invocations, mock, method, *args):
#         if not hasattr(mock, method) and number_of_invocations > 0:
#             raise AssertionError(method + " was never invoked") from None
# 
#         mocked_method = getattr(mock, method)
# 
#         if (number_of_invocations == 0) and (mocked_method.call_count == 0):
#             return
# 
#         if (number_of_invocations >= 0) and (mocked_method.call_count != number_of_invocations):
#             raise AssertionError(
#                 method + " was to be invoked " + str(number_of_invocations) + " times but was invoked " + str(
#                     mocked_method.call_count)) from None
# 
#         for value, expected_value in zip(mocked_method.call_args[0], args):
#             if expected_value not in ('__nimoy_argument_wildcard', value):
#                 raise AssertionError(
#                     method + " expected argument " + str(expected_value) + " but was invoked with " + str(
#                         value)) from None
# 
# Path: nimoy/specification.py
# class Specification(TestCase, metaclass=DataDrivenSpecification):
# 
#     def __init__(self, methodName='runTest'):
#         super().__init__(methodName)
#         self.thrown_exceptions = []
# 
#     def _feature_block_context(self, block_name):
#         return FeatureBlock(block_name, self.thrown_exceptions)
# 
#     def _compare(self, left, right, comparison_type_name):
#         Compare().compare(left, right, comparison_type_name)
# 
#     def _power_assert(self, expression: Dict):
#         PowerAssertions().assert_and_raise(expression)
# 
#     def _assert_mock(self, number_of_invocations, mock, method, *args):
#         MockAssertions().assert_mock(number_of_invocations, mock, method, *args)
# 
#     def _exception_thrown(self, expected_exception_type):
#         return ExceptionAssertions().assert_exception(self.thrown_exceptions, expected_exception_type)


# Path: specs/nimoy/assertions/mocks_spec.py
from nimoy.assertions.mocks import MockAssertions
from nimoy.specification import Specification
from unittest import mock



class MockAssertionsSpec(Specification):

    def mock_was_never_called(self):
        with setup:
            the_mock = mock.Mock()
        with when:
            MockAssertions().assert_mock(4, the_mock, 'non_existing')
        with then:
            thrown(AssertionError)

    def mock_was_never_called_and_zero_interactions_expected(self):
        with setup:
            the_mock = mock.Mock()
        with expect:

            MockAssertions().assert_mock(0, the_mock, 'not_called')