@mark_requirement(Requirements.DATUM_GENERAL_REQ)
def test_require_any_success(self):
    alternatives_executed = set()

    def detect(context):
        nonlocal alternatives_executed
        with context.require_any():
            with context.alternative():
                alternatives_executed.add(1)
                context.fail('bad alternative 1')
            with context.alternative():
                alternatives_executed.add(2)
            with context.alternative():
                alternatives_executed.add(3)
                context.fail('bad alternative 3')
    result = apply_format_detector(self._dataset_root, detect)
    self.assertEqual(result, FormatDetectionConfidence.MEDIUM)
    self.assertEqual(alternatives_executed, {1, 2, 3})
@mark_requirement(Requirements.DATUM_GENERAL_REQ)
def test_require_any_success(self):
    alternatives_executed = set()

    def detect(context):
        nonlocal alternatives_executed
        with context.require_any():
            with context.alternative():
                alternatives_executed.add(1)
                context.fail('bad alternative 1')
            with context.alternative():
                alternatives_executed.add(2)
            with context.alternative():
                alternatives_executed.add(3)
                context.fail('bad alternative 3')
    result = apply_format_detector(self._dataset_root, detect)
    self.assertEqual(result, FormatDetectionConfidence.MEDIUM)
    self.assertEqual(alternatives_executed, {1, 2, 3})