def make_icalculator_tests(calculator_factory):
    class ICalculatorTests(TestCase):
        """
        Tests of an ``ICalculator`` implementation.
        """
        def test_interface(self):
            """
            The ``ICalculator`` implemention actually implements the interface.
            """
            verifyObject(ICalculator, calculator_factory())

        @given(
            discovered_datasets=builds(
                dataset_map_from_iterable,
                lists(DISCOVERED_DATASET_STRATEGY),
            ),
            desired_datasets=builds(
                dataset_map_from_iterable,
                lists(DESIRED_DATASET_STRATEGY),
            ),
        )
        def test_returns_changes(self, discovered_datasets, desired_datasets):
            """
            ``ICalculator.calculate_changes_for_datasets`` returns a
            ``IStateChange``.
            """
            calculator = calculator_factory()
            changes = calculator.calculate_changes_for_datasets(
                discovered_datasets=discovered_datasets,
                desired_datasets=desired_datasets)
            self.assertTrue(IStateChange.providedBy(changes))

    return ICalculatorTests
Make a test case to test an ``ICalculator`` implementation.
dataset/ETHPy150Open ClusterHQ/flocker/flocker/node/agents/test/test_blockdevice.py/make_icalculator_tests