Beispiel #1
0
    def test_get_statement_regexes(self):
        expected_data = {
            'jinja': jinja_expr.JinjaEvaluator.get_statement_regex(),
            'yaql': yaql_expr.YAQLEvaluator.get_statement_regex()
        }

        self.assertDictEqual(expr_base.get_statement_regexes(), expected_data)
class ItemizedSpec(native_v1_specs.Spec):
    _items_regex = (
        # Regular expression in the form "x, y, z, ... in <expression>"
        # or "x in <expression>" with optional space(s) on both end.
        '^(\s+)?({expr})(\s+)?$|^(\s+)?((\w+,\s?|\s+)+)?(\w+)\s+in\s+({expr})(\s+)?$'.format(
            expr='|'.join(expr_base.get_statement_regexes().values())
        )
    )

    _schema = {
        'type': 'object',
        'properties': {
            'items': {
                'type': 'string',
                'minLength': 1,
                'pattern': _items_regex
            },
            'concurrency': spec_types.STRING_OR_POSITIVE_INTEGER
        }
    }

    _context_evaluation_sequence = [
        'items',
        'concurrency'
    ]
Beispiel #3
0
class ItemizedSpec(native_v1_specs.Spec):
    _items_regex = (
        # Regular expression in the form "x, y, z, ... in <expression>"
        # or "x in <expression>" with optional space(s) on both end.
        r"^(\s+)?({expr})(\s+)?$|^(\s+)?((\w+,\s?|\s+)+)?(\w+)\s+in\s+({expr})(\s+)?$"
        .format(expr="|".join(expr_base.get_statement_regexes().values())))

    _schema = {
        "type": "object",
        "properties": {
            "items": {
                "type": "string",
                "minLength": 1,
                "pattern": _items_regex
            },
            "concurrency": spec_types.STRING_OR_POSITIVE_INTEGER,
        },
        "additionalProperties": False,
    }

    _context_evaluation_sequence = ["items", "concurrency"]