diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 24c7e5d..eab7a2a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,15 +12,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/setup-python@v1 + + - uses: astral-sh/setup-uv@v6 with: python-version: ${{ env.DEFAULT_PY_VERSION }} - - name: Linting - env: - RUFF_OUTPUT_FORMAT: github - run: | - pip install ruff - ruff check src + + - run: uv run tox -e lint Tests: needs: Lint @@ -41,48 +38,26 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Install poetry - shell: bash - run: pipx install poetry==${{ env.POETRY_VERSION }} - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + - uses: astral-sh/setup-uv@v6 with: python-version: ${{ matrix.python-version }} - - name: Install Test Runner - run: | - python -m pip install --upgrade pip - pip install tox - - - name: Install Deps - run: | - tox -e ${{ matrix.tox-target }} --notest - - - name: Test - run: | - tox -e ${{ matrix.tox-target }} + - run: uv run tox -e ${{ matrix.tox-target }} Coverage: needs: Tests runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Install poetry - shell: bash - run: pipx install poetry==${{ env.POETRY_VERSION }} - - uses: actions/setup-python@v1 + - uses: astral-sh/setup-uv@v6 with: python-version: ${{ env.DEFAULT_PY_VERSION }} - - name: Install Test Runner - run: | - python -m pip install --upgrade pip - pip install tox + - run: uv run tox -e lint - - name: Upload Code Coverage - uses: codecov/codecov-action@v4 + - uses: codecov/codecov-action@v4 with: files: ./coverage.xml name: codecov diff --git a/Makefile b/Makefile index acad1b9..4259ff3 100644 --- a/Makefile +++ b/Makefile @@ -13,45 +13,107 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and limitations under the License. -# Tools require GO. Typically, the following kinds of setup is required. -# export PATH="/usr/local/go/bin:/usr/local/bin:$PATH" -# export GOPATH="~/go" +HELP_TEXT := "" +HELP_TEXT += "Available commands:\n" +.PHONY: help +help: + @echo $(HELP_TEXT) + +HELP_TEXT += " build runs ``uv build`` to create a distribution kit\n" +.PHONY: build build: uv build -install-tools: - cd tools && docker pull golang && docker build -t mkgherkin . +HELP_TEXT += " build-all alias of build, conformance, and docs\n" +.PHONY: build-all +build-all: + $(MAKE) build + $(MAKE) conformance + $(MAKE) docs -test: - cd features && $(MAKE) all - tox run -e py312 +HELP_TEXT += "\n" -test-all: - cd features && $(MAKE) all - tox run +HELP_TEXT += " test runs the Python 3.12 test environment to execute a quick test\n" +.PHONY: test +test: conformance + uv run tox run -e py312 + +HELP_TEXT += " test-all runs the full test suite\n" +.PHONY: test-all +test-all: conformance + uv run tox run -test-wip: +HELP_TEXT += " test- runs tests for any of the available tox environments:\n" +HELP_TEXT += "\n$$(uv run tox list | awk '{ print " " $$0 }')\n" +.PHONY: test-% +test-%: conformance + uv run tox run -e $* + +HELP_TEXT += "\n" + +HELP_TEXT += " conformance generates conformance tests\n" +.PHONY: conformance +conformance: cd features && $(MAKE) all - tox run -e wip -test-tools: - tox run -e tools - cd features && $(MAKE) scan +HELP_TEXT += " conf-clean cleans generated conformance tests\n" +.PHONY: conf-clean +conf-clean: + cd features && $(MAKE) clean + +HELP_TEXT += "\n" +HELP_TEXT += " docs generates HTML documentation\n" +.PHONY: docs docs: $(wildcard docs/source/*.rst) - PYTHONPATH=src python -m doctest docs/source/*.rst - export PYTHONPATH=$(PWD)/src:$(PWD)/tools && cd docs && $(MAKE) html + $(MAKE) docs-lint + cd docs && $(MAKE) html +HELP_TEXT += " docs-clean lints documentation sources\n" +.PHONY: docs-lint +docs-lint: + uv run python -m doctest docs/source/*.rst + +HELP_TEXT += " docs-clean cleans generated HTML documentation\n" +.PHONY: docs-clean +docs-clean: + cd docs && $(MAKE) clean + +HELP_TEXT += "\n" + +HELP_TEXT += " lint runs code coverage, type hint checking, and other lint checks\n" +HELP_TEXT += " (alias of test-lint)\n" +.PHONY: lint lint: - tox run -e lint + uv run tox run -e lint +HELP_TEXT += "\n" + +HELP_TEXT += " format runs code formatting\n" +.PHONY: format +format: + uv run ruff format src tools + +HELP_TEXT += " coverage generates code coverage reports\n" +.PHONY: coverage coverage: - coverage report -m + uv run tox run -e coverage +HELP_TEXT += " clean cleans all content ignored by git\n" +.PHONY: clean clean: - rm -rf .tox .Python bin include lib pip-selfcheck.json + git clean -Xfd + +HELP_TEXT += " clean-all alias of clean, conformance-clean, and docs-clean\n" +.PHONY: clean-all +clean-all: + $(MAKE) clean + $(MAKE) test-clean + $(MAKE) docs-clean +HELP_TEXT += " benchmarks runs performance benchmarks\n" +.PHONY: benchmarks benchmarks: - PYTHONPATH=src python benches/large_resource_set.py TagAssetBenchmark - PYTHONPATH=src python benches/complex_expression.py + PYTHONPATH=src uv run python benches/large_resource_set.py TagAssetBenchmark + PYTHONPATH=src uv run python benches/complex_expression.py diff --git a/docs/Makefile b/docs/Makefile index f758891..b083640 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -7,10 +7,12 @@ # You can set these variables from the command line, and also # from the environment for the first two. SPHINXOPTS ?= -SPHINXBUILD ?= sphinx-build +SPHINXBUILD ?= uv run sphinx-build SOURCEDIR = source BUILDDIR = build +export GRAPHVIZ_DOT ?= $(shell which dot) + # Put it first so that "make" without argument is like "make help". help: @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) @@ -20,4 +22,6 @@ help: # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile + @which java || (>&2 echo "Building docs requires java" ; exit 1) + @which dot || (>&2 echo "Building docs requires graphviz (specifically, the dot executable)" ; exit 1) @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/build/doctrees/api.doctree b/docs/build/doctrees/api.doctree index ac84847..94f3937 100644 Binary files a/docs/build/doctrees/api.doctree and b/docs/build/doctrees/api.doctree differ diff --git a/docs/build/doctrees/c7n_functions.doctree b/docs/build/doctrees/c7n_functions.doctree index d159268..7e828d6 100644 Binary files a/docs/build/doctrees/c7n_functions.doctree and b/docs/build/doctrees/c7n_functions.doctree differ diff --git a/docs/build/doctrees/cli.doctree b/docs/build/doctrees/cli.doctree index 7892a28..2f6e8d7 100644 Binary files a/docs/build/doctrees/cli.doctree and b/docs/build/doctrees/cli.doctree differ diff --git a/docs/build/doctrees/configuration.doctree b/docs/build/doctrees/configuration.doctree index a82ec52..4a0eaa9 100644 Binary files a/docs/build/doctrees/configuration.doctree and b/docs/build/doctrees/configuration.doctree differ diff --git a/docs/build/doctrees/environment.pickle b/docs/build/doctrees/environment.pickle index 20ea892..021742e 100644 Binary files a/docs/build/doctrees/environment.pickle and b/docs/build/doctrees/environment.pickle differ diff --git a/docs/build/doctrees/index.doctree b/docs/build/doctrees/index.doctree index 0e317f3..d4f5399 100644 Binary files a/docs/build/doctrees/index.doctree and b/docs/build/doctrees/index.doctree differ diff --git a/docs/build/doctrees/installation.doctree b/docs/build/doctrees/installation.doctree index dd68c27..8e75c36 100644 Binary files a/docs/build/doctrees/installation.doctree and b/docs/build/doctrees/installation.doctree differ diff --git a/docs/build/doctrees/integration.doctree b/docs/build/doctrees/integration.doctree index 93116f9..44b2975 100644 Binary files a/docs/build/doctrees/integration.doctree and b/docs/build/doctrees/integration.doctree differ diff --git a/docs/build/doctrees/structure.doctree b/docs/build/doctrees/structure.doctree index 1ed155a..ca135e8 100644 Binary files a/docs/build/doctrees/structure.doctree and b/docs/build/doctrees/structure.doctree differ diff --git a/docs/build/html/.buildinfo b/docs/build/html/.buildinfo index 88859b4..92d04fb 100644 --- a/docs/build/html/.buildinfo +++ b/docs/build/html/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file records the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 3f3e9d6f3a661b200fa79b5036f419ce +config: da3100d0b8694a80ddf5225b78156ac2 tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/build/html/.buildinfo.bak b/docs/build/html/.buildinfo.bak deleted file mode 100644 index 1791560..0000000 --- a/docs/build/html/.buildinfo.bak +++ /dev/null @@ -1,4 +0,0 @@ -# Sphinx build info version 1 -# This file records the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 4e2cb0e805ddcba79237f83ebf4c7647 -tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/build/html/_images/plantuml-01f21512c6b94e19efccb4676b518bed63780ddd.png b/docs/build/html/_images/plantuml-01f21512c6b94e19efccb4676b518bed63780ddd.png index 080aa3a..aae22cc 100644 Binary files a/docs/build/html/_images/plantuml-01f21512c6b94e19efccb4676b518bed63780ddd.png and b/docs/build/html/_images/plantuml-01f21512c6b94e19efccb4676b518bed63780ddd.png differ diff --git a/docs/build/html/_images/plantuml-165a23eb11f806bdd308ffac47a78125152ade58.png b/docs/build/html/_images/plantuml-165a23eb11f806bdd308ffac47a78125152ade58.png index b02b306..358a2a1 100644 Binary files a/docs/build/html/_images/plantuml-165a23eb11f806bdd308ffac47a78125152ade58.png and b/docs/build/html/_images/plantuml-165a23eb11f806bdd308ffac47a78125152ade58.png differ diff --git a/docs/build/html/_images/plantuml-36fad8472301586150ff18c26187340f47bb62fa.png b/docs/build/html/_images/plantuml-36fad8472301586150ff18c26187340f47bb62fa.png index 1d2ec51..26cc6c5 100644 Binary files a/docs/build/html/_images/plantuml-36fad8472301586150ff18c26187340f47bb62fa.png and b/docs/build/html/_images/plantuml-36fad8472301586150ff18c26187340f47bb62fa.png differ diff --git a/docs/build/html/_images/plantuml-59894b154086c2a2ebe8ae46d280279ecce7cf8f.png b/docs/build/html/_images/plantuml-59894b154086c2a2ebe8ae46d280279ecce7cf8f.png deleted file mode 100644 index 16f9a9c..0000000 Binary files a/docs/build/html/_images/plantuml-59894b154086c2a2ebe8ae46d280279ecce7cf8f.png and /dev/null differ diff --git a/docs/build/html/_images/plantuml-60c95188891b5d1267db67bb61a17e9fd7c08060.png b/docs/build/html/_images/plantuml-60c95188891b5d1267db67bb61a17e9fd7c08060.png index cb501f6..864e2d8 100644 Binary files a/docs/build/html/_images/plantuml-60c95188891b5d1267db67bb61a17e9fd7c08060.png and b/docs/build/html/_images/plantuml-60c95188891b5d1267db67bb61a17e9fd7c08060.png differ diff --git a/docs/build/html/_images/plantuml-a8a77cea7a1f2555dbb1cb6cea10dc21777c76bf.png b/docs/build/html/_images/plantuml-a8a77cea7a1f2555dbb1cb6cea10dc21777c76bf.png deleted file mode 100644 index 96c3652..0000000 Binary files a/docs/build/html/_images/plantuml-a8a77cea7a1f2555dbb1cb6cea10dc21777c76bf.png and /dev/null differ diff --git a/docs/build/html/_images/plantuml-ac649ac296fc6bea0cee4f6cb2d92533640e6763.png b/docs/build/html/_images/plantuml-ac649ac296fc6bea0cee4f6cb2d92533640e6763.png index 391d74a..54ec932 100644 Binary files a/docs/build/html/_images/plantuml-ac649ac296fc6bea0cee4f6cb2d92533640e6763.png and b/docs/build/html/_images/plantuml-ac649ac296fc6bea0cee4f6cb2d92533640e6763.png differ diff --git a/docs/build/html/_images/plantuml-c970d97dc7e0a41eb7666fff5d466440fc8d67cf.png b/docs/build/html/_images/plantuml-c970d97dc7e0a41eb7666fff5d466440fc8d67cf.png index 75c2ffd..daecd76 100644 Binary files a/docs/build/html/_images/plantuml-c970d97dc7e0a41eb7666fff5d466440fc8d67cf.png and b/docs/build/html/_images/plantuml-c970d97dc7e0a41eb7666fff5d466440fc8d67cf.png differ diff --git a/docs/build/html/_modules/celpy/__init__.html b/docs/build/html/_modules/celpy/__init__.html index 6a41db2..3fa2a5c 100644 --- a/docs/build/html/_modules/celpy/__init__.html +++ b/docs/build/html/_modules/celpy/__init__.html @@ -6,7 +6,7 @@ celpy.__init__ — CEL in Python documentation - + @@ -497,7 +497,7 @@

Related Topics

©2020, CapitalOne. | - Powered by Sphinx 8.2.3 + Powered by Sphinx 8.1.3 & Alabaster 1.0.0 diff --git a/docs/build/html/_modules/celpy/__main__.html b/docs/build/html/_modules/celpy/__main__.html index ac2fbb6..e061234 100644 --- a/docs/build/html/_modules/celpy/__main__.html +++ b/docs/build/html/_modules/celpy/__main__.html @@ -6,7 +6,7 @@ celpy.__main__ — CEL in Python documentation - + @@ -68,9 +68,9 @@

Source code for celpy.__main__

 from typing import Any, Callable, Dict, List, Optional, Tuple, Union, cast
 
 try:
-    import tomllib
+    import tomllib  # type: ignore [import-not-found, unused-ignore]
 except ImportError:  # pragma: no cover
-    import tomli as tomllib  # type: ignore [no-redef]
+    import tomli as tomllib  # type: ignore [no-redef, import-not-found, unused-import, unused-ignore]
 
 from celpy import Environment, Runner, celtypes
 from celpy.adapter import CELJSONDecoder, CELJSONEncoder
@@ -328,13 +328,15 @@ 

Source code for celpy.__main__

         try:
             extra = {
                 "st_birthtime": celtypes.TimestampType(
-                    datetime.datetime.fromtimestamp(status.st_birthtime)
+                    datetime.datetime.fromtimestamp(
+                        status.st_birthtime  # type:ignore [attr-defined, unused-ignore]
+                    )
                 ),
                 "st_blksize": celtypes.IntType(status.st_blksize),
                 "st_blocks": celtypes.IntType(status.st_blocks),
-                "st_flags": celtypes.IntType(status.st_flags),
+                "st_flags": celtypes.IntType(status.st_flags),  # type: ignore [attr-defined, unused-ignore]
                 "st_rdev": celtypes.IntType(status.st_rdev),
-                "st_gen": celtypes.IntType(status.st_gen),
+                "st_gen": celtypes.IntType(status.st_gen),  # type: ignore [attr-defined, unused-ignore]
             }
         except AttributeError:  # pragma: no cover
             extra = {}
@@ -680,7 +682,7 @@ 

Related Topics

©2020, CapitalOne. | - Powered by Sphinx 8.2.3 + Powered by Sphinx 8.1.3 & Alabaster 1.0.0
diff --git a/docs/build/html/_modules/celpy/adapter.html b/docs/build/html/_modules/celpy/adapter.html index 4a1339c..561d5bd 100644 --- a/docs/build/html/_modules/celpy/adapter.html +++ b/docs/build/html/_modules/celpy/adapter.html @@ -6,7 +6,7 @@ celpy.adapter — CEL in Python documentation - + @@ -279,7 +279,7 @@

Related Topics

©2020, CapitalOne. | - Powered by Sphinx 8.2.3 + Powered by Sphinx 8.1.3 & Alabaster 1.0.0
diff --git a/docs/build/html/_modules/celpy/c7nlib.html b/docs/build/html/_modules/celpy/c7nlib.html index 56ba3c8..5d76fe6 100644 --- a/docs/build/html/_modules/celpy/c7nlib.html +++ b/docs/build/html/_modules/celpy/c7nlib.html @@ -6,7 +6,7 @@ celpy.c7nlib — CEL in Python documentation - + @@ -1977,7 +1977,7 @@

Related Topics

©2020, CapitalOne. | - Powered by Sphinx 8.2.3 + Powered by Sphinx 8.1.3 & Alabaster 1.0.0 diff --git a/docs/build/html/_modules/celpy/celparser.html b/docs/build/html/_modules/celpy/celparser.html index f7916a6..8f06c72 100644 --- a/docs/build/html/_modules/celpy/celparser.html +++ b/docs/build/html/_modules/celpy/celparser.html @@ -6,7 +6,7 @@ celpy.celparser — CEL in Python documentation - + @@ -647,7 +647,7 @@

Related Topics

©2020, CapitalOne. | - Powered by Sphinx 8.2.3 + Powered by Sphinx 8.1.3 & Alabaster 1.0.0 diff --git a/docs/build/html/_modules/celpy/celtypes.html b/docs/build/html/_modules/celpy/celtypes.html index fcb5ac9..e69aff0 100644 --- a/docs/build/html/_modules/celpy/celtypes.html +++ b/docs/build/html/_modules/celpy/celtypes.html @@ -6,7 +6,7 @@ celpy.celtypes — CEL in Python documentation - + @@ -514,6 +514,12 @@

Source code for celpy.celtypes

 [docs]
     def __repr__(self) -> str:
         return f"{self.__class__.__name__}({super().__repr__()})"
+ + +
+[docs] + def contains(self, item: Value) -> BoolType: + return BoolType(cast(BytesType, item) in self) # type: ignore [comparison-overlap]
@@ -1106,7 +1112,7 @@

Source code for celpy.celtypes

         result_value = len(self) == len(other) and reduce(
             logical_and,  # type: ignore [arg-type]
             (equal(item_s, item_o) for item_s, item_o in zip(self, other)),
-            BoolType(True),  # type: ignore [arg-type]
+            BoolType(True),
         )
         if isinstance(result_value, TypeError):
             raise result_value
@@ -1128,7 +1134,7 @@ 

Source code for celpy.celtypes

         result_value = len(self) != len(other) or reduce(
             logical_or,  # type: ignore [arg-type]
             (not_equal(item_s, item_o) for item_s, item_o in zip(self, other)),
-            BoolType(False),  # type: ignore [arg-type]
+            BoolType(False),
         )
         if isinstance(result_value, TypeError):
             raise result_value
@@ -1216,7 +1222,7 @@ 

Source code for celpy.celtypes

         result_value = keys_s == keys_o and reduce(
             logical_and,  # type: ignore [arg-type]
             (equal(self[k], other[k]) for k in keys_s),
-            BoolType(True),  # type: ignore [arg-type]
+            BoolType(True),
         )
         if isinstance(result_value, TypeError):
             raise result_value
@@ -1247,7 +1253,7 @@ 

Source code for celpy.celtypes

         result_value = keys_s != keys_o or reduce(
             logical_or,  # type: ignore [arg-type]
             (not_equal(self[k], other[k]) for k in keys_s),
-            BoolType(False),  # type: ignore [arg-type]
+            BoolType(False),
         )
         if isinstance(result_value, TypeError):
             raise result_value
@@ -1974,7 +1980,7 @@ 

Related Topics

©2020, CapitalOne. | - Powered by Sphinx 8.2.3 + Powered by Sphinx 8.1.3 & Alabaster 1.0.0
diff --git a/docs/build/html/_modules/celpy/evaluation.html b/docs/build/html/_modules/celpy/evaluation.html index 72b7208..5174cbc 100644 --- a/docs/build/html/_modules/celpy/evaluation.html +++ b/docs/build/html/_modules/celpy/evaluation.html @@ -6,7 +6,7 @@ celpy.evaluation — CEL in Python documentation - + @@ -88,9 +88,9 @@

Source code for celpy.evaluation

 import operator
 import os
 import re
-from string import Template
 import sys
 from functools import reduce, wraps
+from string import Template
 from textwrap import dedent
 from typing import (
     Any,
@@ -113,40 +113,11 @@ 

Source code for celpy.evaluation

 
 import lark
 import lark.visitors
+import re2
 
 import celpy.celtypes
 from celpy.celparser import tree_dump
 
-try:
-    import re2
-
-    def function_matches(text: str, pattern: str) -> "Result":
-        """Implementation of the ``match()`` function using ``re2``"""
-        try:
-            m = re2.search(pattern, text)
-        except re2.error as ex:
-            return CELEvalError("match error", ex.__class__, ex.args)
-
-        return celpy.celtypes.BoolType(m is not None)
-
-except ImportError:  # pragma: no cover
-    # There is a build issue with python_version=='3.13' and sys_platform=='darwin'
-    # See https://github.com/google/re2/issues/516
-    # We fall back to using re, which passes the essential tests
-
-
-[docs] - def function_matches(text: str, pattern: str) -> "Result": - """Alternative implementation of the ``match()`` function for systems where ``re2`` can't be installed.""" - try: - m = re.search(pattern, text) - except re.error as ex: - return CELEvalError("match error", ex.__class__, ex.args) - - return celpy.celtypes.BoolType(m is not None)
- - - # An Annotation describes a union of types, functions, and function types. Annotation = Union[ celpy.celtypes.TypeType, @@ -552,6 +523,19 @@

Source code for celpy.evaluation

 
 
 
+
+[docs] +def function_matches(text: str, pattern: str) -> Result: + """Implementation of the ``match()`` function using ``re2``""" + try: + m = re2.search(pattern, text) + except re2.error as ex: + return CELEvalError("match error", ex.__class__, ex.args) + + return celpy.celtypes.BoolType(m is not None)
+ + +
[docs] def function_getDate( @@ -4423,7 +4407,7 @@

Related Topics

©2020, CapitalOne. | - Powered by Sphinx 8.2.3 + Powered by Sphinx 8.1.3 & Alabaster 1.0.0
diff --git a/docs/build/html/_modules/gherkinize.html b/docs/build/html/_modules/gherkinize.html new file mode 100644 index 0000000..f7efe99 --- /dev/null +++ b/docs/build/html/_modules/gherkinize.html @@ -0,0 +1,1259 @@ + + + + + + + gherkinize — CEL in Python documentation + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+ +

Source code for gherkinize

+# SPDX-Copyright: Copyright (c) Capital One Services, LLC
+# SPDX-License-Identifier: Apache-2.0
+# Copyright 2025 The Cloud Custodian Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and limitations under the License.
+
+"""
+The ``gherkinize.py`` tool converts a ``.textproto`` test case collection into a Gherkin ``.feature`` file.
+This can be used to update the conformance tests in the ``features`` directory.
+
+Synopsis
+--------
+
+..  program:: python tools/gherkinize.py [-o output] [-sv] source
+
+..  option:: -o <output>, --output <output>
+
+    Where to write the feature file.
+    Generally, it's helpful to have the ``.textproto`` and ``.feature`` stems match.
+    The ``Makefile`` assures this.
+
+..  option:: -s, --silent
+
+    No console output is produced
+
+..  option:: -v, --verbose
+
+    Verbose debugging output on the console.
+
+..  option:: source
+
+    A source  ``.textproto`` file.
+    This is often the path to a file in a local download of https://github.com/google/cel-spec/tree/master/tests/simple/testdata.
+
+    A URL for the source is **not** supported.
+
+
+Description
+-----------
+
+Convert one ``.textproto`` file to a Gherkin ``.feature`` file.
+
+Files
+-----
+
+:source:
+    A ``.textproto`` test case file from the ``cel-spec`` repository.
+
+:output:
+    A ``.feature`` file with the same stem as the source file is written to the output directory.
+    ``basic.textproto`` will create ``basic.feature``.
+
+Examples
+--------
+
+The ``basic.textproto`` starts like this:
+
+..  code-block:: protobuf
+
+    name: "basic"
+    description: "Basic conformance tests that all implementations should pass."
+    section {
+      name: "self_eval_zeroish"
+      description: "Simple self-evaluating forms to zero-ish values."
+      test {
+        name: "self_eval_int_zero"
+        expr: "0"
+        value: { int64_value: 0 }
+      }
+      test {
+        name: "self_eval_uint_zero"
+        expr: "0u"
+        value: { uint64_value: 0 }
+      }
+
+The ``basic.feature`` file created looks like this:
+
+..  code-block:: gherkin
+
+    @conformance
+    Feature: basic
+            Basic conformance tests that all implementations should pass.
+
+
+    # self_eval_zeroish -- Simple self-evaluating forms to zero-ish values.
+
+    Scenario: self_eval_zeroish/self_eval_int_zero
+
+        When CEL expression '0' is evaluated
+        Then value is celpy.celtypes.IntType(source=0)
+
+    Scenario: self_eval_zeroish/self_eval_uint_zero
+
+        When CEL expression '0u' is evaluated
+        Then value is celpy.celtypes.UintType(source=0)
+
+The source ``.textproto`` files have a "section" heading which doesn't have a precise parallel in the Gherkin language.
+The sections become comments in the ``.feature`` file, and the section name is used to prefix each feature name.
+
+"""
+
+import argparse
+from datetime import datetime, timedelta, timezone
+from io import open
+import logging
+from os import path
+from pathlib import Path
+import sys
+from typing import Any, Literal, Optional, Union, overload
+from typing_extensions import Self
+from jinja2 import Environment, FileSystemLoader
+import toml
+
+# Note that the `noqa: F401` annotations are because these imports are needed so
+# that the descriptors end up in the default descriptor pool, but aren't used
+# explicitly and thus would be otherwise flagged as unused imports.
+from cel.expr import checked_pb2, eval_pb2, value_pb2
+from cel.expr.conformance.test import simple_pb2
+from cel.expr.conformance.proto2 import (
+    test_all_types_pb2 as proto2_test_all_types,  # noqa: F401
+    test_all_types_extensions_pb2 as proto2_test_all_types_extensions,  # noqa: F401
+)
+from cel.expr.conformance.proto3 import test_all_types_pb2 as proto3_test_all_types  # noqa: F401
+from google.protobuf import (
+    any_pb2,
+    descriptor_pool,
+    descriptor,  # noqa: F401
+    duration_pb2,
+    message_factory,
+    message,
+    struct_pb2,
+    symbol_database,  # noqa: F401
+    text_format,
+    timestamp_pb2,
+    wrappers_pb2,
+)
+
+env = Environment(
+    loader=FileSystemLoader(path.dirname(__file__)),
+    trim_blocks=True,
+)
+template = env.get_template("gherkin.feature.jinja")
+logger = logging.getLogger("gherkinize")
+pool = descriptor_pool.Default()  # type: ignore [no-untyped-call]
+
+
+[docs] +class Config: + """ + This class reads in optional configuration for conformance tests. Each scenario + is within a feature and a section. + + .. csv-table:: + :header: , feature, section, scenario + + **example**, string_ext, ascii_casing, lowerascii_unicode + + The value for each scenario can be a string tag (which must begin with + ``@``), an array of tags (each of which must begin with ``@``) or a dictionary + with a ``tags`` key containing an array of tags (each of which... y'know). + + For example, each of the following are valid: + + :: + + [bindings_ext.bind] + bind_nested = "@wip" + boolean_literal = [ "@wip" ] + + [bindings_ext.bind.macro_exists] + tags = [ "@wip" ] + + In the future, dictionaries with additional features may be supported. + """ + + # We tolerate some variation in the structure of the configuration for each + # scenario, but we need to canonicalize it as we load it. + _ScenarioInput = Union[str, list[str], dict[Literal["tags"], list[str]]] + _SectionInput = dict[str, "Config._ScenarioInput"] + _FeatureInput = dict[str, "Config._SectionInput"] + + # These are the canonical forms + _Scenario = dict[Literal["tags"], list[str]] + _Section = dict[str, "Config._Scenario"] + _Feature = dict[str, "Config._Section"] + +
+[docs] + def __init__(self, path: str) -> None: + logger.debug(f"Reading from {repr(path)}...") + input = toml.load(path) + + if not isinstance(input, dict): + logger.error(f"Could not read from {repr(path)}") + return None + + features = [(k, Config._load_feature(k, v)) for k, v in input.items()] + self.features: dict[str, "Config._Feature"] = { + k: v for k, v in features if v is not None + }
+ + + @staticmethod + def _load_feature( + context: str, input: "Config._FeatureInput" + ) -> "Config._Feature | None": + if not isinstance(input, dict): + logger.error(f"[{context}]: Skipping invalid feature: {repr(input)}") + return None + + sections = [ + (k, Config._load_section(f"{context}.{k}", v)) for k, v in input.items() + ] + return {k: v for k, v in sections if v is not None} + + @staticmethod + def _load_section( + context: str, input: "Config._SectionInput" + ) -> "Config._Section | None": + if not isinstance(input, dict): + logger.error(f"[{context}]: Skipping invalid section: {repr(input)}") + return None + + scenarios = [ + (k, Config._load_scenario(f"{context}.{k}", v)) for k, v in input.items() + ] + return {k: v for k, v in scenarios if v is not None} + + @staticmethod + def _load_scenario( + context: str, input: "Config._ScenarioInput" + ) -> "Config._Scenario | None": + tags = None + if isinstance(input, str): + tag = Config._load_tag(context, input) + tags = [tag] if tag is not None else [] + elif isinstance(input, list): + tags = Config._load_tag_list(context, input) + elif "tags" in input: + tags = Config._load_tag_list(f"{context}.tags", input["tags"]) + + if tags is None: + logger.error(f"[{context}]: Skipping invalid scenario: {repr(input)}") + return None + + return {"tags": tags} + + @staticmethod + def _load_tag_list(context: str, input: Any) -> Union[list[str], None]: + if not isinstance(input, list): + logger.error( + f"[{context}]: Skipping invalid tags (must be a list): {repr(input)}" + ) + return None + + tags_and_nones = [ + Config._load_tag(f"{context}.{i}", v) for i, v in enumerate(input) + ] + return [t for t in tags_and_nones if t is not None] + + @staticmethod + def _load_tag(context: str, input: Any) -> Union[str, None]: + if not isinstance(input, str): + logger.error( + f"[{context}]: Skipping invalid tag (must be a string): {repr(input)}" + ) + return None + if not input.startswith("@"): + logger.error( + f'[{context}]: Skipping invalid tag (must start with "@"): {repr(input)}' + ) + logger.error(f"[{context}]: Did you mean {repr('@' + input)}?") + return None + + return input + +
+[docs] + def tags_for(self, feature: str, section: str, scenario: str) -> list[str]: + """ + Get a list of tags for a given scenario. + """ + if ( + feature in self.features + and section in self.features[feature] + and scenario in self.features[feature][section] + ): + return self.features[feature][section][scenario]["tags"] + + return []
+
+ + + +class Result: + def __init__( + self, + kind: Union[Literal["value"], Literal["eval_error"], Literal["none"]] = "none", + value: "Optional[Union[CELValue, CELErrorSet]]" = None, + ) -> None: + self.kind = kind + self.value = value + + def __eq__(self, other: Any) -> bool: + return isinstance(other, Result) and (self.kind, self.value) == ( + other.kind, + other.value, + ) + + def __repr__(self) -> str: + if isinstance(self.value, CELErrorSet): + # TODO: Investigate if we should switch to a + # data structure in the step implementation + return repr(str(self.value)) + else: + return repr(self.value) + + @staticmethod + def from_proto(source: simple_pb2.SimpleTest) -> "Result": + kind = source.WhichOneof("result_matcher") + + if kind == "value": + return Result(kind, CELValue.from_proto(source.value)) + elif kind == "eval_error": + return Result(kind, CELErrorSet(source.eval_error)) + elif kind is None: + return Result("none", None) + else: + raise NotImplementedError(f"Unable to interpret result kind {kind!r}") + + @staticmethod + def from_text_proto_str(text_proto: str) -> "Result": + test = simple_pb2.SimpleTest() + text_format.Parse(text_proto, test) + return Result.from_proto(test) + + +class CELValue: + type_name = "celpy.celtypes.CELType" + + def __init__(self, source: Optional[message.Message]) -> None: + self.source = source + + @staticmethod + def is_aliased(_: str) -> bool: + return False + + @overload + @staticmethod + def get_class_by_alias( + alias: str, + base: Optional[type["CELValue"]] = None, + error_on_none: Literal[True] = True, + ) -> type["CELValue"]: ... + + @overload + @staticmethod + def get_class_by_alias( + alias: str, + base: Optional[type["CELValue"]] = None, + error_on_none: Literal[False] = False, + ) -> Optional[type["CELValue"]]: ... + + @staticmethod + def get_class_by_alias( + alias: str, base: Optional[type["CELValue"]] = None, error_on_none: bool = True + ) -> Optional[type["CELValue"]]: + base_class = base if base else CELValue + + if base_class.is_aliased(alias): + return base_class + + children = base_class.__subclasses__() + for child in children: + match = CELValue.get_class_by_alias(alias, child, False) + if match is not None: + return match + + if error_on_none: + raise Exception(f"Unable to locate CEL value class for alias {alias!r}") + else: + return None + + @staticmethod + def from_proto(source: message.Message) -> "CELValue": + if source.DESCRIPTOR in [ + struct_pb2.Value.DESCRIPTOR, + value_pb2.Value.DESCRIPTOR, + ]: + value_kind = source.WhichOneof("kind") + if value_kind == "object_value": + return CELValue.from_any(getattr(source, value_kind)) + else: + return CELValue.get_class_by_alias(value_kind)( + getattr(source, value_kind) + ) + + if isinstance(source, any_pb2.Any): + return CELValue.from_any(source) + + aliased = CELValue.get_class_by_alias(source.DESCRIPTOR.full_name, None, False) + if aliased is not None: + return aliased(source) + + logger.error(source) + return CELMessage(source) + + @staticmethod + def from_any(source: any_pb2.Any) -> "CELValue": + type_name = source.type_url.split("/")[-1] + desc = pool.FindMessageTypeByName(type_name) + message_value = message_factory.GetMessageClass(desc)() + source.Unpack(message_value) + return CELValue.from_proto(message_value) + + @staticmethod + def from_text_proto_str(text_proto: str) -> "CELValue": + value = value_pb2.Value() + text_format.Parse(text_proto, value) + return CELValue.from_proto(value) + + +class CELType(CELValue): + type_name = "celpy.celtypes.TypeType" + + def __init__( + self, + value: Union[ + value_pb2.Value, checked_pb2.Decl, checked_pb2.Decl.IdentDecl, str + ], + ) -> None: + if isinstance(value, value_pb2.Value): + self._from_cel_value(value) + super().__init__(value) + elif isinstance(value, checked_pb2.Decl): + self._from_decl(value) + super().__init__(value) + elif isinstance(value, checked_pb2.Decl.IdentDecl): + self._from_ident(value) + super().__init__(value) + elif isinstance(value, str): + self._from_str(value) + super().__init__(None) + else: + if isinstance(value, message.Message): + raise Exception( + f"Unable to interpret type from {value.DESCRIPTOR.full_name} message" + ) + else: + raise Exception(f"Unable to interpret type from {repr(value)}") + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in ["type", "type_value"] + + def _from_cel_value(self, source: value_pb2.Value) -> None: + self._from_str(source.type_value) + + def _from_decl(self, source: checked_pb2.Decl) -> None: + decl_kind = source.WhichOneof("decl_kind") + + if decl_kind == "ident": + self._from_ident(source.ident) + else: + raise NotImplementedError( + f'Unable to interpret declaration kind "{decl_kind}"' + ) + + def _from_ident(self, ident: checked_pb2.Decl.IdentDecl) -> None: + type_kind = ident.type.WhichOneof("type_kind") + if type_kind == "primitive": + primitive_kind = checked_pb2.Type.PrimitiveType.Name(ident.type.primitive) + + self.name = CELValue.get_class_by_alias( + primitive_kind, None, True + ).type_name + elif type_kind == "message_type": + cel_class = CELValue.get_class_by_alias( + ident.type.message_type, None, False + ) + if cel_class: + self.name = cel_class.type_name + else: + self._from_str(ident.type.message_type) + else: + self.name = CELValue.get_class_by_alias(type_kind, None, True).type_name + + def _from_str(self, type_value: str) -> None: + candidate = CELValue.get_class_by_alias(type_value, None, False) + + if candidate: + self.name = candidate.type_name + elif type_value in [ + "cel.expr.conformance.proto2.GlobalEnum", + "cel.expr.conformance.proto2.TestAllTypes.NestedEnum", + "cel.expr.conformance.proto3.GlobalEnum", + "cel.expr.conformance.proto3.TestAllTypes.NestedEnum", + ]: + raise NotImplementedError(f'Type not supported: "{type_value}"') + else: + self.name = "celpy.celtypes.MessageType" + + @staticmethod + def from_text_proto_str(text_proto: str) -> "CELType": + ident = checked_pb2.Decl.IdentDecl() + text_format.Parse(text_proto, ident) + return CELType(ident) + + def __repr__(self) -> str: + return self.name + + def __eq__(self, other: Any) -> bool: + return isinstance(other, CELType) and self.name == other.name + + +class CELExprValue: + def __init__(self, source: eval_pb2.ExprValue) -> None: + self.source = source + expr_value_kind = self.source.WhichOneof("kind") + + if expr_value_kind == "value": + self.value = CELValue.from_proto(self.source.value) + elif expr_value_kind == "error": + self.value = CELErrorSet(self.source.error) + else: + raise Exception( + f'Unable to interpret CEL expression value kind "{expr_value_kind}"' + ) + + def __repr__(self) -> str: + return repr(self.value) + + +class CELPrimitive(CELValue): + def __init__(self, source: Optional[message.Message], value: Any) -> None: + self.value = value + super().__init__(source) + + def __eq__(self, other: Any) -> bool: + return isinstance(other, CELPrimitive) and (self.value == other.value) + + def __hash__(self) -> int: + return hash(self.value) + + def __repr__(self) -> str: + return f"{self.type_name}(source={repr(self.value)})" + + +class CELInt(CELPrimitive): + type_name = "celpy.celtypes.IntType" + + def __init__( + self, source: Union[wrappers_pb2.Int32Value, wrappers_pb2.Int64Value, int] + ) -> None: + if isinstance(source, wrappers_pb2.Int32Value) or isinstance( + source, wrappers_pb2.Int64Value + ): + value = source.value + super().__init__(source, value) + else: + value = source + super().__init__(None, value) + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in [ + "INT64", + "int", + "int64_value", + "google.protobuf.Int32Value", + "google.protobuf.Int64Value", + ] + + +class CELUint(CELPrimitive): + type_name = "celpy.celtypes.UintType" + + def __init__( + self, source: Union[wrappers_pb2.UInt32Value, wrappers_pb2.UInt64Value, int] + ) -> None: + if isinstance(source, wrappers_pb2.UInt32Value) or isinstance( + source, wrappers_pb2.UInt64Value + ): + value = source.value + super().__init__(source, value) + else: + value = source + super().__init__(None, value) + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in [ + "UINT64", + "uint", + "uint64_value", + "google.protobuf.UInt32Value", + "google.protobuf.UInt64Value", + ] + + +class CELDouble(CELPrimitive): + type_name = "celpy.celtypes.DoubleType" + + def __init__( + self, source: Union[wrappers_pb2.FloatValue, wrappers_pb2.DoubleValue, float] + ) -> None: + if isinstance(source, wrappers_pb2.FloatValue) or isinstance( + source, wrappers_pb2.DoubleValue + ): + value = source.value + super().__init__(source, value) + else: + value = source + super().__init__(None, value) + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in [ + "DOUBLE", + "double", + "double_value", + "number_value", + "google.protobuf.FloatValue", + "google.protobuf.DoubleValue", + ] + + def __repr__(self) -> str: + source = repr(self.value) + if source in ["-inf", "inf", "nan"]: + source = f"float({repr(source)})" + return f"{self.type_name}(source={source})" + + +class CELBool(CELPrimitive): + type_name = "celpy.celtypes.BoolType" + + def __init__(self, source: Union[wrappers_pb2.BoolValue, bool]) -> None: + if isinstance(source, wrappers_pb2.BoolValue): + value = source.value + super().__init__(source, value) + else: + value = source + super().__init__(None, value) + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in ["BOOL", "bool", "bool_value", "google.protobuf.BoolValue"] + + +class CELString(CELPrimitive): + type_name = "celpy.celtypes.StringType" + + def __init__(self, source: Union[wrappers_pb2.StringValue, str]) -> None: + if isinstance(source, wrappers_pb2.StringValue): + value = source.value + super().__init__(source, value) + else: + value = source + super().__init__(None, value) + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in [ + "STRING", + "string", + "string_value", + "google.protobuf.StringValue", + ] + + def __str__(self) -> str: + return str(self.value) + + +class CELBytes(CELPrimitive): + type_name = "celpy.celtypes.BytesType" + + def __init__(self, source: Union[wrappers_pb2.BytesValue, bytes]) -> None: + if isinstance(source, wrappers_pb2.BytesValue): + value = source.value + super().__init__(source, value) + else: + value = source + super().__init__(None, value) + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in ["BYTES", "bytes", "bytes_value", "google.protobuf.BytesValue"] + + +class CELEnum(CELPrimitive): + type_name = "celpy.celtypes.Enum" + + def __init__(self, _: Any) -> None: + raise NotImplementedError("Enums not yet supported") + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in ["enum_value"] + + +class CELNull(CELValue): + type_name = "NoneType" + + def __init__(self, source: None = None) -> None: + super().__init__(source) + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in ["null", "null_type", "null_value"] + + def __eq__(self, other: Any) -> bool: + return other is None or isinstance(other, CELNull) + + def __repr__(self) -> str: + return "None" + + +class CELList(CELValue): + type_name = "celpy.celtypes.ListType" + + def __init__( + self, source: Union[struct_pb2.ListValue, value_pb2.ListValue, list[CELValue]] + ) -> None: + if isinstance(source, (struct_pb2.ListValue, value_pb2.ListValue)): + self.values = [CELValue.from_proto(v) for v in source.values] + super().__init__(source) + else: + self.values = source + super().__init__(None) + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in ["list", "list_type", "list_value", "google.protobuf.ListValue"] + + def __eq__(self, other: Any) -> bool: + if not isinstance(other, CELList): + return False + + if len(self.values) != len(other.values): + return False + + for s, o in zip(self.values, other.values): + if s != o: + return False + + return True + + def __repr__(self) -> str: + return f"[{', '.join(repr(v) for v in self.values)}]" + + +class CELMap(CELValue): + type_name = "celpy.celtypes.MapType" + + def __init__( + self, source: Union[struct_pb2.Struct, value_pb2.MapValue, dict[str, CELValue]] + ) -> None: + self.value = {} + if isinstance(source, struct_pb2.Struct): + for k in source.fields: + self.value[k] = CELValue.from_proto(source.fields[k]) + super().__init__(source) + elif isinstance(source, value_pb2.MapValue): + for e in source.entries: + self.value[str(CELValue.from_proto(e.key))] = CELValue.from_proto( + e.value + ) + super().__init__(source) + elif isinstance(source, dict): + self.value = source + super().__init__(None) + else: + raise Exception(f"Cannot use {repr(source)} as map input") + + def __eq__(self, other: Any) -> bool: + return isinstance(other, CELMap) and self.value == other.value + + def __repr__(self) -> str: + return f"{self.type_name}({repr(self.value)})" + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in [ + "map", + "map_type", + "map_value", + "struct_value", + "google.protobuf.Struct", + ] + + +class AnyWrapper(CELValue): + def __init__(self, source: any_pb2.Any) -> None: + self.value = ProtoAny(source) + super().__init__(source) + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in ["object_value"] + + def __repr__(self) -> str: + return repr(self.value) + + +class CELDuration(CELValue): + type_name = "celpy.celtypes.DurationType" + + def __init__( + self, seconds: Union[duration_pb2.Duration, int], nanos: int = 0 + ) -> None: + if isinstance(seconds, message.Message): + self.seconds = seconds.seconds + self.nanos = seconds.nanos + super().__init__(seconds) + else: + self.seconds = seconds + self.nanos = nanos + super().__init__(None) + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in ["google.protobuf.Duration"] + + def __eq__(self, other: Any) -> bool: + return isinstance(other, CELDuration) and (self.seconds, self.nanos) == ( + other.seconds, + other.nanos, + ) + + def __repr__(self) -> str: + return f"{self.type_name}(seconds={self.seconds:.0f}, nanos={self.nanos:.0f})" + + +class CELTimestamp(CELValue): + type_name = "celpy.celtypes.TimestampType" + + def __init__( + self, seconds: Union[timestamp_pb2.Timestamp, int], nanos: int = 0 + ) -> None: + if isinstance(seconds, timestamp_pb2.Timestamp): + self.seconds = seconds.seconds + self.nanos = seconds.nanos + super().__init__(seconds) + else: + self.seconds = seconds + self.nanos = nanos + super().__init__(None) + self.value = datetime.fromtimestamp(self.seconds, tz=timezone.utc) + timedelta( + microseconds=(self.nanos / 1000) + ) + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in ["google.protobuf.Timestamp"] + + def __repr__(self) -> str: + return f"{self.type_name}({repr(self.value)})" + + +class CELStatus(CELValue): + def __init__(self, message: Union[eval_pb2.Status, str], code: int = 0) -> None: + if isinstance(message, eval_pb2.Status): + self.message = message.message + self.code = message.code + super().__init__(message) + else: + self.message = message + self.code = code + super().__init__(None) + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in ["cel.expr.Status"] + + def __eq__(self, other: Any) -> bool: + return isinstance(other, CELStatus) and (self.message, self.code) == ( + other.message, + other.code, + ) + + def __repr__(self) -> str: + return repr(self.message) + + +class CELErrorSet(CELValue): + type_name = "CELEvalError" + + def __init__(self, message: Union[eval_pb2.ErrorSet, list[CELStatus], str]) -> None: + self.errors = [] + if isinstance(message, eval_pb2.ErrorSet): + for status in message.errors: + self.errors.append(CELStatus(status)) + super().__init__(message) + elif isinstance(message, eval_pb2.Status): + self.errors.append(CELStatus(message)) + super().__init__(message) + elif isinstance(message, str): + self.errors.append(CELStatus(message)) + super().__init__(None) + elif isinstance(message, list): + for m in message: + if not isinstance(m, CELStatus): + raise Exception(f"Cannot use {repr(m)} in place of status") + self.errors.append(m) + super().__init__(None) + elif isinstance(message, str): + self.errors.append(CELStatus(message)) + super().__init__(None) + else: + raise Exception(f"Cannot use {repr(message)} as error set input") + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in ["cel.expr.ErrorSet"] + + @staticmethod + def from_text_proto_str(text_proto: str) -> "CELErrorSet": + errorSet = eval_pb2.ErrorSet() + text_format.Parse(text_proto, errorSet) + return CELErrorSet(errorSet) + + def __eq__(self, other: Any) -> bool: + if not isinstance(other, CELErrorSet): + return False + + if len(self.errors) != len(other.errors): + return False + + for s, o in zip(self.errors, other.errors): + if s != o: + return False + + return True + + def __repr__(self) -> str: + return f"{self.type_name}({', '.join(repr(e) for e in self.errors)})" + + def __str__(self) -> str: + return ", ".join(e.message for e in self.errors) + + +class ProtoAny: + def __init__(self, source: any_pb2.Any) -> None: + self.source = source + type_name = self.source.type_url.split("/")[-1] + desc = pool.FindMessageTypeByName(type_name) + message_value = message_factory.GetMessageClass(desc)() + self.source.Unpack(message_value) + self.value = CELValue.from_proto(message_value) + + def __repr__(self) -> str: + return repr(self.value) + + +class CELMessage(CELValue): + type_name = "celpy.celtypes.MessageType" + + def __init__( + self, source: message.Message, name_override: Optional[str] = None + ) -> None: + self.source = source + name = ( + name_override if name_override is not None else self.source.DESCRIPTOR.name + ) + fieldLiterals = [] + fields = self.source.ListFields() + for desc, value in fields: + if desc.is_repeated: + repeatedValues = [] + for v in value: + if isinstance(v, message.Message): + repeatedValues.append(repr(CELValue.from_proto(v))) + else: + repeatedValues.append(repr(v)) + fieldLiterals.append(f"{desc.name}=[{', '.join(repeatedValues)}]") + elif isinstance(value, message.Message): + fieldLiterals.append(f"{desc.name}={repr(CELValue.from_proto(value))}") + else: + fieldLiterals.append(f"{desc.name}={repr(value)}") + self.literal = f"{name}({', '.join(fieldLiterals)})" + + def __eq__(self, other: Any) -> bool: + return isinstance(other, CELMessage) and self.source == other.source + + def __repr__(self) -> str: + return self.literal + + +class Scenario: + def __init__( + self, + config: Config, + feature: "Feature", + section: "Section", + source: simple_pb2.SimpleTest, + ) -> None: + logger.debug(f"Scenario {source.name}") + self.name = source.name + self.description = source.description + self.tag = "" + for tag in config.tags_for(feature.name, section.name, source.name): + self.tag += f"{tag}\n" + self.preconditions: list[str] = [] + self.events: list[str] = [] + self.outcomes: list[str] = [] + + if source.disable_macros: + self.given("disable_macros parameter is True") + if source.disable_check: + self.given("disable_check parameter is True") + for type_env in source.type_env: + self.given(f'type_env parameter "{type_env.name}" is {CELType(type_env)}') + for key in source.bindings.keys(): + self.given( + f'bindings parameter "{key}" is {CELExprValue(source.bindings[key])}' + ) + if source.container: + self.given(f"container is {source.container!r}") + + self.when(f"CEL expression {source.expr!r} is evaluated") + + result = Result.from_proto(source) + self.then(f"{result.kind} is {result}") + + def given(self, precondition: str) -> Self: + self.preconditions.append(precondition) + return self + + def when(self, event: str) -> Self: + self.events.append(event) + return self + + def then(self, event: str) -> Self: + self.outcomes.append(event) + return self + + @property + def steps(self) -> list[str]: + steps = [] + if len(self.preconditions) > 0: + steps.append(f"Given {self.preconditions[0]}") + steps.extend([f"and {p}" for p in self.preconditions[1:]]) + if len(self.events) > 0: + steps.append(f"When {self.events[0]}") + steps.extend([f"and {e}" for e in self.events[1:]]) + if len(self.outcomes) > 0: + steps.append(f"Then {self.outcomes[0]}") + steps.extend([f"and {o}" for o in self.outcomes[1:]]) + + return steps + + +class Section: + def __init__( + self, config: Config, feature: "Feature", source: simple_pb2.SimpleTestSection + ) -> None: + logger.debug(f"Section {source.name}") + self.name = source.name + self.description = source.description + self.scenarios = [] + for test in source.test: + try: + self.scenarios.append(Scenario(config, feature, self, test)) + except NotImplementedError as e: + logger.warning(f"Skipping scenario {test.name} because: {e}") + + +class Feature: + def __init__(self, config: Config, source: simple_pb2.SimpleTestFile): + self.name = source.name + self.description = source.description + self.sections = [Section(config, self, s) for s in source.section] + + @staticmethod + def from_text_proto(config: Config, path: Path) -> "Feature": + logger.debug(f"Reading from {path}...") + with open(path, encoding="utf_8") as file_handle: + text = ( + file_handle.read() + .replace("google.api.expr.test.v1.", "cel.expr.conformance.") + .replace("protubuf", "protobuf") + ) + file = simple_pb2.SimpleTestFile() + logger.debug(f"Parsing {path}...") + text_format.Parse(text, file) + return Feature(config, file) + + def write_to_file(self, path: Optional[Path]) -> None: + logger.debug("Rendering to gherkin...") + gherkin = template.render(feature=self) + + if path: + logger.debug(f"Writing to {path}...") + with open(path, "w", encoding="utf_8") as file_handle: + file_handle.write(gherkin) + else: + print(gherkin) + + +def get_options(argv: list[str] = sys.argv[1:]) -> argparse.Namespace: + parser = argparse.ArgumentParser() + parser.add_argument( + "-v", + "--verbose", + dest="log_level", + action="store_const", + const=logging.DEBUG, + default=logging.INFO, + ) + parser.add_argument( + "-s", "--silent", dest="log_level", action="store_const", const=logging.ERROR + ) + parser.add_argument( + "-o", + "--output", + action="store", + type=Path, + default=None, + help="output file (default is stdout)", + ) + parser.add_argument( + "source", + action="store", + nargs="?", + type=Path, + help=".textproto file to convert", + ) + options = parser.parse_args(argv) + return options + + +if __name__ == "__main__": + options = get_options() + logging.basicConfig(level=logging.INFO) + logging.getLogger().setLevel(options.log_level) + + config = Config(f"{path.dirname(__file__)}/wip.toml") + feature = Feature.from_text_proto(config, options.source) + feature.write_to_file(options.output) + + +class NotImplementedError(Exception): + pass +
+ +
+ +
+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/build/html/_modules/index.html b/docs/build/html/_modules/index.html index b4cbe3e..6c4d48d 100644 --- a/docs/build/html/_modules/index.html +++ b/docs/build/html/_modules/index.html @@ -6,7 +6,7 @@ Overview: module code — CEL in Python documentation - + @@ -38,9 +38,7 @@

All modules for which code is available

  • celpy.celparser
  • celpy.celtypes
  • celpy.evaluation
  • -
  • lark.tree
  • -
  • logging
  • -
  • re
  • +
  • gherkinize
  • @@ -103,7 +101,7 @@

    Related Topics

    ©2020, CapitalOne. | - Powered by Sphinx 8.2.3 + Powered by Sphinx 8.1.3 & Alabaster 1.0.0
    diff --git a/docs/build/html/_modules/lark/tree.html b/docs/build/html/_modules/lark/tree.html deleted file mode 100644 index 8207153..0000000 --- a/docs/build/html/_modules/lark/tree.html +++ /dev/null @@ -1,373 +0,0 @@ - - - - - - - lark.tree — CEL in Python documentation - - - - - - - - - - - - - - - - - - -
    -
    -
    - - -
    - -

    Source code for lark.tree

    -import sys
    -from copy import deepcopy
    -
    -from typing import List, Callable, Iterator, Union, Optional, Generic, TypeVar, TYPE_CHECKING
    -
    -if TYPE_CHECKING:
    -    from .lexer import TerminalDef, Token
    -    try:
    -        import rich
    -    except ImportError:
    -        pass
    -    from typing import Literal
    -
    -###{standalone
    -
    -class Meta:
    -
    -    empty: bool
    -    line: int
    -    column: int
    -    start_pos: int
    -    end_line: int
    -    end_column: int
    -    end_pos: int
    -    orig_expansion: 'List[TerminalDef]'
    -    match_tree: bool
    -
    -    def __init__(self):
    -        self.empty = True
    -
    -
    -_Leaf_T = TypeVar("_Leaf_T")
    -Branch = Union[_Leaf_T, 'Tree[_Leaf_T]']
    -
    -
    -class Tree(Generic[_Leaf_T]):
    -    """The main tree class.
    -
    -    Creates a new tree, and stores "data" and "children" in attributes of the same name.
    -    Trees can be hashed and compared.
    -
    -    Parameters:
    -        data: The name of the rule or alias
    -        children: List of matched sub-rules and terminals
    -        meta: Line & Column numbers (if ``propagate_positions`` is enabled).
    -            meta attributes: (line, column, end_line, end_column, start_pos, end_pos,
    -                              container_line, container_column, container_end_line, container_end_column)
    -            container_* attributes consider all symbols, including those that have been inlined in the tree.
    -            For example, in the rule 'a: _A B _C', the regular attributes will mark the start and end of B,
    -            but the container_* attributes will also include _A and _C in the range. However, rules that
    -            contain 'a' will consider it in full, including _A and _C for all attributes.
    -    """
    -
    -    data: str
    -    children: 'List[Branch[_Leaf_T]]'
    -
    -    def __init__(self, data: str, children: 'List[Branch[_Leaf_T]]', meta: Optional[Meta]=None) -> None:
    -        self.data = data
    -        self.children = children
    -        self._meta = meta
    -
    -    @property
    -    def meta(self) -> Meta:
    -        if self._meta is None:
    -            self._meta = Meta()
    -        return self._meta
    -
    -    def __repr__(self):
    -        return 'Tree(%r, %r)' % (self.data, self.children)
    -
    -    def _pretty_label(self):
    -        return self.data
    -
    -    def _pretty(self, level, indent_str):
    -        yield f'{indent_str*level}{self._pretty_label()}'
    -        if len(self.children) == 1 and not isinstance(self.children[0], Tree):
    -            yield f'\t{self.children[0]}\n'
    -        else:
    -            yield '\n'
    -            for n in self.children:
    -                if isinstance(n, Tree):
    -                    yield from n._pretty(level+1, indent_str)
    -                else:
    -                    yield f'{indent_str*(level+1)}{n}\n'
    -
    -    def pretty(self, indent_str: str='  ') -> str:
    -        """Returns an indented string representation of the tree.
    -
    -        Great for debugging.
    -        """
    -        return ''.join(self._pretty(0, indent_str))
    -
    -    def __rich__(self, parent:Optional['rich.tree.Tree']=None) -> 'rich.tree.Tree':
    -        """Returns a tree widget for the 'rich' library.
    -
    -        Example:
    -            ::
    -                from rich import print
    -                from lark import Tree
    -
    -                tree = Tree('root', ['node1', 'node2'])
    -                print(tree)
    -        """
    -        return self._rich(parent)
    -
    -    def _rich(self, parent):
    -        if parent:
    -            tree = parent.add(f'[bold]{self.data}[/bold]')
    -        else:
    -            import rich.tree
    -            tree = rich.tree.Tree(self.data)
    -
    -        for c in self.children:
    -            if isinstance(c, Tree):
    -                c._rich(tree)
    -            else:
    -                tree.add(f'[green]{c}[/green]')
    -
    -        return tree
    -
    -    def __eq__(self, other):
    -        try:
    -            return self.data == other.data and self.children == other.children
    -        except AttributeError:
    -            return False
    -
    -    def __ne__(self, other):
    -        return not (self == other)
    -
    -    def __hash__(self) -> int:
    -        return hash((self.data, tuple(self.children)))
    -
    -    def iter_subtrees(self) -> 'Iterator[Tree[_Leaf_T]]':
    -        """Depth-first iteration.
    -
    -        Iterates over all the subtrees, never returning to the same node twice (Lark's parse-tree is actually a DAG).
    -        """
    -        queue = [self]
    -        subtrees = dict()
    -        for subtree in queue:
    -            subtrees[id(subtree)] = subtree
    -            queue += [c for c in reversed(subtree.children)
    -                      if isinstance(c, Tree) and id(c) not in subtrees]
    -
    -        del queue
    -        return reversed(list(subtrees.values()))
    -
    -    def iter_subtrees_topdown(self):
    -        """Breadth-first iteration.
    -
    -        Iterates over all the subtrees, return nodes in order like pretty() does.
    -        """
    -        stack = [self]
    -        stack_append = stack.append
    -        stack_pop = stack.pop
    -        while stack:
    -            node = stack_pop()
    -            if not isinstance(node, Tree):
    -                continue
    -            yield node
    -            for child in reversed(node.children):
    -                stack_append(child)
    -
    -    def find_pred(self, pred: 'Callable[[Tree[_Leaf_T]], bool]') -> 'Iterator[Tree[_Leaf_T]]':
    -        """Returns all nodes of the tree that evaluate pred(node) as true."""
    -        return filter(pred, self.iter_subtrees())
    -
    -    def find_data(self, data: str) -> 'Iterator[Tree[_Leaf_T]]':
    -        """Returns all nodes of the tree whose data equals the given data."""
    -        return self.find_pred(lambda t: t.data == data)
    -
    -###}
    -
    -    def expand_kids_by_data(self, *data_values):
    -        """Expand (inline) children with any of the given data values. Returns True if anything changed"""
    -        changed = False
    -        for i in range(len(self.children)-1, -1, -1):
    -            child = self.children[i]
    -            if isinstance(child, Tree) and child.data in data_values:
    -                self.children[i:i+1] = child.children
    -                changed = True
    -        return changed
    -
    -
    -    def scan_values(self, pred: 'Callable[[Branch[_Leaf_T]], bool]') -> Iterator[_Leaf_T]:
    -        """Return all values in the tree that evaluate pred(value) as true.
    -
    -        This can be used to find all the tokens in the tree.
    -
    -        Example:
    -            >>> all_tokens = tree.scan_values(lambda v: isinstance(v, Token))
    -        """
    -        for c in self.children:
    -            if isinstance(c, Tree):
    -                for t in c.scan_values(pred):
    -                    yield t
    -            else:
    -                if pred(c):
    -                    yield c
    -
    -    def __deepcopy__(self, memo):
    -        return type(self)(self.data, deepcopy(self.children, memo), meta=self._meta)
    -
    -    def copy(self) -> 'Tree[_Leaf_T]':
    -        return type(self)(self.data, self.children)
    -
    -    def set(self, data: str, children: 'List[Branch[_Leaf_T]]') -> None:
    -        self.data = data
    -        self.children = children
    -
    -
    -ParseTree = Tree['Token']
    -
    -
    -class SlottedTree(Tree):
    -    __slots__ = 'data', 'children', 'rule', '_meta'
    -
    -
    -def pydot__tree_to_png(tree: Tree, filename: str, rankdir: 'Literal["TB", "LR", "BT", "RL"]'="LR", **kwargs) -> None:
    -    graph = pydot__tree_to_graph(tree, rankdir, **kwargs)
    -    graph.write_png(filename)
    -
    -
    -def pydot__tree_to_dot(tree: Tree, filename, rankdir="LR", **kwargs):
    -    graph = pydot__tree_to_graph(tree, rankdir, **kwargs)
    -    graph.write(filename)
    -
    -
    -def pydot__tree_to_graph(tree: Tree, rankdir="LR", **kwargs):
    -    """Creates a colorful image that represents the tree (data+children, without meta)
    -
    -    Possible values for `rankdir` are "TB", "LR", "BT", "RL", corresponding to
    -    directed graphs drawn from top to bottom, from left to right, from bottom to
    -    top, and from right to left, respectively.
    -
    -    `kwargs` can be any graph attribute (e. g. `dpi=200`). For a list of
    -    possible attributes, see https://www.graphviz.org/doc/info/attrs.html.
    -    """
    -
    -    import pydot  # type: ignore[import-not-found]
    -    graph = pydot.Dot(graph_type='digraph', rankdir=rankdir, **kwargs)
    -
    -    i = [0]
    -
    -    def new_leaf(leaf):
    -        node = pydot.Node(i[0], label=repr(leaf))
    -        i[0] += 1
    -        graph.add_node(node)
    -        return node
    -
    -    def _to_pydot(subtree):
    -        color = hash(subtree.data) & 0xffffff
    -        color |= 0x808080
    -
    -        subnodes = [_to_pydot(child) if isinstance(child, Tree) else new_leaf(child)
    -                    for child in subtree.children]
    -        node = pydot.Node(i[0], style="filled", fillcolor="#%x" % color, label=subtree.data)
    -        i[0] += 1
    -        graph.add_node(node)
    -
    -        for subnode in subnodes:
    -            graph.add_edge(pydot.Edge(node, subnode))
    -
    -        return node
    -
    -    _to_pydot(tree)
    -    return graph
    -
    - -
    - -
    -
    - -
    -
    - - - - - - - \ No newline at end of file diff --git a/docs/build/html/_modules/logging.html b/docs/build/html/_modules/logging.html deleted file mode 100644 index 134fdfb..0000000 --- a/docs/build/html/_modules/logging.html +++ /dev/null @@ -1,2451 +0,0 @@ - - - - - - - logging — CEL in Python documentation - - - - - - - - - - - - - - - - - - -
    -
    -
    - - -
    - -

    Source code for logging

    -# Copyright 2001-2022 by Vinay Sajip. All Rights Reserved.
    -#
    -# Permission to use, copy, modify, and distribute this software and its
    -# documentation for any purpose and without fee is hereby granted,
    -# provided that the above copyright notice appear in all copies and that
    -# both that copyright notice and this permission notice appear in
    -# supporting documentation, and that the name of Vinay Sajip
    -# not be used in advertising or publicity pertaining to distribution
    -# of the software without specific, written prior permission.
    -# VINAY SAJIP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
    -# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
    -# VINAY SAJIP BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
    -# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
    -# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
    -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
    -
    -"""
    -Logging package for Python. Based on PEP 282 and comments thereto in
    -comp.lang.python.
    -
    -Copyright (C) 2001-2022 Vinay Sajip. All Rights Reserved.
    -
    -To use, simply 'import logging' and log away!
    -"""
    -
    -import sys, os, time, io, re, traceback, warnings, weakref, collections.abc
    -
    -from types import GenericAlias
    -from string import Template
    -from string import Formatter as StrFormatter
    -
    -
    -__all__ = ['BASIC_FORMAT', 'BufferingFormatter', 'CRITICAL', 'DEBUG', 'ERROR',
    -           'FATAL', 'FileHandler', 'Filter', 'Formatter', 'Handler', 'INFO',
    -           'LogRecord', 'Logger', 'LoggerAdapter', 'NOTSET', 'NullHandler',
    -           'StreamHandler', 'WARN', 'WARNING', 'addLevelName', 'basicConfig',
    -           'captureWarnings', 'critical', 'debug', 'disable', 'error',
    -           'exception', 'fatal', 'getLevelName', 'getLogger', 'getLoggerClass',
    -           'info', 'log', 'makeLogRecord', 'setLoggerClass', 'shutdown',
    -           'warn', 'warning', 'getLogRecordFactory', 'setLogRecordFactory',
    -           'lastResort', 'raiseExceptions', 'getLevelNamesMapping',
    -           'getHandlerByName', 'getHandlerNames']
    -
    -import threading
    -
    -__author__  = "Vinay Sajip <vinay_sajip@red-dove.com>"
    -__status__  = "production"
    -# The following module attributes are no longer updated.
    -__version__ = "0.5.1.2"
    -__date__    = "07 February 2010"
    -
    -#---------------------------------------------------------------------------
    -#   Miscellaneous module data
    -#---------------------------------------------------------------------------
    -
    -#
    -#_startTime is used as the base when calculating the relative time of events
    -#
    -_startTime = time.time()
    -
    -#
    -#raiseExceptions is used to see if exceptions during handling should be
    -#propagated
    -#
    -raiseExceptions = True
    -
    -#
    -# If you don't want threading information in the log, set this to False
    -#
    -logThreads = True
    -
    -#
    -# If you don't want multiprocessing information in the log, set this to False
    -#
    -logMultiprocessing = True
    -
    -#
    -# If you don't want process information in the log, set this to False
    -#
    -logProcesses = True
    -
    -#
    -# If you don't want asyncio task information in the log, set this to False
    -#
    -logAsyncioTasks = True
    -
    -#---------------------------------------------------------------------------
    -#   Level related stuff
    -#---------------------------------------------------------------------------
    -#
    -# Default levels and level names, these can be replaced with any positive set
    -# of values having corresponding names. There is a pseudo-level, NOTSET, which
    -# is only really there as a lower limit for user-defined levels. Handlers and
    -# loggers are initialized with NOTSET so that they will log all messages, even
    -# at user-defined levels.
    -#
    -
    -CRITICAL = 50
    -FATAL = CRITICAL
    -ERROR = 40
    -WARNING = 30
    -WARN = WARNING
    -INFO = 20
    -DEBUG = 10
    -NOTSET = 0
    -
    -_levelToName = {
    -    CRITICAL: 'CRITICAL',
    -    ERROR: 'ERROR',
    -    WARNING: 'WARNING',
    -    INFO: 'INFO',
    -    DEBUG: 'DEBUG',
    -    NOTSET: 'NOTSET',
    -}
    -_nameToLevel = {
    -    'CRITICAL': CRITICAL,
    -    'FATAL': FATAL,
    -    'ERROR': ERROR,
    -    'WARN': WARNING,
    -    'WARNING': WARNING,
    -    'INFO': INFO,
    -    'DEBUG': DEBUG,
    -    'NOTSET': NOTSET,
    -}
    -
    -def getLevelNamesMapping():
    -    return _nameToLevel.copy()
    -
    -def getLevelName(level):
    -    """
    -    Return the textual or numeric representation of logging level 'level'.
    -
    -    If the level is one of the predefined levels (CRITICAL, ERROR, WARNING,
    -    INFO, DEBUG) then you get the corresponding string. If you have
    -    associated levels with names using addLevelName then the name you have
    -    associated with 'level' is returned.
    -
    -    If a numeric value corresponding to one of the defined levels is passed
    -    in, the corresponding string representation is returned.
    -
    -    If a string representation of the level is passed in, the corresponding
    -    numeric value is returned.
    -
    -    If no matching numeric or string value is passed in, the string
    -    'Level %s' % level is returned.
    -    """
    -    # See Issues #22386, #27937 and #29220 for why it's this way
    -    result = _levelToName.get(level)
    -    if result is not None:
    -        return result
    -    result = _nameToLevel.get(level)
    -    if result is not None:
    -        return result
    -    return "Level %s" % level
    -
    -def addLevelName(level, levelName):
    -    """
    -    Associate 'levelName' with 'level'.
    -
    -    This is used when converting levels to text during message formatting.
    -    """
    -    _acquireLock()
    -    try:    #unlikely to cause an exception, but you never know...
    -        _levelToName[level] = levelName
    -        _nameToLevel[levelName] = level
    -    finally:
    -        _releaseLock()
    -
    -if hasattr(sys, "_getframe"):
    -    currentframe = lambda: sys._getframe(1)
    -else: #pragma: no cover
    -    def currentframe():
    -        """Return the frame object for the caller's stack frame."""
    -        try:
    -            raise Exception
    -        except Exception as exc:
    -            return exc.__traceback__.tb_frame.f_back
    -
    -#
    -# _srcfile is used when walking the stack to check when we've got the first
    -# caller stack frame, by skipping frames whose filename is that of this
    -# module's source. It therefore should contain the filename of this module's
    -# source file.
    -#
    -# Ordinarily we would use __file__ for this, but frozen modules don't always
    -# have __file__ set, for some reason (see Issue #21736). Thus, we get the
    -# filename from a handy code object from a function defined in this module.
    -# (There's no particular reason for picking addLevelName.)
    -#
    -
    -_srcfile = os.path.normcase(addLevelName.__code__.co_filename)
    -
    -# _srcfile is only used in conjunction with sys._getframe().
    -# Setting _srcfile to None will prevent findCaller() from being called. This
    -# way, you can avoid the overhead of fetching caller information.
    -
    -# The following is based on warnings._is_internal_frame. It makes sure that
    -# frames of the import mechanism are skipped when logging at module level and
    -# using a stacklevel value greater than one.
    -def _is_internal_frame(frame):
    -    """Signal whether the frame is a CPython or logging module internal."""
    -    filename = os.path.normcase(frame.f_code.co_filename)
    -    return filename == _srcfile or (
    -        "importlib" in filename and "_bootstrap" in filename
    -    )
    -
    -
    -def _checkLevel(level):
    -    if isinstance(level, int):
    -        rv = level
    -    elif str(level) == level:
    -        if level not in _nameToLevel:
    -            raise ValueError("Unknown level: %r" % level)
    -        rv = _nameToLevel[level]
    -    else:
    -        raise TypeError("Level not an integer or a valid string: %r"
    -                        % (level,))
    -    return rv
    -
    -#---------------------------------------------------------------------------
    -#   Thread-related stuff
    -#---------------------------------------------------------------------------
    -
    -#
    -#_lock is used to serialize access to shared data structures in this module.
    -#This needs to be an RLock because fileConfig() creates and configures
    -#Handlers, and so might arbitrary user threads. Since Handler code updates the
    -#shared dictionary _handlers, it needs to acquire the lock. But if configuring,
    -#the lock would already have been acquired - so we need an RLock.
    -#The same argument applies to Loggers and Manager.loggerDict.
    -#
    -_lock = threading.RLock()
    -
    -def _acquireLock():
    -    """
    -    Acquire the module-level lock for serializing access to shared data.
    -
    -    This should be released with _releaseLock().
    -    """
    -    if _lock:
    -        _lock.acquire()
    -
    -def _releaseLock():
    -    """
    -    Release the module-level lock acquired by calling _acquireLock().
    -    """
    -    if _lock:
    -        _lock.release()
    -
    -
    -# Prevent a held logging lock from blocking a child from logging.
    -
    -if not hasattr(os, 'register_at_fork'):  # Windows and friends.
    -    def _register_at_fork_reinit_lock(instance):
    -        pass  # no-op when os.register_at_fork does not exist.
    -else:
    -    # A collection of instances with a _at_fork_reinit method (logging.Handler)
    -    # to be called in the child after forking.  The weakref avoids us keeping
    -    # discarded Handler instances alive.
    -    _at_fork_reinit_lock_weakset = weakref.WeakSet()
    -
    -    def _register_at_fork_reinit_lock(instance):
    -        _acquireLock()
    -        try:
    -            _at_fork_reinit_lock_weakset.add(instance)
    -        finally:
    -            _releaseLock()
    -
    -    def _after_at_fork_child_reinit_locks():
    -        for handler in _at_fork_reinit_lock_weakset:
    -            handler._at_fork_reinit()
    -
    -        # _acquireLock() was called in the parent before forking.
    -        # The lock is reinitialized to unlocked state.
    -        _lock._at_fork_reinit()
    -
    -    os.register_at_fork(before=_acquireLock,
    -                        after_in_child=_after_at_fork_child_reinit_locks,
    -                        after_in_parent=_releaseLock)
    -
    -
    -#---------------------------------------------------------------------------
    -#   The logging record
    -#---------------------------------------------------------------------------
    -
    -class LogRecord(object):
    -    """
    -    A LogRecord instance represents an event being logged.
    -
    -    LogRecord instances are created every time something is logged. They
    -    contain all the information pertinent to the event being logged. The
    -    main information passed in is in msg and args, which are combined
    -    using str(msg) % args to create the message field of the record. The
    -    record also includes information such as when the record was created,
    -    the source line where the logging call was made, and any exception
    -    information to be logged.
    -    """
    -    def __init__(self, name, level, pathname, lineno,
    -                 msg, args, exc_info, func=None, sinfo=None, **kwargs):
    -        """
    -        Initialize a logging record with interesting information.
    -        """
    -        ct = time.time()
    -        self.name = name
    -        self.msg = msg
    -        #
    -        # The following statement allows passing of a dictionary as a sole
    -        # argument, so that you can do something like
    -        #  logging.debug("a %(a)d b %(b)s", {'a':1, 'b':2})
    -        # Suggested by Stefan Behnel.
    -        # Note that without the test for args[0], we get a problem because
    -        # during formatting, we test to see if the arg is present using
    -        # 'if self.args:'. If the event being logged is e.g. 'Value is %d'
    -        # and if the passed arg fails 'if self.args:' then no formatting
    -        # is done. For example, logger.warning('Value is %d', 0) would log
    -        # 'Value is %d' instead of 'Value is 0'.
    -        # For the use case of passing a dictionary, this should not be a
    -        # problem.
    -        # Issue #21172: a request was made to relax the isinstance check
    -        # to hasattr(args[0], '__getitem__'). However, the docs on string
    -        # formatting still seem to suggest a mapping object is required.
    -        # Thus, while not removing the isinstance check, it does now look
    -        # for collections.abc.Mapping rather than, as before, dict.
    -        if (args and len(args) == 1 and isinstance(args[0], collections.abc.Mapping)
    -            and args[0]):
    -            args = args[0]
    -        self.args = args
    -        self.levelname = getLevelName(level)
    -        self.levelno = level
    -        self.pathname = pathname
    -        try:
    -            self.filename = os.path.basename(pathname)
    -            self.module = os.path.splitext(self.filename)[0]
    -        except (TypeError, ValueError, AttributeError):
    -            self.filename = pathname
    -            self.module = "Unknown module"
    -        self.exc_info = exc_info
    -        self.exc_text = None      # used to cache the traceback text
    -        self.stack_info = sinfo
    -        self.lineno = lineno
    -        self.funcName = func
    -        self.created = ct
    -        self.msecs = int((ct - int(ct)) * 1000) + 0.0  # see gh-89047
    -        self.relativeCreated = (self.created - _startTime) * 1000
    -        if logThreads:
    -            self.thread = threading.get_ident()
    -            self.threadName = threading.current_thread().name
    -        else: # pragma: no cover
    -            self.thread = None
    -            self.threadName = None
    -        if not logMultiprocessing: # pragma: no cover
    -            self.processName = None
    -        else:
    -            self.processName = 'MainProcess'
    -            mp = sys.modules.get('multiprocessing')
    -            if mp is not None:
    -                # Errors may occur if multiprocessing has not finished loading
    -                # yet - e.g. if a custom import hook causes third-party code
    -                # to run when multiprocessing calls import. See issue 8200
    -                # for an example
    -                try:
    -                    self.processName = mp.current_process().name
    -                except Exception: #pragma: no cover
    -                    pass
    -        if logProcesses and hasattr(os, 'getpid'):
    -            self.process = os.getpid()
    -        else:
    -            self.process = None
    -
    -        self.taskName = None
    -        if logAsyncioTasks:
    -            asyncio = sys.modules.get('asyncio')
    -            if asyncio:
    -                try:
    -                    self.taskName = asyncio.current_task().get_name()
    -                except Exception:
    -                    pass
    -
    -    def __repr__(self):
    -        return '<LogRecord: %s, %s, %s, %s, "%s">'%(self.name, self.levelno,
    -            self.pathname, self.lineno, self.msg)
    -
    -    def getMessage(self):
    -        """
    -        Return the message for this LogRecord.
    -
    -        Return the message for this LogRecord after merging any user-supplied
    -        arguments with the message.
    -        """
    -        msg = str(self.msg)
    -        if self.args:
    -            msg = msg % self.args
    -        return msg
    -
    -#
    -#   Determine which class to use when instantiating log records.
    -#
    -_logRecordFactory = LogRecord
    -
    -def setLogRecordFactory(factory):
    -    """
    -    Set the factory to be used when instantiating a log record.
    -
    -    :param factory: A callable which will be called to instantiate
    -    a log record.
    -    """
    -    global _logRecordFactory
    -    _logRecordFactory = factory
    -
    -def getLogRecordFactory():
    -    """
    -    Return the factory to be used when instantiating a log record.
    -    """
    -
    -    return _logRecordFactory
    -
    -def makeLogRecord(dict):
    -    """
    -    Make a LogRecord whose attributes are defined by the specified dictionary,
    -    This function is useful for converting a logging event received over
    -    a socket connection (which is sent as a dictionary) into a LogRecord
    -    instance.
    -    """
    -    rv = _logRecordFactory(None, None, "", 0, "", (), None, None)
    -    rv.__dict__.update(dict)
    -    return rv
    -
    -
    -#---------------------------------------------------------------------------
    -#   Formatter classes and functions
    -#---------------------------------------------------------------------------
    -_str_formatter = StrFormatter()
    -del StrFormatter
    -
    -
    -class PercentStyle(object):
    -
    -    default_format = '%(message)s'
    -    asctime_format = '%(asctime)s'
    -    asctime_search = '%(asctime)'
    -    validation_pattern = re.compile(r'%\(\w+\)[#0+ -]*(\*|\d+)?(\.(\*|\d+))?[diouxefgcrsa%]', re.I)
    -
    -    def __init__(self, fmt, *, defaults=None):
    -        self._fmt = fmt or self.default_format
    -        self._defaults = defaults
    -
    -    def usesTime(self):
    -        return self._fmt.find(self.asctime_search) >= 0
    -
    -    def validate(self):
    -        """Validate the input format, ensure it matches the correct style"""
    -        if not self.validation_pattern.search(self._fmt):
    -            raise ValueError("Invalid format '%s' for '%s' style" % (self._fmt, self.default_format[0]))
    -
    -    def _format(self, record):
    -        if defaults := self._defaults:
    -            values = defaults | record.__dict__
    -        else:
    -            values = record.__dict__
    -        return self._fmt % values
    -
    -    def format(self, record):
    -        try:
    -            return self._format(record)
    -        except KeyError as e:
    -            raise ValueError('Formatting field not found in record: %s' % e)
    -
    -
    -class StrFormatStyle(PercentStyle):
    -    default_format = '{message}'
    -    asctime_format = '{asctime}'
    -    asctime_search = '{asctime'
    -
    -    fmt_spec = re.compile(r'^(.?[<>=^])?[+ -]?#?0?(\d+|{\w+})?[,_]?(\.(\d+|{\w+}))?[bcdefgnosx%]?$', re.I)
    -    field_spec = re.compile(r'^(\d+|\w+)(\.\w+|\[[^]]+\])*$')
    -
    -    def _format(self, record):
    -        if defaults := self._defaults:
    -            values = defaults | record.__dict__
    -        else:
    -            values = record.__dict__
    -        return self._fmt.format(**values)
    -
    -    def validate(self):
    -        """Validate the input format, ensure it is the correct string formatting style"""
    -        fields = set()
    -        try:
    -            for _, fieldname, spec, conversion in _str_formatter.parse(self._fmt):
    -                if fieldname:
    -                    if not self.field_spec.match(fieldname):
    -                        raise ValueError('invalid field name/expression: %r' % fieldname)
    -                    fields.add(fieldname)
    -                if conversion and conversion not in 'rsa':
    -                    raise ValueError('invalid conversion: %r' % conversion)
    -                if spec and not self.fmt_spec.match(spec):
    -                    raise ValueError('bad specifier: %r' % spec)
    -        except ValueError as e:
    -            raise ValueError('invalid format: %s' % e)
    -        if not fields:
    -            raise ValueError('invalid format: no fields')
    -
    -
    -class StringTemplateStyle(PercentStyle):
    -    default_format = '${message}'
    -    asctime_format = '${asctime}'
    -    asctime_search = '${asctime}'
    -
    -    def __init__(self, *args, **kwargs):
    -        super().__init__(*args, **kwargs)
    -        self._tpl = Template(self._fmt)
    -
    -    def usesTime(self):
    -        fmt = self._fmt
    -        return fmt.find('$asctime') >= 0 or fmt.find(self.asctime_search) >= 0
    -
    -    def validate(self):
    -        pattern = Template.pattern
    -        fields = set()
    -        for m in pattern.finditer(self._fmt):
    -            d = m.groupdict()
    -            if d['named']:
    -                fields.add(d['named'])
    -            elif d['braced']:
    -                fields.add(d['braced'])
    -            elif m.group(0) == '$':
    -                raise ValueError('invalid format: bare \'$\' not allowed')
    -        if not fields:
    -            raise ValueError('invalid format: no fields')
    -
    -    def _format(self, record):
    -        if defaults := self._defaults:
    -            values = defaults | record.__dict__
    -        else:
    -            values = record.__dict__
    -        return self._tpl.substitute(**values)
    -
    -
    -BASIC_FORMAT = "%(levelname)s:%(name)s:%(message)s"
    -
    -_STYLES = {
    -    '%': (PercentStyle, BASIC_FORMAT),
    -    '{': (StrFormatStyle, '{levelname}:{name}:{message}'),
    -    '$': (StringTemplateStyle, '${levelname}:${name}:${message}'),
    -}
    -
    -class Formatter(object):
    -    """
    -    Formatter instances are used to convert a LogRecord to text.
    -
    -    Formatters need to know how a LogRecord is constructed. They are
    -    responsible for converting a LogRecord to (usually) a string which can
    -    be interpreted by either a human or an external system. The base Formatter
    -    allows a formatting string to be specified. If none is supplied, the
    -    style-dependent default value, "%(message)s", "{message}", or
    -    "${message}", is used.
    -
    -    The Formatter can be initialized with a format string which makes use of
    -    knowledge of the LogRecord attributes - e.g. the default value mentioned
    -    above makes use of the fact that the user's message and arguments are pre-
    -    formatted into a LogRecord's message attribute. Currently, the useful
    -    attributes in a LogRecord are described by:
    -
    -    %(name)s            Name of the logger (logging channel)
    -    %(levelno)s         Numeric logging level for the message (DEBUG, INFO,
    -                        WARNING, ERROR, CRITICAL)
    -    %(levelname)s       Text logging level for the message ("DEBUG", "INFO",
    -                        "WARNING", "ERROR", "CRITICAL")
    -    %(pathname)s        Full pathname of the source file where the logging
    -                        call was issued (if available)
    -    %(filename)s        Filename portion of pathname
    -    %(module)s          Module (name portion of filename)
    -    %(lineno)d          Source line number where the logging call was issued
    -                        (if available)
    -    %(funcName)s        Function name
    -    %(created)f         Time when the LogRecord was created (time.time()
    -                        return value)
    -    %(asctime)s         Textual time when the LogRecord was created
    -    %(msecs)d           Millisecond portion of the creation time
    -    %(relativeCreated)d Time in milliseconds when the LogRecord was created,
    -                        relative to the time the logging module was loaded
    -                        (typically at application startup time)
    -    %(thread)d          Thread ID (if available)
    -    %(threadName)s      Thread name (if available)
    -    %(taskName)s        Task name (if available)
    -    %(process)d         Process ID (if available)
    -    %(message)s         The result of record.getMessage(), computed just as
    -                        the record is emitted
    -    """
    -
    -    converter = time.localtime
    -
    -    def __init__(self, fmt=None, datefmt=None, style='%', validate=True, *,
    -                 defaults=None):
    -        """
    -        Initialize the formatter with specified format strings.
    -
    -        Initialize the formatter either with the specified format string, or a
    -        default as described above. Allow for specialized date formatting with
    -        the optional datefmt argument. If datefmt is omitted, you get an
    -        ISO8601-like (or RFC 3339-like) format.
    -
    -        Use a style parameter of '%', '{' or '$' to specify that you want to
    -        use one of %-formatting, :meth:`str.format` (``{}``) formatting or
    -        :class:`string.Template` formatting in your format string.
    -
    -        .. versionchanged:: 3.2
    -           Added the ``style`` parameter.
    -        """
    -        if style not in _STYLES:
    -            raise ValueError('Style must be one of: %s' % ','.join(
    -                             _STYLES.keys()))
    -        self._style = _STYLES[style][0](fmt, defaults=defaults)
    -        if validate:
    -            self._style.validate()
    -
    -        self._fmt = self._style._fmt
    -        self.datefmt = datefmt
    -
    -    default_time_format = '%Y-%m-%d %H:%M:%S'
    -    default_msec_format = '%s,%03d'
    -
    -    def formatTime(self, record, datefmt=None):
    -        """
    -        Return the creation time of the specified LogRecord as formatted text.
    -
    -        This method should be called from format() by a formatter which
    -        wants to make use of a formatted time. This method can be overridden
    -        in formatters to provide for any specific requirement, but the
    -        basic behaviour is as follows: if datefmt (a string) is specified,
    -        it is used with time.strftime() to format the creation time of the
    -        record. Otherwise, an ISO8601-like (or RFC 3339-like) format is used.
    -        The resulting string is returned. This function uses a user-configurable
    -        function to convert the creation time to a tuple. By default,
    -        time.localtime() is used; to change this for a particular formatter
    -        instance, set the 'converter' attribute to a function with the same
    -        signature as time.localtime() or time.gmtime(). To change it for all
    -        formatters, for example if you want all logging times to be shown in GMT,
    -        set the 'converter' attribute in the Formatter class.
    -        """
    -        ct = self.converter(record.created)
    -        if datefmt:
    -            s = time.strftime(datefmt, ct)
    -        else:
    -            s = time.strftime(self.default_time_format, ct)
    -            if self.default_msec_format:
    -                s = self.default_msec_format % (s, record.msecs)
    -        return s
    -
    -    def formatException(self, ei):
    -        """
    -        Format and return the specified exception information as a string.
    -
    -        This default implementation just uses
    -        traceback.print_exception()
    -        """
    -        sio = io.StringIO()
    -        tb = ei[2]
    -        # See issues #9427, #1553375. Commented out for now.
    -        #if getattr(self, 'fullstack', False):
    -        #    traceback.print_stack(tb.tb_frame.f_back, file=sio)
    -        traceback.print_exception(ei[0], ei[1], tb, None, sio)
    -        s = sio.getvalue()
    -        sio.close()
    -        if s[-1:] == "\n":
    -            s = s[:-1]
    -        return s
    -
    -    def usesTime(self):
    -        """
    -        Check if the format uses the creation time of the record.
    -        """
    -        return self._style.usesTime()
    -
    -    def formatMessage(self, record):
    -        return self._style.format(record)
    -
    -    def formatStack(self, stack_info):
    -        """
    -        This method is provided as an extension point for specialized
    -        formatting of stack information.
    -
    -        The input data is a string as returned from a call to
    -        :func:`traceback.print_stack`, but with the last trailing newline
    -        removed.
    -
    -        The base implementation just returns the value passed in.
    -        """
    -        return stack_info
    -
    -    def format(self, record):
    -        """
    -        Format the specified record as text.
    -
    -        The record's attribute dictionary is used as the operand to a
    -        string formatting operation which yields the returned string.
    -        Before formatting the dictionary, a couple of preparatory steps
    -        are carried out. The message attribute of the record is computed
    -        using LogRecord.getMessage(). If the formatting string uses the
    -        time (as determined by a call to usesTime(), formatTime() is
    -        called to format the event time. If there is exception information,
    -        it is formatted using formatException() and appended to the message.
    -        """
    -        record.message = record.getMessage()
    -        if self.usesTime():
    -            record.asctime = self.formatTime(record, self.datefmt)
    -        s = self.formatMessage(record)
    -        if record.exc_info:
    -            # Cache the traceback text to avoid converting it multiple times
    -            # (it's constant anyway)
    -            if not record.exc_text:
    -                record.exc_text = self.formatException(record.exc_info)
    -        if record.exc_text:
    -            if s[-1:] != "\n":
    -                s = s + "\n"
    -            s = s + record.exc_text
    -        if record.stack_info:
    -            if s[-1:] != "\n":
    -                s = s + "\n"
    -            s = s + self.formatStack(record.stack_info)
    -        return s
    -
    -#
    -#   The default formatter to use when no other is specified
    -#
    -_defaultFormatter = Formatter()
    -
    -class BufferingFormatter(object):
    -    """
    -    A formatter suitable for formatting a number of records.
    -    """
    -    def __init__(self, linefmt=None):
    -        """
    -        Optionally specify a formatter which will be used to format each
    -        individual record.
    -        """
    -        if linefmt:
    -            self.linefmt = linefmt
    -        else:
    -            self.linefmt = _defaultFormatter
    -
    -    def formatHeader(self, records):
    -        """
    -        Return the header string for the specified records.
    -        """
    -        return ""
    -
    -    def formatFooter(self, records):
    -        """
    -        Return the footer string for the specified records.
    -        """
    -        return ""
    -
    -    def format(self, records):
    -        """
    -        Format the specified records and return the result as a string.
    -        """
    -        rv = ""
    -        if len(records) > 0:
    -            rv = rv + self.formatHeader(records)
    -            for record in records:
    -                rv = rv + self.linefmt.format(record)
    -            rv = rv + self.formatFooter(records)
    -        return rv
    -
    -#---------------------------------------------------------------------------
    -#   Filter classes and functions
    -#---------------------------------------------------------------------------
    -
    -class Filter(object):
    -    """
    -    Filter instances are used to perform arbitrary filtering of LogRecords.
    -
    -    Loggers and Handlers can optionally use Filter instances to filter
    -    records as desired. The base filter class only allows events which are
    -    below a certain point in the logger hierarchy. For example, a filter
    -    initialized with "A.B" will allow events logged by loggers "A.B",
    -    "A.B.C", "A.B.C.D", "A.B.D" etc. but not "A.BB", "B.A.B" etc. If
    -    initialized with the empty string, all events are passed.
    -    """
    -    def __init__(self, name=''):
    -        """
    -        Initialize a filter.
    -
    -        Initialize with the name of the logger which, together with its
    -        children, will have its events allowed through the filter. If no
    -        name is specified, allow every event.
    -        """
    -        self.name = name
    -        self.nlen = len(name)
    -
    -    def filter(self, record):
    -        """
    -        Determine if the specified record is to be logged.
    -
    -        Returns True if the record should be logged, or False otherwise.
    -        If deemed appropriate, the record may be modified in-place.
    -        """
    -        if self.nlen == 0:
    -            return True
    -        elif self.name == record.name:
    -            return True
    -        elif record.name.find(self.name, 0, self.nlen) != 0:
    -            return False
    -        return (record.name[self.nlen] == ".")
    -
    -class Filterer(object):
    -    """
    -    A base class for loggers and handlers which allows them to share
    -    common code.
    -    """
    -    def __init__(self):
    -        """
    -        Initialize the list of filters to be an empty list.
    -        """
    -        self.filters = []
    -
    -    def addFilter(self, filter):
    -        """
    -        Add the specified filter to this handler.
    -        """
    -        if not (filter in self.filters):
    -            self.filters.append(filter)
    -
    -    def removeFilter(self, filter):
    -        """
    -        Remove the specified filter from this handler.
    -        """
    -        if filter in self.filters:
    -            self.filters.remove(filter)
    -
    -    def filter(self, record):
    -        """
    -        Determine if a record is loggable by consulting all the filters.
    -
    -        The default is to allow the record to be logged; any filter can veto
    -        this by returning a false value.
    -        If a filter attached to a handler returns a log record instance,
    -        then that instance is used in place of the original log record in
    -        any further processing of the event by that handler.
    -        If a filter returns any other true value, the original log record
    -        is used in any further processing of the event by that handler.
    -
    -        If none of the filters return false values, this method returns
    -        a log record.
    -        If any of the filters return a false value, this method returns
    -        a false value.
    -
    -        .. versionchanged:: 3.2
    -
    -           Allow filters to be just callables.
    -
    -        .. versionchanged:: 3.12
    -           Allow filters to return a LogRecord instead of
    -           modifying it in place.
    -        """
    -        for f in self.filters:
    -            if hasattr(f, 'filter'):
    -                result = f.filter(record)
    -            else:
    -                result = f(record) # assume callable - will raise if not
    -            if not result:
    -                return False
    -            if isinstance(result, LogRecord):
    -                record = result
    -        return record
    -
    -#---------------------------------------------------------------------------
    -#   Handler classes and functions
    -#---------------------------------------------------------------------------
    -
    -_handlers = weakref.WeakValueDictionary()  #map of handler names to handlers
    -_handlerList = [] # added to allow handlers to be removed in reverse of order initialized
    -
    -def _removeHandlerRef(wr):
    -    """
    -    Remove a handler reference from the internal cleanup list.
    -    """
    -    # This function can be called during module teardown, when globals are
    -    # set to None. It can also be called from another thread. So we need to
    -    # pre-emptively grab the necessary globals and check if they're None,
    -    # to prevent race conditions and failures during interpreter shutdown.
    -    acquire, release, handlers = _acquireLock, _releaseLock, _handlerList
    -    if acquire and release and handlers:
    -        acquire()
    -        try:
    -            handlers.remove(wr)
    -        except ValueError:
    -            pass
    -        finally:
    -            release()
    -
    -def _addHandlerRef(handler):
    -    """
    -    Add a handler to the internal cleanup list using a weak reference.
    -    """
    -    _acquireLock()
    -    try:
    -        _handlerList.append(weakref.ref(handler, _removeHandlerRef))
    -    finally:
    -        _releaseLock()
    -
    -
    -def getHandlerByName(name):
    -    """
    -    Get a handler with the specified *name*, or None if there isn't one with
    -    that name.
    -    """
    -    return _handlers.get(name)
    -
    -
    -def getHandlerNames():
    -    """
    -    Return all known handler names as an immutable set.
    -    """
    -    result = set(_handlers.keys())
    -    return frozenset(result)
    -
    -
    -class Handler(Filterer):
    -    """
    -    Handler instances dispatch logging events to specific destinations.
    -
    -    The base handler class. Acts as a placeholder which defines the Handler
    -    interface. Handlers can optionally use Formatter instances to format
    -    records as desired. By default, no formatter is specified; in this case,
    -    the 'raw' message as determined by record.message is logged.
    -    """
    -    def __init__(self, level=NOTSET):
    -        """
    -        Initializes the instance - basically setting the formatter to None
    -        and the filter list to empty.
    -        """
    -        Filterer.__init__(self)
    -        self._name = None
    -        self.level = _checkLevel(level)
    -        self.formatter = None
    -        self._closed = False
    -        # Add the handler to the global _handlerList (for cleanup on shutdown)
    -        _addHandlerRef(self)
    -        self.createLock()
    -
    -    def get_name(self):
    -        return self._name
    -
    -    def set_name(self, name):
    -        _acquireLock()
    -        try:
    -            if self._name in _handlers:
    -                del _handlers[self._name]
    -            self._name = name
    -            if name:
    -                _handlers[name] = self
    -        finally:
    -            _releaseLock()
    -
    -    name = property(get_name, set_name)
    -
    -    def createLock(self):
    -        """
    -        Acquire a thread lock for serializing access to the underlying I/O.
    -        """
    -        self.lock = threading.RLock()
    -        _register_at_fork_reinit_lock(self)
    -
    -    def _at_fork_reinit(self):
    -        self.lock._at_fork_reinit()
    -
    -    def acquire(self):
    -        """
    -        Acquire the I/O thread lock.
    -        """
    -        if self.lock:
    -            self.lock.acquire()
    -
    -    def release(self):
    -        """
    -        Release the I/O thread lock.
    -        """
    -        if self.lock:
    -            self.lock.release()
    -
    -    def setLevel(self, level):
    -        """
    -        Set the logging level of this handler.  level must be an int or a str.
    -        """
    -        self.level = _checkLevel(level)
    -
    -    def format(self, record):
    -        """
    -        Format the specified record.
    -
    -        If a formatter is set, use it. Otherwise, use the default formatter
    -        for the module.
    -        """
    -        if self.formatter:
    -            fmt = self.formatter
    -        else:
    -            fmt = _defaultFormatter
    -        return fmt.format(record)
    -
    -    def emit(self, record):
    -        """
    -        Do whatever it takes to actually log the specified logging record.
    -
    -        This version is intended to be implemented by subclasses and so
    -        raises a NotImplementedError.
    -        """
    -        raise NotImplementedError('emit must be implemented '
    -                                  'by Handler subclasses')
    -
    -    def handle(self, record):
    -        """
    -        Conditionally emit the specified logging record.
    -
    -        Emission depends on filters which may have been added to the handler.
    -        Wrap the actual emission of the record with acquisition/release of
    -        the I/O thread lock.
    -
    -        Returns an instance of the log record that was emitted
    -        if it passed all filters, otherwise a false value is returned.
    -        """
    -        rv = self.filter(record)
    -        if isinstance(rv, LogRecord):
    -            record = rv
    -        if rv:
    -            self.acquire()
    -            try:
    -                self.emit(record)
    -            finally:
    -                self.release()
    -        return rv
    -
    -    def setFormatter(self, fmt):
    -        """
    -        Set the formatter for this handler.
    -        """
    -        self.formatter = fmt
    -
    -    def flush(self):
    -        """
    -        Ensure all logging output has been flushed.
    -
    -        This version does nothing and is intended to be implemented by
    -        subclasses.
    -        """
    -        pass
    -
    -    def close(self):
    -        """
    -        Tidy up any resources used by the handler.
    -
    -        This version removes the handler from an internal map of handlers,
    -        _handlers, which is used for handler lookup by name. Subclasses
    -        should ensure that this gets called from overridden close()
    -        methods.
    -        """
    -        #get the module data lock, as we're updating a shared structure.
    -        _acquireLock()
    -        try:    #unlikely to raise an exception, but you never know...
    -            self._closed = True
    -            if self._name and self._name in _handlers:
    -                del _handlers[self._name]
    -        finally:
    -            _releaseLock()
    -
    -    def handleError(self, record):
    -        """
    -        Handle errors which occur during an emit() call.
    -
    -        This method should be called from handlers when an exception is
    -        encountered during an emit() call. If raiseExceptions is false,
    -        exceptions get silently ignored. This is what is mostly wanted
    -        for a logging system - most users will not care about errors in
    -        the logging system, they are more interested in application errors.
    -        You could, however, replace this with a custom handler if you wish.
    -        The record which was being processed is passed in to this method.
    -        """
    -        if raiseExceptions and sys.stderr:  # see issue 13807
    -            t, v, tb = sys.exc_info()
    -            try:
    -                sys.stderr.write('--- Logging error ---\n')
    -                traceback.print_exception(t, v, tb, None, sys.stderr)
    -                sys.stderr.write('Call stack:\n')
    -                # Walk the stack frame up until we're out of logging,
    -                # so as to print the calling context.
    -                frame = tb.tb_frame
    -                while (frame and os.path.dirname(frame.f_code.co_filename) ==
    -                       __path__[0]):
    -                    frame = frame.f_back
    -                if frame:
    -                    traceback.print_stack(frame, file=sys.stderr)
    -                else:
    -                    # couldn't find the right stack frame, for some reason
    -                    sys.stderr.write('Logged from file %s, line %s\n' % (
    -                                     record.filename, record.lineno))
    -                # Issue 18671: output logging message and arguments
    -                try:
    -                    sys.stderr.write('Message: %r\n'
    -                                     'Arguments: %s\n' % (record.msg,
    -                                                          record.args))
    -                except RecursionError:  # See issue 36272
    -                    raise
    -                except Exception:
    -                    sys.stderr.write('Unable to print the message and arguments'
    -                                     ' - possible formatting error.\nUse the'
    -                                     ' traceback above to help find the error.\n'
    -                                    )
    -            except OSError: #pragma: no cover
    -                pass    # see issue 5971
    -            finally:
    -                del t, v, tb
    -
    -    def __repr__(self):
    -        level = getLevelName(self.level)
    -        return '<%s (%s)>' % (self.__class__.__name__, level)
    -
    -class StreamHandler(Handler):
    -    """
    -    A handler class which writes logging records, appropriately formatted,
    -    to a stream. Note that this class does not close the stream, as
    -    sys.stdout or sys.stderr may be used.
    -    """
    -
    -    terminator = '\n'
    -
    -    def __init__(self, stream=None):
    -        """
    -        Initialize the handler.
    -
    -        If stream is not specified, sys.stderr is used.
    -        """
    -        Handler.__init__(self)
    -        if stream is None:
    -            stream = sys.stderr
    -        self.stream = stream
    -
    -    def flush(self):
    -        """
    -        Flushes the stream.
    -        """
    -        self.acquire()
    -        try:
    -            if self.stream and hasattr(self.stream, "flush"):
    -                self.stream.flush()
    -        finally:
    -            self.release()
    -
    -    def emit(self, record):
    -        """
    -        Emit a record.
    -
    -        If a formatter is specified, it is used to format the record.
    -        The record is then written to the stream with a trailing newline.  If
    -        exception information is present, it is formatted using
    -        traceback.print_exception and appended to the stream.  If the stream
    -        has an 'encoding' attribute, it is used to determine how to do the
    -        output to the stream.
    -        """
    -        try:
    -            msg = self.format(record)
    -            stream = self.stream
    -            # issue 35046: merged two stream.writes into one.
    -            stream.write(msg + self.terminator)
    -            self.flush()
    -        except RecursionError:  # See issue 36272
    -            raise
    -        except Exception:
    -            self.handleError(record)
    -
    -    def setStream(self, stream):
    -        """
    -        Sets the StreamHandler's stream to the specified value,
    -        if it is different.
    -
    -        Returns the old stream, if the stream was changed, or None
    -        if it wasn't.
    -        """
    -        if stream is self.stream:
    -            result = None
    -        else:
    -            result = self.stream
    -            self.acquire()
    -            try:
    -                self.flush()
    -                self.stream = stream
    -            finally:
    -                self.release()
    -        return result
    -
    -    def __repr__(self):
    -        level = getLevelName(self.level)
    -        name = getattr(self.stream, 'name', '')
    -        #  bpo-36015: name can be an int
    -        name = str(name)
    -        if name:
    -            name += ' '
    -        return '<%s %s(%s)>' % (self.__class__.__name__, name, level)
    -
    -    __class_getitem__ = classmethod(GenericAlias)
    -
    -
    -class FileHandler(StreamHandler):
    -    """
    -    A handler class which writes formatted logging records to disk files.
    -    """
    -    def __init__(self, filename, mode='a', encoding=None, delay=False, errors=None):
    -        """
    -        Open the specified file and use it as the stream for logging.
    -        """
    -        # Issue #27493: add support for Path objects to be passed in
    -        filename = os.fspath(filename)
    -        #keep the absolute path, otherwise derived classes which use this
    -        #may come a cropper when the current directory changes
    -        self.baseFilename = os.path.abspath(filename)
    -        self.mode = mode
    -        self.encoding = encoding
    -        if "b" not in mode:
    -            self.encoding = io.text_encoding(encoding)
    -        self.errors = errors
    -        self.delay = delay
    -        # bpo-26789: FileHandler keeps a reference to the builtin open()
    -        # function to be able to open or reopen the file during Python
    -        # finalization.
    -        self._builtin_open = open
    -        if delay:
    -            #We don't open the stream, but we still need to call the
    -            #Handler constructor to set level, formatter, lock etc.
    -            Handler.__init__(self)
    -            self.stream = None
    -        else:
    -            StreamHandler.__init__(self, self._open())
    -
    -    def close(self):
    -        """
    -        Closes the stream.
    -        """
    -        self.acquire()
    -        try:
    -            try:
    -                if self.stream:
    -                    try:
    -                        self.flush()
    -                    finally:
    -                        stream = self.stream
    -                        self.stream = None
    -                        if hasattr(stream, "close"):
    -                            stream.close()
    -            finally:
    -                # Issue #19523: call unconditionally to
    -                # prevent a handler leak when delay is set
    -                # Also see Issue #42378: we also rely on
    -                # self._closed being set to True there
    -                StreamHandler.close(self)
    -        finally:
    -            self.release()
    -
    -    def _open(self):
    -        """
    -        Open the current base file with the (original) mode and encoding.
    -        Return the resulting stream.
    -        """
    -        open_func = self._builtin_open
    -        return open_func(self.baseFilename, self.mode,
    -                         encoding=self.encoding, errors=self.errors)
    -
    -    def emit(self, record):
    -        """
    -        Emit a record.
    -
    -        If the stream was not opened because 'delay' was specified in the
    -        constructor, open it before calling the superclass's emit.
    -
    -        If stream is not open, current mode is 'w' and `_closed=True`, record
    -        will not be emitted (see Issue #42378).
    -        """
    -        if self.stream is None:
    -            if self.mode != 'w' or not self._closed:
    -                self.stream = self._open()
    -        if self.stream:
    -            StreamHandler.emit(self, record)
    -
    -    def __repr__(self):
    -        level = getLevelName(self.level)
    -        return '<%s %s (%s)>' % (self.__class__.__name__, self.baseFilename, level)
    -
    -
    -class _StderrHandler(StreamHandler):
    -    """
    -    This class is like a StreamHandler using sys.stderr, but always uses
    -    whatever sys.stderr is currently set to rather than the value of
    -    sys.stderr at handler construction time.
    -    """
    -    def __init__(self, level=NOTSET):
    -        """
    -        Initialize the handler.
    -        """
    -        Handler.__init__(self, level)
    -
    -    @property
    -    def stream(self):
    -        return sys.stderr
    -
    -
    -_defaultLastResort = _StderrHandler(WARNING)
    -lastResort = _defaultLastResort
    -
    -#---------------------------------------------------------------------------
    -#   Manager classes and functions
    -#---------------------------------------------------------------------------
    -
    -class PlaceHolder(object):
    -    """
    -    PlaceHolder instances are used in the Manager logger hierarchy to take
    -    the place of nodes for which no loggers have been defined. This class is
    -    intended for internal use only and not as part of the public API.
    -    """
    -    def __init__(self, alogger):
    -        """
    -        Initialize with the specified logger being a child of this placeholder.
    -        """
    -        self.loggerMap = { alogger : None }
    -
    -    def append(self, alogger):
    -        """
    -        Add the specified logger as a child of this placeholder.
    -        """
    -        if alogger not in self.loggerMap:
    -            self.loggerMap[alogger] = None
    -
    -#
    -#   Determine which class to use when instantiating loggers.
    -#
    -
    -def setLoggerClass(klass):
    -    """
    -    Set the class to be used when instantiating a logger. The class should
    -    define __init__() such that only a name argument is required, and the
    -    __init__() should call Logger.__init__()
    -    """
    -    if klass != Logger:
    -        if not issubclass(klass, Logger):
    -            raise TypeError("logger not derived from logging.Logger: "
    -                            + klass.__name__)
    -    global _loggerClass
    -    _loggerClass = klass
    -
    -def getLoggerClass():
    -    """
    -    Return the class to be used when instantiating a logger.
    -    """
    -    return _loggerClass
    -
    -class Manager(object):
    -    """
    -    There is [under normal circumstances] just one Manager instance, which
    -    holds the hierarchy of loggers.
    -    """
    -    def __init__(self, rootnode):
    -        """
    -        Initialize the manager with the root node of the logger hierarchy.
    -        """
    -        self.root = rootnode
    -        self.disable = 0
    -        self.emittedNoHandlerWarning = False
    -        self.loggerDict = {}
    -        self.loggerClass = None
    -        self.logRecordFactory = None
    -
    -    @property
    -    def disable(self):
    -        return self._disable
    -
    -    @disable.setter
    -    def disable(self, value):
    -        self._disable = _checkLevel(value)
    -
    -    def getLogger(self, name):
    -        """
    -        Get a logger with the specified name (channel name), creating it
    -        if it doesn't yet exist. This name is a dot-separated hierarchical
    -        name, such as "a", "a.b", "a.b.c" or similar.
    -
    -        If a PlaceHolder existed for the specified name [i.e. the logger
    -        didn't exist but a child of it did], replace it with the created
    -        logger and fix up the parent/child references which pointed to the
    -        placeholder to now point to the logger.
    -        """
    -        rv = None
    -        if not isinstance(name, str):
    -            raise TypeError('A logger name must be a string')
    -        _acquireLock()
    -        try:
    -            if name in self.loggerDict:
    -                rv = self.loggerDict[name]
    -                if isinstance(rv, PlaceHolder):
    -                    ph = rv
    -                    rv = (self.loggerClass or _loggerClass)(name)
    -                    rv.manager = self
    -                    self.loggerDict[name] = rv
    -                    self._fixupChildren(ph, rv)
    -                    self._fixupParents(rv)
    -            else:
    -                rv = (self.loggerClass or _loggerClass)(name)
    -                rv.manager = self
    -                self.loggerDict[name] = rv
    -                self._fixupParents(rv)
    -        finally:
    -            _releaseLock()
    -        return rv
    -
    -    def setLoggerClass(self, klass):
    -        """
    -        Set the class to be used when instantiating a logger with this Manager.
    -        """
    -        if klass != Logger:
    -            if not issubclass(klass, Logger):
    -                raise TypeError("logger not derived from logging.Logger: "
    -                                + klass.__name__)
    -        self.loggerClass = klass
    -
    -    def setLogRecordFactory(self, factory):
    -        """
    -        Set the factory to be used when instantiating a log record with this
    -        Manager.
    -        """
    -        self.logRecordFactory = factory
    -
    -    def _fixupParents(self, alogger):
    -        """
    -        Ensure that there are either loggers or placeholders all the way
    -        from the specified logger to the root of the logger hierarchy.
    -        """
    -        name = alogger.name
    -        i = name.rfind(".")
    -        rv = None
    -        while (i > 0) and not rv:
    -            substr = name[:i]
    -            if substr not in self.loggerDict:
    -                self.loggerDict[substr] = PlaceHolder(alogger)
    -            else:
    -                obj = self.loggerDict[substr]
    -                if isinstance(obj, Logger):
    -                    rv = obj
    -                else:
    -                    assert isinstance(obj, PlaceHolder)
    -                    obj.append(alogger)
    -            i = name.rfind(".", 0, i - 1)
    -        if not rv:
    -            rv = self.root
    -        alogger.parent = rv
    -
    -    def _fixupChildren(self, ph, alogger):
    -        """
    -        Ensure that children of the placeholder ph are connected to the
    -        specified logger.
    -        """
    -        name = alogger.name
    -        namelen = len(name)
    -        for c in ph.loggerMap.keys():
    -            #The if means ... if not c.parent.name.startswith(nm)
    -            if c.parent.name[:namelen] != name:
    -                alogger.parent = c.parent
    -                c.parent = alogger
    -
    -    def _clear_cache(self):
    -        """
    -        Clear the cache for all loggers in loggerDict
    -        Called when level changes are made
    -        """
    -
    -        _acquireLock()
    -        for logger in self.loggerDict.values():
    -            if isinstance(logger, Logger):
    -                logger._cache.clear()
    -        self.root._cache.clear()
    -        _releaseLock()
    -
    -#---------------------------------------------------------------------------
    -#   Logger classes and functions
    -#---------------------------------------------------------------------------
    -
    -class Logger(Filterer):
    -    """
    -    Instances of the Logger class represent a single logging channel. A
    -    "logging channel" indicates an area of an application. Exactly how an
    -    "area" is defined is up to the application developer. Since an
    -    application can have any number of areas, logging channels are identified
    -    by a unique string. Application areas can be nested (e.g. an area
    -    of "input processing" might include sub-areas "read CSV files", "read
    -    XLS files" and "read Gnumeric files"). To cater for this natural nesting,
    -    channel names are organized into a namespace hierarchy where levels are
    -    separated by periods, much like the Java or Python package namespace. So
    -    in the instance given above, channel names might be "input" for the upper
    -    level, and "input.csv", "input.xls" and "input.gnu" for the sub-levels.
    -    There is no arbitrary limit to the depth of nesting.
    -    """
    -    def __init__(self, name, level=NOTSET):
    -        """
    -        Initialize the logger with a name and an optional level.
    -        """
    -        Filterer.__init__(self)
    -        self.name = name
    -        self.level = _checkLevel(level)
    -        self.parent = None
    -        self.propagate = True
    -        self.handlers = []
    -        self.disabled = False
    -        self._cache = {}
    -
    -    def setLevel(self, level):
    -        """
    -        Set the logging level of this logger.  level must be an int or a str.
    -        """
    -        self.level = _checkLevel(level)
    -        self.manager._clear_cache()
    -
    -    def debug(self, msg, *args, **kwargs):
    -        """
    -        Log 'msg % args' with severity 'DEBUG'.
    -
    -        To pass exception information, use the keyword argument exc_info with
    -        a true value, e.g.
    -
    -        logger.debug("Houston, we have a %s", "thorny problem", exc_info=True)
    -        """
    -        if self.isEnabledFor(DEBUG):
    -            self._log(DEBUG, msg, args, **kwargs)
    -
    -    def info(self, msg, *args, **kwargs):
    -        """
    -        Log 'msg % args' with severity 'INFO'.
    -
    -        To pass exception information, use the keyword argument exc_info with
    -        a true value, e.g.
    -
    -        logger.info("Houston, we have a %s", "notable problem", exc_info=True)
    -        """
    -        if self.isEnabledFor(INFO):
    -            self._log(INFO, msg, args, **kwargs)
    -
    -    def warning(self, msg, *args, **kwargs):
    -        """
    -        Log 'msg % args' with severity 'WARNING'.
    -
    -        To pass exception information, use the keyword argument exc_info with
    -        a true value, e.g.
    -
    -        logger.warning("Houston, we have a %s", "bit of a problem", exc_info=True)
    -        """
    -        if self.isEnabledFor(WARNING):
    -            self._log(WARNING, msg, args, **kwargs)
    -
    -    def warn(self, msg, *args, **kwargs):
    -        warnings.warn("The 'warn' method is deprecated, "
    -            "use 'warning' instead", DeprecationWarning, 2)
    -        self.warning(msg, *args, **kwargs)
    -
    -    def error(self, msg, *args, **kwargs):
    -        """
    -        Log 'msg % args' with severity 'ERROR'.
    -
    -        To pass exception information, use the keyword argument exc_info with
    -        a true value, e.g.
    -
    -        logger.error("Houston, we have a %s", "major problem", exc_info=True)
    -        """
    -        if self.isEnabledFor(ERROR):
    -            self._log(ERROR, msg, args, **kwargs)
    -
    -    def exception(self, msg, *args, exc_info=True, **kwargs):
    -        """
    -        Convenience method for logging an ERROR with exception information.
    -        """
    -        self.error(msg, *args, exc_info=exc_info, **kwargs)
    -
    -    def critical(self, msg, *args, **kwargs):
    -        """
    -        Log 'msg % args' with severity 'CRITICAL'.
    -
    -        To pass exception information, use the keyword argument exc_info with
    -        a true value, e.g.
    -
    -        logger.critical("Houston, we have a %s", "major disaster", exc_info=True)
    -        """
    -        if self.isEnabledFor(CRITICAL):
    -            self._log(CRITICAL, msg, args, **kwargs)
    -
    -    def fatal(self, msg, *args, **kwargs):
    -        """
    -        Don't use this method, use critical() instead.
    -        """
    -        self.critical(msg, *args, **kwargs)
    -
    -    def log(self, level, msg, *args, **kwargs):
    -        """
    -        Log 'msg % args' with the integer severity 'level'.
    -
    -        To pass exception information, use the keyword argument exc_info with
    -        a true value, e.g.
    -
    -        logger.log(level, "We have a %s", "mysterious problem", exc_info=True)
    -        """
    -        if not isinstance(level, int):
    -            if raiseExceptions:
    -                raise TypeError("level must be an integer")
    -            else:
    -                return
    -        if self.isEnabledFor(level):
    -            self._log(level, msg, args, **kwargs)
    -
    -    def findCaller(self, stack_info=False, stacklevel=1):
    -        """
    -        Find the stack frame of the caller so that we can note the source
    -        file name, line number and function name.
    -        """
    -        f = currentframe()
    -        #On some versions of IronPython, currentframe() returns None if
    -        #IronPython isn't run with -X:Frames.
    -        if f is None:
    -            return "(unknown file)", 0, "(unknown function)", None
    -        while stacklevel > 0:
    -            next_f = f.f_back
    -            if next_f is None:
    -                ## We've got options here.
    -                ## If we want to use the last (deepest) frame:
    -                break
    -                ## If we want to mimic the warnings module:
    -                #return ("sys", 1, "(unknown function)", None)
    -                ## If we want to be pedantic:
    -                #raise ValueError("call stack is not deep enough")
    -            f = next_f
    -            if not _is_internal_frame(f):
    -                stacklevel -= 1
    -        co = f.f_code
    -        sinfo = None
    -        if stack_info:
    -            with io.StringIO() as sio:
    -                sio.write("Stack (most recent call last):\n")
    -                traceback.print_stack(f, file=sio)
    -                sinfo = sio.getvalue()
    -                if sinfo[-1] == '\n':
    -                    sinfo = sinfo[:-1]
    -        return co.co_filename, f.f_lineno, co.co_name, sinfo
    -
    -    def makeRecord(self, name, level, fn, lno, msg, args, exc_info,
    -                   func=None, extra=None, sinfo=None):
    -        """
    -        A factory method which can be overridden in subclasses to create
    -        specialized LogRecords.
    -        """
    -        rv = _logRecordFactory(name, level, fn, lno, msg, args, exc_info, func,
    -                             sinfo)
    -        if extra is not None:
    -            for key in extra:
    -                if (key in ["message", "asctime"]) or (key in rv.__dict__):
    -                    raise KeyError("Attempt to overwrite %r in LogRecord" % key)
    -                rv.__dict__[key] = extra[key]
    -        return rv
    -
    -    def _log(self, level, msg, args, exc_info=None, extra=None, stack_info=False,
    -             stacklevel=1):
    -        """
    -        Low-level logging routine which creates a LogRecord and then calls
    -        all the handlers of this logger to handle the record.
    -        """
    -        sinfo = None
    -        if _srcfile:
    -            #IronPython doesn't track Python frames, so findCaller raises an
    -            #exception on some versions of IronPython. We trap it here so that
    -            #IronPython can use logging.
    -            try:
    -                fn, lno, func, sinfo = self.findCaller(stack_info, stacklevel)
    -            except ValueError: # pragma: no cover
    -                fn, lno, func = "(unknown file)", 0, "(unknown function)"
    -        else: # pragma: no cover
    -            fn, lno, func = "(unknown file)", 0, "(unknown function)"
    -        if exc_info:
    -            if isinstance(exc_info, BaseException):
    -                exc_info = (type(exc_info), exc_info, exc_info.__traceback__)
    -            elif not isinstance(exc_info, tuple):
    -                exc_info = sys.exc_info()
    -        record = self.makeRecord(self.name, level, fn, lno, msg, args,
    -                                 exc_info, func, extra, sinfo)
    -        self.handle(record)
    -
    -    def handle(self, record):
    -        """
    -        Call the handlers for the specified record.
    -
    -        This method is used for unpickled records received from a socket, as
    -        well as those created locally. Logger-level filtering is applied.
    -        """
    -        if self.disabled:
    -            return
    -        maybe_record = self.filter(record)
    -        if not maybe_record:
    -            return
    -        if isinstance(maybe_record, LogRecord):
    -            record = maybe_record
    -        self.callHandlers(record)
    -
    -    def addHandler(self, hdlr):
    -        """
    -        Add the specified handler to this logger.
    -        """
    -        _acquireLock()
    -        try:
    -            if not (hdlr in self.handlers):
    -                self.handlers.append(hdlr)
    -        finally:
    -            _releaseLock()
    -
    -    def removeHandler(self, hdlr):
    -        """
    -        Remove the specified handler from this logger.
    -        """
    -        _acquireLock()
    -        try:
    -            if hdlr in self.handlers:
    -                self.handlers.remove(hdlr)
    -        finally:
    -            _releaseLock()
    -
    -    def hasHandlers(self):
    -        """
    -        See if this logger has any handlers configured.
    -
    -        Loop through all handlers for this logger and its parents in the
    -        logger hierarchy. Return True if a handler was found, else False.
    -        Stop searching up the hierarchy whenever a logger with the "propagate"
    -        attribute set to zero is found - that will be the last logger which
    -        is checked for the existence of handlers.
    -        """
    -        c = self
    -        rv = False
    -        while c:
    -            if c.handlers:
    -                rv = True
    -                break
    -            if not c.propagate:
    -                break
    -            else:
    -                c = c.parent
    -        return rv
    -
    -    def callHandlers(self, record):
    -        """
    -        Pass a record to all relevant handlers.
    -
    -        Loop through all handlers for this logger and its parents in the
    -        logger hierarchy. If no handler was found, output a one-off error
    -        message to sys.stderr. Stop searching up the hierarchy whenever a
    -        logger with the "propagate" attribute set to zero is found - that
    -        will be the last logger whose handlers are called.
    -        """
    -        c = self
    -        found = 0
    -        while c:
    -            for hdlr in c.handlers:
    -                found = found + 1
    -                if record.levelno >= hdlr.level:
    -                    hdlr.handle(record)
    -            if not c.propagate:
    -                c = None    #break out
    -            else:
    -                c = c.parent
    -        if (found == 0):
    -            if lastResort:
    -                if record.levelno >= lastResort.level:
    -                    lastResort.handle(record)
    -            elif raiseExceptions and not self.manager.emittedNoHandlerWarning:
    -                sys.stderr.write("No handlers could be found for logger"
    -                                 " \"%s\"\n" % self.name)
    -                self.manager.emittedNoHandlerWarning = True
    -
    -    def getEffectiveLevel(self):
    -        """
    -        Get the effective level for this logger.
    -
    -        Loop through this logger and its parents in the logger hierarchy,
    -        looking for a non-zero logging level. Return the first one found.
    -        """
    -        logger = self
    -        while logger:
    -            if logger.level:
    -                return logger.level
    -            logger = logger.parent
    -        return NOTSET
    -
    -    def isEnabledFor(self, level):
    -        """
    -        Is this logger enabled for level 'level'?
    -        """
    -        if self.disabled:
    -            return False
    -
    -        try:
    -            return self._cache[level]
    -        except KeyError:
    -            _acquireLock()
    -            try:
    -                if self.manager.disable >= level:
    -                    is_enabled = self._cache[level] = False
    -                else:
    -                    is_enabled = self._cache[level] = (
    -                        level >= self.getEffectiveLevel()
    -                    )
    -            finally:
    -                _releaseLock()
    -            return is_enabled
    -
    -    def getChild(self, suffix):
    -        """
    -        Get a logger which is a descendant to this one.
    -
    -        This is a convenience method, such that
    -
    -        logging.getLogger('abc').getChild('def.ghi')
    -
    -        is the same as
    -
    -        logging.getLogger('abc.def.ghi')
    -
    -        It's useful, for example, when the parent logger is named using
    -        __name__ rather than a literal string.
    -        """
    -        if self.root is not self:
    -            suffix = '.'.join((self.name, suffix))
    -        return self.manager.getLogger(suffix)
    -
    -    def getChildren(self):
    -
    -        def _hierlevel(logger):
    -            if logger is logger.manager.root:
    -                return 0
    -            return 1 + logger.name.count('.')
    -
    -        d = self.manager.loggerDict
    -        _acquireLock()
    -        try:
    -            # exclude PlaceHolders - the last check is to ensure that lower-level
    -            # descendants aren't returned - if there are placeholders, a logger's
    -            # parent field might point to a grandparent or ancestor thereof.
    -            return set(item for item in d.values()
    -                       if isinstance(item, Logger) and item.parent is self and
    -                       _hierlevel(item) == 1 + _hierlevel(item.parent))
    -        finally:
    -            _releaseLock()
    -
    -    def __repr__(self):
    -        level = getLevelName(self.getEffectiveLevel())
    -        return '<%s %s (%s)>' % (self.__class__.__name__, self.name, level)
    -
    -    def __reduce__(self):
    -        if getLogger(self.name) is not self:
    -            import pickle
    -            raise pickle.PicklingError('logger cannot be pickled')
    -        return getLogger, (self.name,)
    -
    -
    -class RootLogger(Logger):
    -    """
    -    A root logger is not that different to any other logger, except that
    -    it must have a logging level and there is only one instance of it in
    -    the hierarchy.
    -    """
    -    def __init__(self, level):
    -        """
    -        Initialize the logger with the name "root".
    -        """
    -        Logger.__init__(self, "root", level)
    -
    -    def __reduce__(self):
    -        return getLogger, ()
    -
    -_loggerClass = Logger
    -
    -class LoggerAdapter(object):
    -    """
    -    An adapter for loggers which makes it easier to specify contextual
    -    information in logging output.
    -    """
    -
    -    def __init__(self, logger, extra=None):
    -        """
    -        Initialize the adapter with a logger and a dict-like object which
    -        provides contextual information. This constructor signature allows
    -        easy stacking of LoggerAdapters, if so desired.
    -
    -        You can effectively pass keyword arguments as shown in the
    -        following example:
    -
    -        adapter = LoggerAdapter(someLogger, dict(p1=v1, p2="v2"))
    -        """
    -        self.logger = logger
    -        self.extra = extra
    -
    -    def process(self, msg, kwargs):
    -        """
    -        Process the logging message and keyword arguments passed in to
    -        a logging call to insert contextual information. You can either
    -        manipulate the message itself, the keyword args or both. Return
    -        the message and kwargs modified (or not) to suit your needs.
    -
    -        Normally, you'll only need to override this one method in a
    -        LoggerAdapter subclass for your specific needs.
    -        """
    -        kwargs["extra"] = self.extra
    -        return msg, kwargs
    -
    -    #
    -    # Boilerplate convenience methods
    -    #
    -    def debug(self, msg, *args, **kwargs):
    -        """
    -        Delegate a debug call to the underlying logger.
    -        """
    -        self.log(DEBUG, msg, *args, **kwargs)
    -
    -    def info(self, msg, *args, **kwargs):
    -        """
    -        Delegate an info call to the underlying logger.
    -        """
    -        self.log(INFO, msg, *args, **kwargs)
    -
    -    def warning(self, msg, *args, **kwargs):
    -        """
    -        Delegate a warning call to the underlying logger.
    -        """
    -        self.log(WARNING, msg, *args, **kwargs)
    -
    -    def warn(self, msg, *args, **kwargs):
    -        warnings.warn("The 'warn' method is deprecated, "
    -            "use 'warning' instead", DeprecationWarning, 2)
    -        self.warning(msg, *args, **kwargs)
    -
    -    def error(self, msg, *args, **kwargs):
    -        """
    -        Delegate an error call to the underlying logger.
    -        """
    -        self.log(ERROR, msg, *args, **kwargs)
    -
    -    def exception(self, msg, *args, exc_info=True, **kwargs):
    -        """
    -        Delegate an exception call to the underlying logger.
    -        """
    -        self.log(ERROR, msg, *args, exc_info=exc_info, **kwargs)
    -
    -    def critical(self, msg, *args, **kwargs):
    -        """
    -        Delegate a critical call to the underlying logger.
    -        """
    -        self.log(CRITICAL, msg, *args, **kwargs)
    -
    -    def log(self, level, msg, *args, **kwargs):
    -        """
    -        Delegate a log call to the underlying logger, after adding
    -        contextual information from this adapter instance.
    -        """
    -        if self.isEnabledFor(level):
    -            msg, kwargs = self.process(msg, kwargs)
    -            self.logger.log(level, msg, *args, **kwargs)
    -
    -    def isEnabledFor(self, level):
    -        """
    -        Is this logger enabled for level 'level'?
    -        """
    -        return self.logger.isEnabledFor(level)
    -
    -    def setLevel(self, level):
    -        """
    -        Set the specified level on the underlying logger.
    -        """
    -        self.logger.setLevel(level)
    -
    -    def getEffectiveLevel(self):
    -        """
    -        Get the effective level for the underlying logger.
    -        """
    -        return self.logger.getEffectiveLevel()
    -
    -    def hasHandlers(self):
    -        """
    -        See if the underlying logger has any handlers.
    -        """
    -        return self.logger.hasHandlers()
    -
    -    def _log(self, level, msg, args, **kwargs):
    -        """
    -        Low-level log implementation, proxied to allow nested logger adapters.
    -        """
    -        return self.logger._log(level, msg, args, **kwargs)
    -
    -    @property
    -    def manager(self):
    -        return self.logger.manager
    -
    -    @manager.setter
    -    def manager(self, value):
    -        self.logger.manager = value
    -
    -    @property
    -    def name(self):
    -        return self.logger.name
    -
    -    def __repr__(self):
    -        logger = self.logger
    -        level = getLevelName(logger.getEffectiveLevel())
    -        return '<%s %s (%s)>' % (self.__class__.__name__, logger.name, level)
    -
    -    __class_getitem__ = classmethod(GenericAlias)
    -
    -root = RootLogger(WARNING)
    -Logger.root = root
    -Logger.manager = Manager(Logger.root)
    -
    -#---------------------------------------------------------------------------
    -# Configuration classes and functions
    -#---------------------------------------------------------------------------
    -
    -def basicConfig(**kwargs):
    -    """
    -    Do basic configuration for the logging system.
    -
    -    This function does nothing if the root logger already has handlers
    -    configured, unless the keyword argument *force* is set to ``True``.
    -    It is a convenience method intended for use by simple scripts
    -    to do one-shot configuration of the logging package.
    -
    -    The default behaviour is to create a StreamHandler which writes to
    -    sys.stderr, set a formatter using the BASIC_FORMAT format string, and
    -    add the handler to the root logger.
    -
    -    A number of optional keyword arguments may be specified, which can alter
    -    the default behaviour.
    -
    -    filename  Specifies that a FileHandler be created, using the specified
    -              filename, rather than a StreamHandler.
    -    filemode  Specifies the mode to open the file, if filename is specified
    -              (if filemode is unspecified, it defaults to 'a').
    -    format    Use the specified format string for the handler.
    -    datefmt   Use the specified date/time format.
    -    style     If a format string is specified, use this to specify the
    -              type of format string (possible values '%', '{', '$', for
    -              %-formatting, :meth:`str.format` and :class:`string.Template`
    -              - defaults to '%').
    -    level     Set the root logger level to the specified level.
    -    stream    Use the specified stream to initialize the StreamHandler. Note
    -              that this argument is incompatible with 'filename' - if both
    -              are present, 'stream' is ignored.
    -    handlers  If specified, this should be an iterable of already created
    -              handlers, which will be added to the root logger. Any handler
    -              in the list which does not have a formatter assigned will be
    -              assigned the formatter created in this function.
    -    force     If this keyword  is specified as true, any existing handlers
    -              attached to the root logger are removed and closed, before
    -              carrying out the configuration as specified by the other
    -              arguments.
    -    encoding  If specified together with a filename, this encoding is passed to
    -              the created FileHandler, causing it to be used when the file is
    -              opened.
    -    errors    If specified together with a filename, this value is passed to the
    -              created FileHandler, causing it to be used when the file is
    -              opened in text mode. If not specified, the default value is
    -              `backslashreplace`.
    -
    -    Note that you could specify a stream created using open(filename, mode)
    -    rather than passing the filename and mode in. However, it should be
    -    remembered that StreamHandler does not close its stream (since it may be
    -    using sys.stdout or sys.stderr), whereas FileHandler closes its stream
    -    when the handler is closed.
    -
    -    .. versionchanged:: 3.2
    -       Added the ``style`` parameter.
    -
    -    .. versionchanged:: 3.3
    -       Added the ``handlers`` parameter. A ``ValueError`` is now thrown for
    -       incompatible arguments (e.g. ``handlers`` specified together with
    -       ``filename``/``filemode``, or ``filename``/``filemode`` specified
    -       together with ``stream``, or ``handlers`` specified together with
    -       ``stream``.
    -
    -    .. versionchanged:: 3.8
    -       Added the ``force`` parameter.
    -
    -    .. versionchanged:: 3.9
    -       Added the ``encoding`` and ``errors`` parameters.
    -    """
    -    # Add thread safety in case someone mistakenly calls
    -    # basicConfig() from multiple threads
    -    _acquireLock()
    -    try:
    -        force = kwargs.pop('force', False)
    -        encoding = kwargs.pop('encoding', None)
    -        errors = kwargs.pop('errors', 'backslashreplace')
    -        if force:
    -            for h in root.handlers[:]:
    -                root.removeHandler(h)
    -                h.close()
    -        if len(root.handlers) == 0:
    -            handlers = kwargs.pop("handlers", None)
    -            if handlers is None:
    -                if "stream" in kwargs and "filename" in kwargs:
    -                    raise ValueError("'stream' and 'filename' should not be "
    -                                     "specified together")
    -            else:
    -                if "stream" in kwargs or "filename" in kwargs:
    -                    raise ValueError("'stream' or 'filename' should not be "
    -                                     "specified together with 'handlers'")
    -            if handlers is None:
    -                filename = kwargs.pop("filename", None)
    -                mode = kwargs.pop("filemode", 'a')
    -                if filename:
    -                    if 'b' in mode:
    -                        errors = None
    -                    else:
    -                        encoding = io.text_encoding(encoding)
    -                    h = FileHandler(filename, mode,
    -                                    encoding=encoding, errors=errors)
    -                else:
    -                    stream = kwargs.pop("stream", None)
    -                    h = StreamHandler(stream)
    -                handlers = [h]
    -            dfs = kwargs.pop("datefmt", None)
    -            style = kwargs.pop("style", '%')
    -            if style not in _STYLES:
    -                raise ValueError('Style must be one of: %s' % ','.join(
    -                                 _STYLES.keys()))
    -            fs = kwargs.pop("format", _STYLES[style][1])
    -            fmt = Formatter(fs, dfs, style)
    -            for h in handlers:
    -                if h.formatter is None:
    -                    h.setFormatter(fmt)
    -                root.addHandler(h)
    -            level = kwargs.pop("level", None)
    -            if level is not None:
    -                root.setLevel(level)
    -            if kwargs:
    -                keys = ', '.join(kwargs.keys())
    -                raise ValueError('Unrecognised argument(s): %s' % keys)
    -    finally:
    -        _releaseLock()
    -
    -#---------------------------------------------------------------------------
    -# Utility functions at module level.
    -# Basically delegate everything to the root logger.
    -#---------------------------------------------------------------------------
    -
    -def getLogger(name=None):
    -    """
    -    Return a logger with the specified name, creating it if necessary.
    -
    -    If no name is specified, return the root logger.
    -    """
    -    if not name or isinstance(name, str) and name == root.name:
    -        return root
    -    return Logger.manager.getLogger(name)
    -
    -def critical(msg, *args, **kwargs):
    -    """
    -    Log a message with severity 'CRITICAL' on the root logger. If the logger
    -    has no handlers, call basicConfig() to add a console handler with a
    -    pre-defined format.
    -    """
    -    if len(root.handlers) == 0:
    -        basicConfig()
    -    root.critical(msg, *args, **kwargs)
    -
    -def fatal(msg, *args, **kwargs):
    -    """
    -    Don't use this function, use critical() instead.
    -    """
    -    critical(msg, *args, **kwargs)
    -
    -def error(msg, *args, **kwargs):
    -    """
    -    Log a message with severity 'ERROR' on the root logger. If the logger has
    -    no handlers, call basicConfig() to add a console handler with a pre-defined
    -    format.
    -    """
    -    if len(root.handlers) == 0:
    -        basicConfig()
    -    root.error(msg, *args, **kwargs)
    -
    -def exception(msg, *args, exc_info=True, **kwargs):
    -    """
    -    Log a message with severity 'ERROR' on the root logger, with exception
    -    information. If the logger has no handlers, basicConfig() is called to add
    -    a console handler with a pre-defined format.
    -    """
    -    error(msg, *args, exc_info=exc_info, **kwargs)
    -
    -def warning(msg, *args, **kwargs):
    -    """
    -    Log a message with severity 'WARNING' on the root logger. If the logger has
    -    no handlers, call basicConfig() to add a console handler with a pre-defined
    -    format.
    -    """
    -    if len(root.handlers) == 0:
    -        basicConfig()
    -    root.warning(msg, *args, **kwargs)
    -
    -def warn(msg, *args, **kwargs):
    -    warnings.warn("The 'warn' function is deprecated, "
    -        "use 'warning' instead", DeprecationWarning, 2)
    -    warning(msg, *args, **kwargs)
    -
    -def info(msg, *args, **kwargs):
    -    """
    -    Log a message with severity 'INFO' on the root logger. If the logger has
    -    no handlers, call basicConfig() to add a console handler with a pre-defined
    -    format.
    -    """
    -    if len(root.handlers) == 0:
    -        basicConfig()
    -    root.info(msg, *args, **kwargs)
    -
    -def debug(msg, *args, **kwargs):
    -    """
    -    Log a message with severity 'DEBUG' on the root logger. If the logger has
    -    no handlers, call basicConfig() to add a console handler with a pre-defined
    -    format.
    -    """
    -    if len(root.handlers) == 0:
    -        basicConfig()
    -    root.debug(msg, *args, **kwargs)
    -
    -def log(level, msg, *args, **kwargs):
    -    """
    -    Log 'msg % args' with the integer severity 'level' on the root logger. If
    -    the logger has no handlers, call basicConfig() to add a console handler
    -    with a pre-defined format.
    -    """
    -    if len(root.handlers) == 0:
    -        basicConfig()
    -    root.log(level, msg, *args, **kwargs)
    -
    -def disable(level=CRITICAL):
    -    """
    -    Disable all logging calls of severity 'level' and below.
    -    """
    -    root.manager.disable = level
    -    root.manager._clear_cache()
    -
    -def shutdown(handlerList=_handlerList):
    -    """
    -    Perform any cleanup actions in the logging system (e.g. flushing
    -    buffers).
    -
    -    Should be called at application exit.
    -    """
    -    for wr in reversed(handlerList[:]):
    -        #errors might occur, for example, if files are locked
    -        #we just ignore them if raiseExceptions is not set
    -        try:
    -            h = wr()
    -            if h:
    -                try:
    -                    h.acquire()
    -                    # MemoryHandlers might not want to be flushed on close,
    -                    # but circular imports prevent us scoping this to just
    -                    # those handlers.  hence the default to True.
    -                    if getattr(h, 'flushOnClose', True):
    -                        h.flush()
    -                    h.close()
    -                except (OSError, ValueError):
    -                    # Ignore errors which might be caused
    -                    # because handlers have been closed but
    -                    # references to them are still around at
    -                    # application exit.
    -                    pass
    -                finally:
    -                    h.release()
    -        except: # ignore everything, as we're shutting down
    -            if raiseExceptions:
    -                raise
    -            #else, swallow
    -
    -#Let's try and shutdown automatically on application exit...
    -import atexit
    -atexit.register(shutdown)
    -
    -# Null handler
    -
    -class NullHandler(Handler):
    -    """
    -    This handler does nothing. It's intended to be used to avoid the
    -    "No handlers could be found for logger XXX" one-off warning. This is
    -    important for library code, which may contain code to log events. If a user
    -    of the library does not configure logging, the one-off warning might be
    -    produced; to avoid this, the library developer simply needs to instantiate
    -    a NullHandler and add it to the top-level logger of the library module or
    -    package.
    -    """
    -    def handle(self, record):
    -        """Stub."""
    -
    -    def emit(self, record):
    -        """Stub."""
    -
    -    def createLock(self):
    -        self.lock = None
    -
    -    def _at_fork_reinit(self):
    -        pass
    -
    -# Warnings integration
    -
    -_warnings_showwarning = None
    -
    -def _showwarning(message, category, filename, lineno, file=None, line=None):
    -    """
    -    Implementation of showwarnings which redirects to logging, which will first
    -    check to see if the file parameter is None. If a file is specified, it will
    -    delegate to the original warnings implementation of showwarning. Otherwise,
    -    it will call warnings.formatwarning and will log the resulting string to a
    -    warnings logger named "py.warnings" with level logging.WARNING.
    -    """
    -    if file is not None:
    -        if _warnings_showwarning is not None:
    -            _warnings_showwarning(message, category, filename, lineno, file, line)
    -    else:
    -        s = warnings.formatwarning(message, category, filename, lineno, line)
    -        logger = getLogger("py.warnings")
    -        if not logger.handlers:
    -            logger.addHandler(NullHandler())
    -        # bpo-46557: Log str(s) as msg instead of logger.warning("%s", s)
    -        # since some log aggregation tools group logs by the msg arg
    -        logger.warning(str(s))
    -
    -def captureWarnings(capture):
    -    """
    -    If capture is true, redirect all warnings to the logging package.
    -    If capture is False, ensure that warnings are not redirected to logging
    -    but to their original destinations.
    -    """
    -    global _warnings_showwarning
    -    if capture:
    -        if _warnings_showwarning is None:
    -            _warnings_showwarning = warnings.showwarning
    -            warnings.showwarning = _showwarning
    -    else:
    -        if _warnings_showwarning is not None:
    -            warnings.showwarning = _warnings_showwarning
    -            _warnings_showwarning = None
    -
    - -
    - -
    -
    - -
    -
    - - - - - - - \ No newline at end of file diff --git a/docs/build/html/_modules/re.html b/docs/build/html/_modules/re.html deleted file mode 100644 index 3c2eb8d..0000000 --- a/docs/build/html/_modules/re.html +++ /dev/null @@ -1,491 +0,0 @@ - - - - - - - re — CEL in Python documentation - - - - - - - - - - - - - - - - - - -
    -
    -
    - - -
    - -

    Source code for re

    -#
    -# Secret Labs' Regular Expression Engine
    -#
    -# re-compatible interface for the sre matching engine
    -#
    -# Copyright (c) 1998-2001 by Secret Labs AB.  All rights reserved.
    -#
    -# This version of the SRE library can be redistributed under CNRI's
    -# Python 1.6 license.  For any other use, please contact Secret Labs
    -# AB (info@pythonware.com).
    -#
    -# Portions of this engine have been developed in cooperation with
    -# CNRI.  Hewlett-Packard provided funding for 1.6 integration and
    -# other compatibility work.
    -#
    -
    -r"""Support for regular expressions (RE).
    -
    -This module provides regular expression matching operations similar to
    -those found in Perl.  It supports both 8-bit and Unicode strings; both
    -the pattern and the strings being processed can contain null bytes and
    -characters outside the US ASCII range.
    -
    -Regular expressions can contain both special and ordinary characters.
    -Most ordinary characters, like "A", "a", or "0", are the simplest
    -regular expressions; they simply match themselves.  You can
    -concatenate ordinary characters, so last matches the string 'last'.
    -
    -The special characters are:
    -    "."      Matches any character except a newline.
    -    "^"      Matches the start of the string.
    -    "$"      Matches the end of the string or just before the newline at
    -             the end of the string.
    -    "*"      Matches 0 or more (greedy) repetitions of the preceding RE.
    -             Greedy means that it will match as many repetitions as possible.
    -    "+"      Matches 1 or more (greedy) repetitions of the preceding RE.
    -    "?"      Matches 0 or 1 (greedy) of the preceding RE.
    -    *?,+?,?? Non-greedy versions of the previous three special characters.
    -    {m,n}    Matches from m to n repetitions of the preceding RE.
    -    {m,n}?   Non-greedy version of the above.
    -    "\\"     Either escapes special characters or signals a special sequence.
    -    []       Indicates a set of characters.
    -             A "^" as the first character indicates a complementing set.
    -    "|"      A|B, creates an RE that will match either A or B.
    -    (...)    Matches the RE inside the parentheses.
    -             The contents can be retrieved or matched later in the string.
    -    (?aiLmsux) The letters set the corresponding flags defined below.
    -    (?:...)  Non-grouping version of regular parentheses.
    -    (?P<name>...) The substring matched by the group is accessible by name.
    -    (?P=name)     Matches the text matched earlier by the group named name.
    -    (?#...)  A comment; ignored.
    -    (?=...)  Matches if ... matches next, but doesn't consume the string.
    -    (?!...)  Matches if ... doesn't match next.
    -    (?<=...) Matches if preceded by ... (must be fixed length).
    -    (?<!...) Matches if not preceded by ... (must be fixed length).
    -    (?(id/name)yes|no) Matches yes pattern if the group with id/name matched,
    -                       the (optional) no pattern otherwise.
    -
    -The special sequences consist of "\\" and a character from the list
    -below.  If the ordinary character is not on the list, then the
    -resulting RE will match the second character.
    -    \number  Matches the contents of the group of the same number.
    -    \A       Matches only at the start of the string.
    -    \Z       Matches only at the end of the string.
    -    \b       Matches the empty string, but only at the start or end of a word.
    -    \B       Matches the empty string, but not at the start or end of a word.
    -    \d       Matches any decimal digit; equivalent to the set [0-9] in
    -             bytes patterns or string patterns with the ASCII flag.
    -             In string patterns without the ASCII flag, it will match the whole
    -             range of Unicode digits.
    -    \D       Matches any non-digit character; equivalent to [^\d].
    -    \s       Matches any whitespace character; equivalent to [ \t\n\r\f\v] in
    -             bytes patterns or string patterns with the ASCII flag.
    -             In string patterns without the ASCII flag, it will match the whole
    -             range of Unicode whitespace characters.
    -    \S       Matches any non-whitespace character; equivalent to [^\s].
    -    \w       Matches any alphanumeric character; equivalent to [a-zA-Z0-9_]
    -             in bytes patterns or string patterns with the ASCII flag.
    -             In string patterns without the ASCII flag, it will match the
    -             range of Unicode alphanumeric characters (letters plus digits
    -             plus underscore).
    -             With LOCALE, it will match the set [0-9_] plus characters defined
    -             as letters for the current locale.
    -    \W       Matches the complement of \w.
    -    \\       Matches a literal backslash.
    -
    -This module exports the following functions:
    -    match     Match a regular expression pattern to the beginning of a string.
    -    fullmatch Match a regular expression pattern to all of a string.
    -    search    Search a string for the presence of a pattern.
    -    sub       Substitute occurrences of a pattern found in a string.
    -    subn      Same as sub, but also return the number of substitutions made.
    -    split     Split a string by the occurrences of a pattern.
    -    findall   Find all occurrences of a pattern in a string.
    -    finditer  Return an iterator yielding a Match object for each match.
    -    compile   Compile a pattern into a Pattern object.
    -    purge     Clear the regular expression cache.
    -    escape    Backslash all non-alphanumerics in a string.
    -
    -Each function other than purge and escape can take an optional 'flags' argument
    -consisting of one or more of the following module constants, joined by "|".
    -A, L, and U are mutually exclusive.
    -    A  ASCII       For string patterns, make \w, \W, \b, \B, \d, \D
    -                   match the corresponding ASCII character categories
    -                   (rather than the whole Unicode categories, which is the
    -                   default).
    -                   For bytes patterns, this flag is the only available
    -                   behaviour and needn't be specified.
    -    I  IGNORECASE  Perform case-insensitive matching.
    -    L  LOCALE      Make \w, \W, \b, \B, dependent on the current locale.
    -    M  MULTILINE   "^" matches the beginning of lines (after a newline)
    -                   as well as the string.
    -                   "$" matches the end of lines (before a newline) as well
    -                   as the end of the string.
    -    S  DOTALL      "." matches any character at all, including the newline.
    -    X  VERBOSE     Ignore whitespace and comments for nicer looking RE's.
    -    U  UNICODE     For compatibility only. Ignored for string patterns (it
    -                   is the default), and forbidden for bytes patterns.
    -
    -This module also defines an exception 'error'.
    -
    -"""
    -
    -import enum
    -from . import _compiler, _parser
    -import functools
    -import _sre
    -
    -
    -# public symbols
    -__all__ = [
    -    "match", "fullmatch", "search", "sub", "subn", "split",
    -    "findall", "finditer", "compile", "purge", "template", "escape",
    -    "error", "Pattern", "Match", "A", "I", "L", "M", "S", "X", "U",
    -    "ASCII", "IGNORECASE", "LOCALE", "MULTILINE", "DOTALL", "VERBOSE",
    -    "UNICODE", "NOFLAG", "RegexFlag",
    -]
    -
    -__version__ = "2.2.1"
    -
    -@enum.global_enum
    -@enum._simple_enum(enum.IntFlag, boundary=enum.KEEP)
    -class RegexFlag:
    -    NOFLAG = 0
    -    ASCII = A = _compiler.SRE_FLAG_ASCII # assume ascii "locale"
    -    IGNORECASE = I = _compiler.SRE_FLAG_IGNORECASE # ignore case
    -    LOCALE = L = _compiler.SRE_FLAG_LOCALE # assume current 8-bit locale
    -    UNICODE = U = _compiler.SRE_FLAG_UNICODE # assume unicode "locale"
    -    MULTILINE = M = _compiler.SRE_FLAG_MULTILINE # make anchors look for newline
    -    DOTALL = S = _compiler.SRE_FLAG_DOTALL # make dot match newline
    -    VERBOSE = X = _compiler.SRE_FLAG_VERBOSE # ignore whitespace and comments
    -    # sre extensions (experimental, don't rely on these)
    -    TEMPLATE = T = _compiler.SRE_FLAG_TEMPLATE # unknown purpose, deprecated
    -    DEBUG = _compiler.SRE_FLAG_DEBUG # dump pattern after compilation
    -    __str__ = object.__str__
    -    _numeric_repr_ = hex
    -
    -# sre exception
    -error = _compiler.error
    -
    -# --------------------------------------------------------------------
    -# public interface
    -
    -def match(pattern, string, flags=0):
    -    """Try to apply the pattern at the start of the string, returning
    -    a Match object, or None if no match was found."""
    -    return _compile(pattern, flags).match(string)
    -
    -def fullmatch(pattern, string, flags=0):
    -    """Try to apply the pattern to all of the string, returning
    -    a Match object, or None if no match was found."""
    -    return _compile(pattern, flags).fullmatch(string)
    -
    -def search(pattern, string, flags=0):
    -    """Scan through string looking for a match to the pattern, returning
    -    a Match object, or None if no match was found."""
    -    return _compile(pattern, flags).search(string)
    -
    -def sub(pattern, repl, string, count=0, flags=0):
    -    """Return the string obtained by replacing the leftmost
    -    non-overlapping occurrences of the pattern in string by the
    -    replacement repl.  repl can be either a string or a callable;
    -    if a string, backslash escapes in it are processed.  If it is
    -    a callable, it's passed the Match object and must return
    -    a replacement string to be used."""
    -    return _compile(pattern, flags).sub(repl, string, count)
    -
    -def subn(pattern, repl, string, count=0, flags=0):
    -    """Return a 2-tuple containing (new_string, number).
    -    new_string is the string obtained by replacing the leftmost
    -    non-overlapping occurrences of the pattern in the source
    -    string by the replacement repl.  number is the number of
    -    substitutions that were made. repl can be either a string or a
    -    callable; if a string, backslash escapes in it are processed.
    -    If it is a callable, it's passed the Match object and must
    -    return a replacement string to be used."""
    -    return _compile(pattern, flags).subn(repl, string, count)
    -
    -def split(pattern, string, maxsplit=0, flags=0):
    -    """Split the source string by the occurrences of the pattern,
    -    returning a list containing the resulting substrings.  If
    -    capturing parentheses are used in pattern, then the text of all
    -    groups in the pattern are also returned as part of the resulting
    -    list.  If maxsplit is nonzero, at most maxsplit splits occur,
    -    and the remainder of the string is returned as the final element
    -    of the list."""
    -    return _compile(pattern, flags).split(string, maxsplit)
    -
    -def findall(pattern, string, flags=0):
    -    """Return a list of all non-overlapping matches in the string.
    -
    -    If one or more capturing groups are present in the pattern, return
    -    a list of groups; this will be a list of tuples if the pattern
    -    has more than one group.
    -
    -    Empty matches are included in the result."""
    -    return _compile(pattern, flags).findall(string)
    -
    -def finditer(pattern, string, flags=0):
    -    """Return an iterator over all non-overlapping matches in the
    -    string.  For each match, the iterator returns a Match object.
    -
    -    Empty matches are included in the result."""
    -    return _compile(pattern, flags).finditer(string)
    -
    -def compile(pattern, flags=0):
    -    "Compile a regular expression pattern, returning a Pattern object."
    -    return _compile(pattern, flags)
    -
    -def purge():
    -    "Clear the regular expression caches"
    -    _cache.clear()
    -    _cache2.clear()
    -    _compile_template.cache_clear()
    -
    -def template(pattern, flags=0):
    -    "Compile a template pattern, returning a Pattern object, deprecated"
    -    import warnings
    -    warnings.warn("The re.template() function is deprecated "
    -                  "as it is an undocumented function "
    -                  "without an obvious purpose. "
    -                  "Use re.compile() instead.",
    -                  DeprecationWarning)
    -    with warnings.catch_warnings():
    -        warnings.simplefilter("ignore", DeprecationWarning)  # warn just once
    -        return _compile(pattern, flags|T)
    -
    -# SPECIAL_CHARS
    -# closing ')', '}' and ']'
    -# '-' (a range in character set)
    -# '&', '~', (extended character set operations)
    -# '#' (comment) and WHITESPACE (ignored) in verbose mode
    -_special_chars_map = {i: '\\' + chr(i) for i in b'()[]{}?*+-|^$\\.&~# \t\n\r\v\f'}
    -
    -def escape(pattern):
    -    """
    -    Escape special characters in a string.
    -    """
    -    if isinstance(pattern, str):
    -        return pattern.translate(_special_chars_map)
    -    else:
    -        pattern = str(pattern, 'latin1')
    -        return pattern.translate(_special_chars_map).encode('latin1')
    -
    -Pattern = type(_compiler.compile('', 0))
    -Match = type(_compiler.compile('', 0).match(''))
    -
    -# --------------------------------------------------------------------
    -# internals
    -
    -# Use the fact that dict keeps the insertion order.
    -# _cache2 uses the simple FIFO policy which has better latency.
    -# _cache uses the LRU policy which has better hit rate.
    -_cache = {}  # LRU
    -_cache2 = {}  # FIFO
    -_MAXCACHE = 512
    -_MAXCACHE2 = 256
    -assert _MAXCACHE2 < _MAXCACHE
    -
    -def _compile(pattern, flags):
    -    # internal: compile pattern
    -    if isinstance(flags, RegexFlag):
    -        flags = flags.value
    -    try:
    -        return _cache2[type(pattern), pattern, flags]
    -    except KeyError:
    -        pass
    -
    -    key = (type(pattern), pattern, flags)
    -    # Item in _cache should be moved to the end if found.
    -    p = _cache.pop(key, None)
    -    if p is None:
    -        if isinstance(pattern, Pattern):
    -            if flags:
    -                raise ValueError(
    -                    "cannot process flags argument with a compiled pattern")
    -            return pattern
    -        if not _compiler.isstring(pattern):
    -            raise TypeError("first argument must be string or compiled pattern")
    -        if flags & T:
    -            import warnings
    -            warnings.warn("The re.TEMPLATE/re.T flag is deprecated "
    -                    "as it is an undocumented flag "
    -                    "without an obvious purpose. "
    -                    "Don't use it.",
    -                    DeprecationWarning)
    -        p = _compiler.compile(pattern, flags)
    -        if flags & DEBUG:
    -            return p
    -        if len(_cache) >= _MAXCACHE:
    -            # Drop the least recently used item.
    -            # next(iter(_cache)) is known to have linear amortized time,
    -            # but it is used here to avoid a dependency from using OrderedDict.
    -            # For the small _MAXCACHE value it doesn't make much of a difference.
    -            try:
    -                del _cache[next(iter(_cache))]
    -            except (StopIteration, RuntimeError, KeyError):
    -                pass
    -    # Append to the end.
    -    _cache[key] = p
    -
    -    if len(_cache2) >= _MAXCACHE2:
    -        # Drop the oldest item.
    -        try:
    -            del _cache2[next(iter(_cache2))]
    -        except (StopIteration, RuntimeError, KeyError):
    -            pass
    -    _cache2[key] = p
    -    return p
    -
    -@functools.lru_cache(_MAXCACHE)
    -def _compile_template(pattern, repl):
    -    # internal: compile replacement pattern
    -    return _sre.template(pattern, _parser.parse_template(repl, pattern))
    -
    -# register myself for pickling
    -
    -import copyreg
    -
    -def _pickle(p):
    -    return _compile, (p.pattern, p.flags)
    -
    -copyreg.pickle(Pattern, _pickle, _compile)
    -
    -# --------------------------------------------------------------------
    -# experimental stuff (see python-dev discussions for details)
    -
    -class Scanner:
    -    def __init__(self, lexicon, flags=0):
    -        from ._constants import BRANCH, SUBPATTERN
    -        if isinstance(flags, RegexFlag):
    -            flags = flags.value
    -        self.lexicon = lexicon
    -        # combine phrases into a compound pattern
    -        p = []
    -        s = _parser.State()
    -        s.flags = flags
    -        for phrase, action in lexicon:
    -            gid = s.opengroup()
    -            p.append(_parser.SubPattern(s, [
    -                (SUBPATTERN, (gid, 0, 0, _parser.parse(phrase, flags))),
    -                ]))
    -            s.closegroup(gid, p[-1])
    -        p = _parser.SubPattern(s, [(BRANCH, (None, p))])
    -        self.scanner = _compiler.compile(p)
    -    def scan(self, string):
    -        result = []
    -        append = result.append
    -        match = self.scanner.scanner(string).match
    -        i = 0
    -        while True:
    -            m = match()
    -            if not m:
    -                break
    -            j = m.end()
    -            if i == j:
    -                break
    -            action = self.lexicon[m.lastindex-1][1]
    -            if callable(action):
    -                self.match = m
    -                action = action(self, m.group())
    -            if action is not None:
    -                append(action)
    -            i = j
    -        return result, string[i:]
    -
    - -
    - -
    -
    - -
    -
    - - - - - - - \ No newline at end of file diff --git a/docs/build/html/_plantuml/01/01f21512c6b94e19efccb4676b518bed63780ddd.png b/docs/build/html/_plantuml/01/01f21512c6b94e19efccb4676b518bed63780ddd.png index 080aa3a..aae22cc 100644 Binary files a/docs/build/html/_plantuml/01/01f21512c6b94e19efccb4676b518bed63780ddd.png and b/docs/build/html/_plantuml/01/01f21512c6b94e19efccb4676b518bed63780ddd.png differ diff --git a/docs/build/html/_plantuml/16/165a23eb11f806bdd308ffac47a78125152ade58.png b/docs/build/html/_plantuml/16/165a23eb11f806bdd308ffac47a78125152ade58.png index b02b306..358a2a1 100644 Binary files a/docs/build/html/_plantuml/16/165a23eb11f806bdd308ffac47a78125152ade58.png and b/docs/build/html/_plantuml/16/165a23eb11f806bdd308ffac47a78125152ade58.png differ diff --git a/docs/build/html/_plantuml/36/36fad8472301586150ff18c26187340f47bb62fa.png b/docs/build/html/_plantuml/36/36fad8472301586150ff18c26187340f47bb62fa.png index 1d2ec51..26cc6c5 100644 Binary files a/docs/build/html/_plantuml/36/36fad8472301586150ff18c26187340f47bb62fa.png and b/docs/build/html/_plantuml/36/36fad8472301586150ff18c26187340f47bb62fa.png differ diff --git a/docs/build/html/_plantuml/59/59894b154086c2a2ebe8ae46d280279ecce7cf8f.png b/docs/build/html/_plantuml/59/59894b154086c2a2ebe8ae46d280279ecce7cf8f.png deleted file mode 100644 index 16f9a9c..0000000 Binary files a/docs/build/html/_plantuml/59/59894b154086c2a2ebe8ae46d280279ecce7cf8f.png and /dev/null differ diff --git a/docs/build/html/_plantuml/60/60c95188891b5d1267db67bb61a17e9fd7c08060.png b/docs/build/html/_plantuml/60/60c95188891b5d1267db67bb61a17e9fd7c08060.png index cb501f6..864e2d8 100644 Binary files a/docs/build/html/_plantuml/60/60c95188891b5d1267db67bb61a17e9fd7c08060.png and b/docs/build/html/_plantuml/60/60c95188891b5d1267db67bb61a17e9fd7c08060.png differ diff --git a/docs/build/html/_plantuml/60/60c95188891b5d1267db67bb61a17e9fd7c08060.png.newa1v5axm0 b/docs/build/html/_plantuml/60/60c95188891b5d1267db67bb61a17e9fd7c08060.png.newa1v5axm0 deleted file mode 100644 index e69de29..0000000 diff --git a/docs/build/html/_plantuml/60/60c95188891b5d1267db67bb61a17e9fd7c08060.png.newlpv3pfrv b/docs/build/html/_plantuml/60/60c95188891b5d1267db67bb61a17e9fd7c08060.png.newlpv3pfrv deleted file mode 100644 index e69de29..0000000 diff --git a/docs/build/html/_plantuml/60/60c95188891b5d1267db67bb61a17e9fd7c08060.png.newv2qg6lg_ b/docs/build/html/_plantuml/60/60c95188891b5d1267db67bb61a17e9fd7c08060.png.newv2qg6lg_ deleted file mode 100644 index e69de29..0000000 diff --git a/docs/build/html/_plantuml/a8/a8a77cea7a1f2555dbb1cb6cea10dc21777c76bf.png b/docs/build/html/_plantuml/a8/a8a77cea7a1f2555dbb1cb6cea10dc21777c76bf.png deleted file mode 100644 index 96c3652..0000000 Binary files a/docs/build/html/_plantuml/a8/a8a77cea7a1f2555dbb1cb6cea10dc21777c76bf.png and /dev/null differ diff --git a/docs/build/html/_plantuml/a8/a8a77cea7a1f2555dbb1cb6cea10dc21777c76bf.png.new1cmjxeth b/docs/build/html/_plantuml/a8/a8a77cea7a1f2555dbb1cb6cea10dc21777c76bf.png.new1cmjxeth deleted file mode 100644 index e69de29..0000000 diff --git a/docs/build/html/_plantuml/a8/a8a77cea7a1f2555dbb1cb6cea10dc21777c76bf.png.new4bry_4gw b/docs/build/html/_plantuml/a8/a8a77cea7a1f2555dbb1cb6cea10dc21777c76bf.png.new4bry_4gw deleted file mode 100644 index e69de29..0000000 diff --git a/docs/build/html/_plantuml/a8/a8a77cea7a1f2555dbb1cb6cea10dc21777c76bf.png.new58drlmt5 b/docs/build/html/_plantuml/a8/a8a77cea7a1f2555dbb1cb6cea10dc21777c76bf.png.new58drlmt5 deleted file mode 100644 index e69de29..0000000 diff --git a/docs/build/html/_plantuml/ac/ac649ac296fc6bea0cee4f6cb2d92533640e6763.png b/docs/build/html/_plantuml/ac/ac649ac296fc6bea0cee4f6cb2d92533640e6763.png index 391d74a..54ec932 100644 Binary files a/docs/build/html/_plantuml/ac/ac649ac296fc6bea0cee4f6cb2d92533640e6763.png and b/docs/build/html/_plantuml/ac/ac649ac296fc6bea0cee4f6cb2d92533640e6763.png differ diff --git a/docs/build/html/_plantuml/c9/c970d97dc7e0a41eb7666fff5d466440fc8d67cf.png b/docs/build/html/_plantuml/c9/c970d97dc7e0a41eb7666fff5d466440fc8d67cf.png index 75c2ffd..daecd76 100644 Binary files a/docs/build/html/_plantuml/c9/c970d97dc7e0a41eb7666fff5d466440fc8d67cf.png and b/docs/build/html/_plantuml/c9/c970d97dc7e0a41eb7666fff5d466440fc8d67cf.png differ diff --git a/docs/build/html/_sources/development.rst.txt b/docs/build/html/_sources/development.rst.txt index 02a00f3..a4c89fd 100644 --- a/docs/build/html/_sources/development.rst.txt +++ b/docs/build/html/_sources/development.rst.txt @@ -19,141 +19,18 @@ Any changes must be reflected (manually) by revising the lark version of the EBN The test cases present a more challenging problem. -A tool, ``pb2g.py``, converts the test cases from Protobuf messages to Gherkin scenarios. +A tool, ``gherkinize.py``, converts the test cases from Protobuf messages to Gherkin scenarios. -.. uml:: +The ``gherkinize.py`` Tool +========================== - @startuml +.. automodule:: gherkinize + :no-members: + :members: Config - file source as "source protobuf test cases" - file features as "Gherkin feature files" - source --> [pb2g.py] - [pb2g.py] --> [Docker] : "Uses" - [Docker] ..> [mkgherkin.go] : "Runs" - [pb2g.py] --> features - @enduml - - -The pb2g Tool -============== - -The ``pb2g.py`` Python application converts a protobuf test case collection into a Gherkin Feature file. -These can be used to update the ``features`` directory. - -SYNOPSIS ---------- - -.. program:: python tools/pb2g.py [-g docker|local] [-o output] [-sv] source - -.. option:: -g , --gherkinizer , --output - - Where to write the feature file. - Generally, it's helpful to have the ``.textproto`` and ``.feature`` stems match. - The ``Makefile`` assures this. - -.. option:: -s, --silent - - No console output is produced - -.. option:: -v, --verbose - - Verbose debugging output on the console. - -.. option:: source - - A source ``.textproto`` file. - This is often the path to a file in a local download of https://github.com/google/cel-spec/tree/master/tests/simple/testdata. - - A URL for the source is **not** supported. - - -DESCRIPTION ------------ - -Convert one ``.textproto`` file to a Gherkin ``.feature`` file. -There are two steps to the conversion: - -1. Rewrite the ``.textproto`` into JSON. - This relies on common Go libraries, and is little more than a syntactic conversion. - -2. Rewrite the JSON copy of the ``.textproto`` into Gherkin. - This a little more fraught with special cases and exceptions. - The ``.textproto`` semantics can be confusing. - -FILES ------ - -:source: - A ``.textproto`` test case file from the CEL-spec repository. - -:output: - A ``.feature`` file with the same stem as the source file is written to the output directory. - ``basic.textproto`` will create ``basic.feature``. - -:interim: - An interim JSON-format file is created and deleted. - These are only visible in the event of a fatal error creating the Gherkin output. - -EXAMPLES --------- - -The ``basic.textproto`` starts like this: - -.. code-block:: protobuf - - name: "basic" - description: "Basic conformance tests that all implementations should pass." - section { - name: "self_eval_zeroish" - description: "Simple self-evaluating forms to zero-ish values." - test { - name: "self_eval_int_zero" - expr: "0" - value: { int64_value: 0 } - } - test { - name: "self_eval_uint_zero" - expr: "0u" - value: { uint64_value: 0 } - } - -The Feature file created looks like this: - -.. code-block:: gherkin - - Feature: basic - Basic conformance tests that all implementations should pass. - - # self_eval_zeroish -- Simple self-evaluating forms to zero-ish values. - - Scenario: self_eval_int_zero - - When CEL expression "0" is evaluated - # int64_value:0 - Then value is IntType(source=0) - - - Scenario: self_eval_uint_zero - - When CEL expression "0u" is evaluated - # uint64_value:0 - Then value is UintType(source=0) - -The source files have a "section" heading which doesn't have a precise parallel in the Gherkin language. -The sections become comments in the Feature file. +The ``features/steps`` Directory +================================ The ``features/steps`` directory has step definition modules that implement the ``Given``, ``When``, and ``Then`` clauses. @@ -168,62 +45,18 @@ The ``features/steps`` directory has step definition modules that implement the .. py:module:: features.steps.integration_binding - Provides step definitions for the features generated by the ``pb2g.py`` tool. + Provides step definitions for the features generated by the ``gherkinize.py`` tool. The ``features/Makefile`` ========================= This Makefile has the following targets: -:%.textproto: - This copies textproto files from the source directory - to the ``features`` directory. - The source is defined by the :envvar:`CEL_SIMPLE_TESTDATA` environment variable. - This will overwrite out-of-date files in the ``features`` directory. - - It's important to use **git** wisely and start with a clean branch of the project so changes can be rolled back. - -:%.feature: - This creates the ``.feature`` file from the ``.textproto`` file. - -:scan: - This phony target reads **all** of the ``.textproto`` files to be sure they can be converted to Gherkin. - If it concludes with the output ``"All files scanned successfully"``, then there are no surprising or unexpected features in the ``.textproto`` files. - -:clean-broken: - This phony target removes empty ``.feature`` files that may be left over when the conversion process crashes with a fatal error. - -:clean-features: - This phony target removes all of the ``.textproto``\ -based ``.feature`` files. - Manually created ``.feature`` files are left intact. - -:clean: - This phony target removes all ``.textproto`` and ``.feature`` files that are built from the CEL specification. - Manually created ``.feature`` files are left intact. +.. program-output:: make -C ../../features help Currently, the following feature files are built from the CEL specification. -.. code-block:: bash - - basic.feature - comparisons.feature - conversions.feature - dynamic.feature - enums.feature - fields.feature - fp_math.feature - integer_math.feature - lists.feature - logic.feature - macros.feature - namespace.feature - parse.feature - plumbing.feature - proto2.feature - proto3.feature - string.feature - timestamps.feature - unknowns.feature +.. program-output:: make -C ../../features conformance-feature-list The ``docs/Makefile`` ===================== @@ -231,58 +64,11 @@ The ``docs/Makefile`` This is a Sphinx ``Makefile`` to build documentation. For more information, see https://www.sphinx-doc.org/en/master/index.html +.. program-output:: make -C ../ help + The Project ``Makefile`` -========================= +======================== A top-level Makefile has a number of phony targets: -:build: - Runs ``uv build`` to create a distribution kit. - -:install-tools: - Pulls a ``golang`` Docker image and builds the ``mkgherkin`` image. - -:test: - Runs the Python 3.12 test environment to execute a quick test. - -:test-all: - Update the ``features`` files and run the full test suite. - -:test-wip: - Update the ``features`` files and run the WIP test environment -- these are tests flagged with @WIP markers. - -:test-tools: - Run a test of only the tools, then scan the ``features`` files to be sure they're still valid after the tool change. - -:docs: - Build the HTML documentation. - -:lint: - Runs the ``lint`` test environment to get code coverage, type hint checking, and other lint checks. - -:coverage: - Reproduce the most recent coverage report. - -:clean: - Remove a number of directories and their files: - - - ``.tox`` - - - ``.Python`` - - - ``bin`` - - - ``include`` - - - ``lib`` - - - ``pip-selfcheck`` - - - ``.json`` - -:benchmarks: - Run the applications in the ``benches`` directory to gather performance benchmark data. - - - ``large_resource_set.py`` - - - ``complex_expression.py`` +.. program-output:: make -C ../../ help diff --git a/docs/build/html/_static/basic.css b/docs/build/html/_static/basic.css index 0028826..d9846da 100644 --- a/docs/build/html/_static/basic.css +++ b/docs/build/html/_static/basic.css @@ -741,6 +741,14 @@ abbr, acronym { cursor: help; } +.translated { + background-color: rgba(207, 255, 207, 0.2) +} + +.untranslated { + background-color: rgba(255, 207, 207, 0.2) +} + /* -- code displays --------------------------------------------------------- */ pre { diff --git a/docs/build/html/_static/searchtools.js b/docs/build/html/_static/searchtools.js index 91f4be5..2c774d1 100644 --- a/docs/build/html/_static/searchtools.js +++ b/docs/build/html/_static/searchtools.js @@ -513,11 +513,9 @@ const Search = { // perform the search on the required terms searchTerms.forEach((word) => { const files = []; - // find documents, if any, containing the query word in their text/title term indices - // use Object.hasOwnProperty to avoid mismatching against prototype properties const arr = [ - { files: terms.hasOwnProperty(word) ? terms[word] : undefined, score: Scorer.term }, - { files: titleTerms.hasOwnProperty(word) ? titleTerms[word] : undefined, score: Scorer.title }, + { files: terms[word], score: Scorer.term }, + { files: titleTerms[word], score: Scorer.title }, ]; // add support for partial matches if (word.length > 2) { @@ -549,9 +547,8 @@ const Search = { // set score for the word in each file recordFiles.forEach((file) => { - if (!scoreMap.has(file)) scoreMap.set(file, new Map()); - const fileScores = scoreMap.get(file); - fileScores.set(word, record.score); + if (!scoreMap.has(file)) scoreMap.set(file, {}); + scoreMap.get(file)[word] = record.score; }); }); @@ -590,7 +587,7 @@ const Search = { break; // select one (max) score for the file. - const score = Math.max(...wordList.map((w) => scoreMap.get(file).get(w))); + const score = Math.max(...wordList.map((w) => scoreMap.get(file)[w])); // add result to the result list results.push([ docNames[file], diff --git a/docs/build/html/api.html b/docs/build/html/api.html index 23893af..0adc30d 100644 --- a/docs/build/html/api.html +++ b/docs/build/html/api.html @@ -7,7 +7,7 @@ API Reference — CEL in Python documentation - + @@ -73,7 +73,7 @@
    -class celpy.__init__.Runner(environment: Environment, ast: Tree, functions: Dict[str, Callable[[...], BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType | CELEvalError | Type[BoolType] | Type[BytesType] | Type[DoubleType] | Type[DurationType] | Type[IntType] | Type[ListType] | Type[MapType] | Callable[[...], None] | Type[StringType] | Type[TimestampType] | Type[TypeType] | Type[UintType] | Type[PackageType] | Type[MessageType]]] | None = None)[source]
    +class celpy.__init__.Runner(environment: Environment, ast: Tree, functions: Dict[str, Callable[[...], BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType | CELEvalError | Type[BoolType] | Type[BytesType] | Type[DoubleType] | Type[DurationType] | Type[IntType] | Type[ListType] | Type[MapType] | Callable[[...], None] | Type[StringType] | Type[TimestampType] | Type[TypeType] | Type[UintType] | Type[PackageType] | Type[MessageType]]] | None = None)[source]

    Abstract runner for a compiled CEL program.

    The Environment creates Runner objects to permit saving a ready-tp-evaluate, compiled CEL expression. @@ -117,7 +117,7 @@

    -abstractmethod evaluate(activation: Mapping[str, BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType | CELEvalError | Type[BoolType] | Type[BytesType] | Type[DoubleType] | Type[DurationType] | Type[IntType] | Type[ListType] | Type[MapType] | Callable[[...], None] | Type[StringType] | Type[TimestampType] | Type[TypeType] | Type[UintType] | Type[PackageType] | Type[MessageType] | NameContainer | CELFunction]) BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType[source]
    +abstract evaluate(activation: Mapping[str, BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType | CELEvalError | Type[BoolType] | Type[BytesType] | Type[DoubleType] | Type[DurationType] | Type[IntType] | Type[ListType] | Type[MapType] | Callable[[...], None] | Type[StringType] | Type[TimestampType] | Type[TypeType] | Type[UintType] | Type[PackageType] | Type[MessageType] | NameContainer | CELFunction]) BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType[source]

    Given variable definitions in the celpy.evaluation.Context, evaluate the given AST and return the resulting value.

    Generally, this should raise an celpy.evaluation.CELEvalError for most kinds of ordinary problems. It may raise an celpy.evaluation.CELUnsupportedError for future features that aren’t fully implemented. @@ -144,7 +144,7 @@

    -class celpy.__init__.InterpretedRunner(environment: Environment, ast: Tree, functions: Dict[str, Callable[[...], BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType | CELEvalError | Type[BoolType] | Type[BytesType] | Type[DoubleType] | Type[DurationType] | Type[IntType] | Type[ListType] | Type[MapType] | Callable[[...], None] | Type[StringType] | Type[TimestampType] | Type[TypeType] | Type[UintType] | Type[PackageType] | Type[MessageType]]] | None = None)[source]
    +class celpy.__init__.InterpretedRunner(environment: Environment, ast: Tree, functions: Dict[str, Callable[[...], BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType | CELEvalError | Type[BoolType] | Type[BytesType] | Type[DoubleType] | Type[DurationType] | Type[IntType] | Type[ListType] | Type[MapType] | Callable[[...], None] | Type[StringType] | Type[TimestampType] | Type[TypeType] | Type[UintType] | Type[PackageType] | Type[MessageType]]] | None = None)[source]

    An Adapter for the celpy.evaluation.Evaluator class.

    @@ -175,7 +175,7 @@
    -class celpy.__init__.CompiledRunner(environment: Environment, ast: TranspilerTree, functions: Dict[str, Callable[[...], BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType | CELEvalError | Type[BoolType] | Type[BytesType] | Type[DoubleType] | Type[DurationType] | Type[IntType] | Type[ListType] | Type[MapType] | Callable[[...], None] | Type[StringType] | Type[TimestampType] | Type[TypeType] | Type[UintType] | Type[PackageType] | Type[MessageType]]] | None = None)[source]
    +class celpy.__init__.CompiledRunner(environment: Environment, ast: TranspilerTree, functions: Dict[str, Callable[[...], BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType | CELEvalError | Type[BoolType] | Type[BytesType] | Type[DoubleType] | Type[DurationType] | Type[IntType] | Type[ListType] | Type[MapType] | Callable[[...], None] | Type[StringType] | Type[TimestampType] | Type[TypeType] | Type[UintType] | Type[PackageType] | Type[MessageType]]] | None = None)[source]

    An Adapter for the celpy.evaluation.Transpiler class.

    A celpy.evaluation.Transpiler instance transforms the AST into Python. It uses compile() to create a code object. @@ -209,11 +209,11 @@

    -class celpy.__init__.Int32Value(value: Any = 0)[source]
    +class celpy.__init__.Int32Value(value: Any = 0)[source]

    A wrapper for int32 values.

    -static __new__(cls: Type[Int32Value], value: Any = 0) Int32Value[source]
    +static __new__(cls: Type[Int32Value], value: Any = 0) Int32Value[source]

    TODO: Check range. This seems to matter for protobuf.

    @@ -221,7 +221,7 @@
    -class celpy.__init__.Environment(package: str | None = None, annotations: Dict[str, TypeType | Callable[[...], BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType] | Type[FunctionType]] | None = None, runner_class: Type[Runner] | None = None)[source]
    +class celpy.__init__.Environment(package: str | None = None, annotations: Dict[str, TypeType | Callable[[...], BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType] | Type[FunctionType]] | None = None, runner_class: Type[Runner] | None = None)[source]

    Contains the current evaluation context.

    CEL integration starts by creating an Environment object. This can be initialized with three optional values:

    @@ -365,7 +365,7 @@
    -class celpy.__main__.CEL_REPL(completekey='tab', stdin=None, stdout=None)[source]
    +class celpy.__main__.CEL_REPL(completekey='tab', stdin=None, stdout=None)[source]
    prompt = 'CEL> '
    @@ -475,14 +475,14 @@ additional types or extensions to celpy.celtypes.

    -class celpy.adapter.CELJSONEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]
    +class celpy.adapter.CELJSONEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]

    An Encoder to export CEL objects as JSON text.

    This is not a reversible transformation. Some things are coerced to strings without any more detailed type marker. Specifically timestamps, durations, and bytes.

    -static to_python(cel_object: BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType) BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType | List[Any] | Dict[Any, Any] | bool[source]
    +static to_python(cel_object: BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType) BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType | List[Any] | Dict[Any, Any] | bool[source]

    Recursive walk through the CEL object, replacing BoolType with native bool instances. This lets the json module correctly represent the obects with JSON true and false.

    @@ -513,7 +513,7 @@ else: return list(iterable) # Let the base class default method raise the TypeError - return super().default(o) + return JSONEncoder.default(self, o)
    @@ -522,14 +522,14 @@
    -class celpy.adapter.CELJSONDecoder(*, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, strict=True, object_pairs_hook=None)[source]
    +class celpy.adapter.CELJSONDecoder(*, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, strict=True, object_pairs_hook=None)[source]

    An Encoder to import CEL objects from JSON to the extent possible.

    This does not handle non-JSON types in any form. Coercion from string to TimestampType or DurationType or BytesType is handled by celtype constructors.

    -decode(source: str, _w: Any = None) Any[source]
    +decode(source: str, _w: Any | None = None) Any[source]

    Return the Python representation of s (a str instance containing a JSON document).

    @@ -842,7 +842,7 @@

    Name Resolution
    -class celpy.c7nlib.C7NContext(filter: Any)[source]
    +class celpy.c7nlib.C7NContext(filter: Any)[source]

    Saves current C7N filter for use by functions in this module.

    This is essential for making C7N filter available to some of these functions.

    with C7NContext(filter):
    @@ -936,7 +936,7 @@ 

    Name Resolution
    -class celpy.c7nlib.IPv4Network(address, strict=True)[source]
    +class celpy.c7nlib.IPv4Network(address, strict=True)[source]
    __contains__(other)[source]
    @@ -965,7 +965,7 @@

    Name Resolution
    -class celpy.c7nlib.ComparableVersion(version: str)[source]
    +class celpy.c7nlib.ComparableVersion(version: str)[source]

    The old LooseVersion could fail on comparing present strings, used in the value as shorthand for certain options.

    The new Version doesn’t fail as easily.

    @@ -1465,7 +1465,7 @@

    Name Resolution
    -class celpy.c7nlib.C7N_Interpreted_Runner(environment: Environment, ast: Tree, functions: Dict[str, Callable[[...], BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType | CELEvalError | Type[BoolType] | Type[BytesType] | Type[DoubleType] | Type[DurationType] | Type[IntType] | Type[ListType] | Type[MapType] | Callable[[...], None] | Type[StringType] | Type[TimestampType] | Type[TypeType] | Type[UintType] | Type[PackageType] | Type[MessageType]]] | None = None)[source]
    +class celpy.c7nlib.C7N_Interpreted_Runner(environment: Environment, ast: Tree, functions: Dict[str, Callable[[...], BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType | CELEvalError | Type[BoolType] | Type[BytesType] | Type[DoubleType] | Type[DurationType] | Type[IntType] | Type[ListType] | Type[MapType] | Callable[[...], None] | Type[StringType] | Type[TimestampType] | Type[TypeType] | Type[UintType] | Type[PackageType] | Type[MessageType]]] | None = None)[source]

    Extends the Evaluation to introduce the C7N CELFilter instance into the evaluation.

    The variable is global to allow the functions to have the simple-looking argument values that CEL expects. This allows a function in this module to reach outside CEL for @@ -1514,7 +1514,7 @@

    Name Resolution>>> p = CELParser() >>> text2 = 'type(null)' >>> ast2 = p.parse(text2) ->>> print(ast2.pretty().replace(" "," ")) +>>> print(ast2.pretty().replace(" "," ")) expr conditionalor conditionaland @@ -1541,7 +1541,7 @@

    Name Resolution
    -exception celpy.celparser.CELParseError(*args: Any, line: int | None = None, column: int | None = None)[source]
    +exception celpy.celparser.CELParseError(*args: Any, line: int | None = None, column: int | None = None)[source]

    A syntax error in the CEL expression.

    @@ -1552,7 +1552,7 @@

    Name Resolution
    -class celpy.celparser.CELParser(tree_class: type = <class 'lark.tree.Tree'>)[source]
    +class celpy.celparser.CELParser(tree_class: type = <class 'lark.tree.Tree'>)[source]

    Creates a Lark parser with the required options.

    Important

    @@ -1580,7 +1580,7 @@

    Name Resolution
    -static ambiguous_literals(t: Token) Token[source]
    +static ambiguous_literals(t: Token) Token[source]

    Resolve a grammar ambiguity between identifiers and literals

    @@ -1598,11 +1598,11 @@

    Name Resolution
    -class celpy.celparser.DumpAST[source]
    +class celpy.celparser.DumpAST[source]

    Dump a CEL AST creating a close approximation to the original source.

    -classmethod display(ast: Tree) str[source]
    +classmethod display(ast: Tree) str[source]
    @@ -2011,12 +2011,12 @@

    Timzone Details
    -class celpy.celtypes.BoolType(source: Any)[source]
    +class celpy.celtypes.BoolType(source: Any)[source]

    Native Python permits all unary operators to work on bool objects.

    For CEL, we need to prevent the CEL expression -false from working.

    -static __new__(cls: Type[BoolType], source: Any) BoolType[source]
    +static __new__(cls: Type[BoolType], source: Any) BoolType[source]
    @@ -2047,11 +2047,11 @@

    Timzone Details
    -class celpy.celtypes.BytesType(source: str | bytes | Iterable[int] | BytesType | StringType, *args: Any, **kwargs: Any)[source]
    +class celpy.celtypes.BytesType(source: str | bytes | Iterable[int] | BytesType | StringType, *args: Any, **kwargs: Any)[source]

    Python’s bytes semantics are close to CEL.

    -static __new__(cls: Type[BytesType], source: str | bytes | Iterable[int] | BytesType | StringType, *args: Any, **kwargs: Any) BytesType[source]
    +static __new__(cls: Type[BytesType], source: str | bytes | Iterable[int] | BytesType | StringType, *args: Any, **kwargs: Any) BytesType[source]
    @@ -2060,17 +2060,22 @@

    Timzone Details +
    +contains(item: BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType) BoolType[source]
    +

    +

    -class celpy.celtypes.DoubleType(source: Any)[source]
    +class celpy.celtypes.DoubleType(source: Any)[source]

    Native Python permits mixed type comparisons, doing conversions as needed.

    For CEL, we need to prevent mixed-type comparisons from working.

    TODO: Conversions from string? IntType? UintType? DoubleType?

    -static __new__(cls: Type[DoubleType], source: Any) DoubleType[source]
    +static __new__(cls: Type[DoubleType], source: Any) DoubleType[source]
    @@ -2143,7 +2148,7 @@

    Timzone Details
    -class celpy.celtypes.IntType(source: Any, *args: Any, **kwargs: Any)[source]
    +class celpy.celtypes.IntType(source: Any, *args: Any, **kwargs: Any)[source]

    A version of int with overflow errors outside int64 range.

    features/integer_math.feature:277 “int64_overflow_positive”

    >>> IntType(9223372036854775807) + IntType(1)
    @@ -2171,7 +2176,7 @@ 

    Timzone Details
    -static __new__(cls: Type[IntType], source: Any, *args: Any, **kwargs: Any) IntType[source]
    +static __new__(cls: Type[IntType], source: Any, *args: Any, **kwargs: Any) IntType[source]

    @@ -2316,7 +2321,7 @@

    Timzone Details
    -class celpy.celtypes.UintType(source: Any, *args: Any, **kwargs: Any)[source]
    +class celpy.celtypes.UintType(source: Any, *args: Any, **kwargs: Any)[source]

    A version of int with overflow errors outside uint64 range.

    Alternatives:

    @@ -2353,7 +2358,7 @@

    Timzone Details
    -static __new__(cls: Type[UintType], source: Any, *args: Any, **kwargs: Any) UintType[source]
    +static __new__(cls: Type[UintType], source: Any, *args: Any, **kwargs: Any) UintType[source]

    @@ -2468,7 +2473,7 @@

    Timzone Details
    -class celpy.celtypes.ListType(iterable=(), /)[source]
    +class celpy.celtypes.ListType(iterable=(), /)[source]

    Native Python implements comparison operations between list objects.

    For CEL, we prevent list comparison operators from working.

    We provide an __eq__() and __ne__() that @@ -2541,7 +2546,7 @@

    Timzone Details
    -class celpy.celtypes.MapType(items: Mapping[Any, Any] | Sequence[Tuple[Any, Any]] | None = None)[source]
    +class celpy.celtypes.MapType(items: Mapping[Any, Any] | Sequence[Tuple[Any, Any]] | None = None)[source]

    Native Python allows mapping updates and any hashable type as a kay.

    CEL prevents mapping updates and has a limited domain of key types.

    int, uint, bool, or string keys

    @@ -2565,7 +2570,7 @@

    Timzone Details
    __getitem__(key: Any) Any[source]
    -

    Return self[key].

    +

    x.__getitem__(y) <==> x[y]

    @@ -2588,7 +2593,7 @@

    Timzone Details
    -static valid_key_type(key: Any) bool[source]
    +static valid_key_type(key: Any) bool[source]

    Valid CEL key types. Plus native str for tokens in the source when evaluating e.f

    @@ -2616,7 +2621,7 @@

    Timzone Details
    -class celpy.celtypes.NullType[source]
    +class celpy.celtypes.NullType[source]

    Python’s None semantics aren’t quite right for CEL.

    @@ -2639,12 +2644,12 @@

    Timzone Details
    -class celpy.celtypes.StringType(source: str | bytes | BytesType | StringType, *args: Any, **kwargs: Any)[source]
    +class celpy.celtypes.StringType(source: str | bytes | BytesType | StringType, *args: Any, **kwargs: Any)[source]

    Python’s str semantics are very, very close to CEL.

    We rely on the overlap between "/u270c" and "/U0001f431" in CEL and Python.

    -static __new__(cls: Type[StringType], source: str | bytes | BytesType | StringType, *args: Any, **kwargs: Any) StringType[source]
    +static __new__(cls: Type[StringType], source: str | bytes | BytesType | StringType, *args: Any, **kwargs: Any) StringType[source]
    @@ -2680,7 +2685,7 @@

    Timzone Details
    -class celpy.celtypes.TimestampType(source: int | str | datetime, *args: Any, **kwargs: Any)[source]
    +class celpy.celtypes.TimestampType(source: int | str | datetime, *args: Any, **kwargs: Any)[source]

    Implements google.protobuf.Timestamp

    See https://developers.google.com/protocol-buffers/docs/reference/google.protobuf

    Also see https://www.ietf.org/rfc/rfc3339.txt.

    @@ -2728,7 +2733,7 @@

    Timzone Details
    -static __new__(cls: Type[TimestampType], source: int | str | datetime, *args: Any, **kwargs: Any) TimestampType[source]
    +static __new__(cls: Type[TimestampType], source: int | str | datetime, *args: Any, **kwargs: Any) TimestampType[source]

    @@ -2765,18 +2770,18 @@

    Timzone Details
    -classmethod tz_name_lookup(tz_name: str) tzinfo | None[source]
    +classmethod tz_name_lookup(tz_name: str) tzinfo | None[source]

    The pendulum parsing may be extended with additional aliases.

    -classmethod tz_offset_parse(tz_name: str) tzinfo | None[source]
    +classmethod tz_offset_parse(tz_name: str) tzinfo | None[source]
    -static tz_parse(tz_name: str | None) tzinfo | None[source]
    +static tz_parse(tz_name: str | None) tzinfo | None[source]
    @@ -2833,7 +2838,7 @@

    Timzone Details
    -class celpy.celtypes.DurationType(seconds: Any, nanos: int = 0, **kwargs: Any)[source]
    +class celpy.celtypes.DurationType(seconds: Any, nanos: int = 0, **kwargs: Any)[source]

    Implements google.protobuf.Duration

    https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#duration

    The protobuf implementation is an ordered pair of int64 seconds and int32 nanos. @@ -2877,7 +2882,7 @@

    Timzone Details
    -static __new__(cls: Type[DurationType], seconds: Any, nanos: int = 0, **kwargs: Any) DurationType[source]
    +static __new__(cls: Type[DurationType], seconds: Any, nanos: int = 0, **kwargs: Any) DurationType[source]

    @@ -2932,7 +2937,7 @@

    Timzone Details
    -class celpy.celtypes.FunctionType[source]
    +class celpy.celtypes.FunctionType[source]

    We need a concrete Annotation object to describe callables to celpy. We need to describe functions as well as callable objects. The description would tend to shadow typing.Callable.

    @@ -2954,7 +2959,7 @@

    Timzone Details
    -class celpy.celtypes.PackageType(items: Mapping[Any, Any] | Sequence[Tuple[Any, Any]] | None = None)[source]
    +class celpy.celtypes.PackageType(items: Mapping[Any, Any] | Sequence[Tuple[Any, Any]] | None = None)[source]

    A package of message types, usually protobuf.

    TODO: This may not be needed.

    @@ -2966,7 +2971,7 @@

    Timzone Details
    -class celpy.celtypes.MessageType(*args: BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType, **fields: BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType)[source]
    +class celpy.celtypes.MessageType(*args: BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType, **fields: BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType)[source]

    An individual protobuf message definition. A mapping from field name to field value.

    See Scenario: “message_literal” in the parse.feature. This is a very deeply-nested message (30? levels), but the navigation to “payload” field seems to create a default @@ -2985,12 +2990,12 @@

    Timzone Details
    -class celpy.celtypes.TypeType(instance: Any)[source]
    +class celpy.celtypes.TypeType(instance: Any)[source]

    This is primarily used as a function to extract type from an object or a type. For consistence, we define it as a type so other types can extend it.

    -static __new__(typ, instance: Any) type[source]
    +static __new__(typ, instance: Any) type[source]

    @@ -3026,15 +3031,9 @@

    Timzone DetailsCEL_TRACE is set, then detailed tracing of methods is made available. To see the trace, set the logging level for celpy.Evaluator to logging.DEBUG.

    -
    -
    -celpy.evaluation.function_matches(text: str, pattern: str) Result[source]
    -

    Implementation of the match() function using re2

    -
    -
    -exception celpy.evaluation.CELSyntaxError(arg: Any, line: int | None = None, column: int | None = None)[source]
    +exception celpy.evaluation.CELSyntaxError(arg: Any, line: int | None = None, column: int | None = None)[source]

    CEL Syntax error – the AST did not have the expected structure.

    @@ -3045,7 +3044,7 @@

    Timzone Details
    -exception celpy.evaluation.CELUnsupportedError(arg: Any, line: int, column: int)[source]
    +exception celpy.evaluation.CELUnsupportedError(arg: Any, line: int, column: int)[source]

    Feature unsupported by this implementation of CEL.

    @@ -3056,7 +3055,7 @@

    Timzone Details
    -exception celpy.evaluation.CELEvalError(*args: Any, tree: Tree | None = None, token: Token | None = None)[source]
    +exception celpy.evaluation.CELEvalError(*args: Any, tree: Tree | None = None, token: Token | None = None)[source]

    CEL evaluation problem. This can be saved as a temporary value for later use. This is politely ignored by logic operators to provide commutative short-circuit.

    We provide operator-like special methods so an instance of an error @@ -3267,6 +3266,12 @@

    Timzone Detailscelpy.evaluation.function_endsWith(string: StringType, fragment: StringType) BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType | CELEvalError | Type[BoolType] | Type[BytesType] | Type[DoubleType] | Type[DurationType] | Type[IntType] | Type[ListType] | Type[MapType] | Callable[[...], None] | Type[StringType] | Type[TimestampType] | Type[TypeType] | Type[UintType] | Type[PackageType] | Type[MessageType][source]

    +
    +
    +celpy.evaluation.function_matches(text: str, pattern: str) BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType | CELEvalError | Type[BoolType] | Type[BytesType] | Type[DoubleType] | Type[DurationType] | Type[IntType] | Type[ListType] | Type[MapType] | Callable[[...], None] | Type[StringType] | Type[TimestampType] | Type[TypeType] | Type[UintType] | Type[PackageType] | Type[MessageType][source]
    +

    Implementation of the match() function using re2

    +
    +
    celpy.evaluation.function_getDate(ts: TimestampType, tz_name: StringType | None = None) BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType | CELEvalError | Type[BoolType] | Type[BytesType] | Type[DoubleType] | Type[DurationType] | Type[IntType] | Type[ListType] | Type[MapType] | Callable[[...], None] | Type[StringType] | Type[TimestampType] | Type[TypeType] | Type[UintType] | Type[PackageType] | Type[MessageType][source]
    @@ -3349,7 +3354,7 @@

    Timzone Details
    -class celpy.evaluation.Referent(ref_to: TypeType | Callable[[...], BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType] | Type[FunctionType] | None = None)[source]
    +class celpy.evaluation.Referent(ref_to: TypeType | Callable[[...], BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType] | Type[FunctionType] | None = None)[source]

    A Name can refer to any of the following things:

    -static dict_find_name(some_dict: Dict[str, Referent] | Referent, path: Sequence[str]) Referent[source]
    +static dict_find_name(some_dict: Dict[str, Referent] | Referent, path: Sequence[str]) Referent[source]

    Recursive navigation into mappings, messages, and packages. These are not NameContainers (or Activations).

    @@ -3699,7 +3704,7 @@

    Timzone Details
    -class celpy.evaluation.Activation(*, annotations: Mapping[str, TypeType | Callable[[...], BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType] | Type[FunctionType]] | None = None, vars: Mapping[str, BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType | CELEvalError | Type[BoolType] | Type[BytesType] | Type[DoubleType] | Type[DurationType] | Type[IntType] | Type[ListType] | Type[MapType] | Callable[[...], None] | Type[StringType] | Type[TimestampType] | Type[TypeType] | Type[UintType] | Type[PackageType] | Type[MessageType] | NameContainer | CELFunction] | None = None, functions: Mapping[str, Callable[[...], BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType | CELEvalError | Type[BoolType] | Type[BytesType] | Type[DoubleType] | Type[DurationType] | Type[IntType] | Type[ListType] | Type[MapType] | Callable[[...], None] | Type[StringType] | Type[TimestampType] | Type[TypeType] | Type[UintType] | Type[PackageType] | Type[MessageType]]] | list[Callable[[...], BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType | CELEvalError | Type[BoolType] | Type[BytesType] | Type[DoubleType] | Type[DurationType] | Type[IntType] | Type[ListType] | Type[MapType] | Callable[[...], None] | Type[StringType] | Type[TimestampType] | Type[TypeType] | Type[UintType] | Type[PackageType] | Type[MessageType]]] | None = None, package: str | None = None, based_on: Activation | None = None)[source]
    +class celpy.evaluation.Activation(*, annotations: Mapping[str, TypeType | Callable[[...], BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType] | Type[FunctionType]] | None = None, vars: Mapping[str, BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType | CELEvalError | Type[BoolType] | Type[BytesType] | Type[DoubleType] | Type[DurationType] | Type[IntType] | Type[ListType] | Type[MapType] | Callable[[...], None] | Type[StringType] | Type[TimestampType] | Type[TypeType] | Type[UintType] | Type[PackageType] | Type[MessageType] | NameContainer | CELFunction] | None = None, functions: Mapping[str, Callable[[...], BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType | CELEvalError | Type[BoolType] | Type[BytesType] | Type[DoubleType] | Type[DurationType] | Type[IntType] | Type[ListType] | Type[MapType] | Callable[[...], None] | Type[StringType] | Type[TimestampType] | Type[TypeType] | Type[UintType] | Type[PackageType] | Type[MessageType]]] | list[Callable[[...], BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType | CELEvalError | Type[BoolType] | Type[BytesType] | Type[DoubleType] | Type[DurationType] | Type[IntType] | Type[ListType] | Type[MapType] | Callable[[...], None] | Type[StringType] | Type[TimestampType] | Type[TypeType] | Type[UintType] | Type[PackageType] | Type[MessageType]]] | None = None, package: str | None = None, based_on: Activation | None = None)[source]

    Namespace with variable bindings and type name (“annotation”) bindings. Additionally, the pool of functions and types are here, also.

    Life and Content

    @@ -3753,7 +3758,7 @@

    Timzone Details. changes the search order from most local first to root first.

    -__init__(*, annotations: Mapping[str, TypeType | Callable[[...], BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType] | Type[FunctionType]] | None = None, vars: Mapping[str, BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType | CELEvalError | Type[BoolType] | Type[BytesType] | Type[DoubleType] | Type[DurationType] | Type[IntType] | Type[ListType] | Type[MapType] | Callable[[...], None] | Type[StringType] | Type[TimestampType] | Type[TypeType] | Type[UintType] | Type[PackageType] | Type[MessageType] | NameContainer | CELFunction] | None = None, functions: Mapping[str, Callable[[...], BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType | CELEvalError | Type[BoolType] | Type[BytesType] | Type[DoubleType] | Type[DurationType] | Type[IntType] | Type[ListType] | Type[MapType] | Callable[[...], None] | Type[StringType] | Type[TimestampType] | Type[TypeType] | Type[UintType] | Type[PackageType] | Type[MessageType]]] | list[Callable[[...], BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType | CELEvalError | Type[BoolType] | Type[BytesType] | Type[DoubleType] | Type[DurationType] | Type[IntType] | Type[ListType] | Type[MapType] | Callable[[...], None] | Type[StringType] | Type[TimestampType] | Type[TypeType] | Type[UintType] | Type[PackageType] | Type[MessageType]]] | None = None, package: str | None = None, based_on: Activation | None = None) None[source]
    +__init__(*, annotations: Mapping[str, TypeType | Callable[[...], BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType] | Type[FunctionType]] | None = None, vars: Mapping[str, BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType | CELEvalError | Type[BoolType] | Type[BytesType] | Type[DoubleType] | Type[DurationType] | Type[IntType] | Type[ListType] | Type[MapType] | Callable[[...], None] | Type[StringType] | Type[TimestampType] | Type[TypeType] | Type[UintType] | Type[PackageType] | Type[MessageType] | NameContainer | CELFunction] | None = None, functions: Mapping[str, Callable[[...], BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType | CELEvalError | Type[BoolType] | Type[BytesType] | Type[DoubleType] | Type[DurationType] | Type[IntType] | Type[ListType] | Type[MapType] | Callable[[...], None] | Type[StringType] | Type[TimestampType] | Type[TypeType] | Type[UintType] | Type[PackageType] | Type[MessageType]]] | list[Callable[[...], BoolType | BytesType | DoubleType | DurationType | IntType | ListType | MapType | None | StringType | TimestampType | UintType | CELEvalError | Type[BoolType] | Type[BytesType] | Type[DoubleType] | Type[DurationType] | Type[IntType] | Type[ListType] | Type[MapType] | Callable[[...], None] | Type[StringType] | Type[TimestampType] | Type[TypeType] | Type[UintType] | Type[PackageType] | Type[MessageType]]] | None = None, package: str | None = None, based_on: Activation | None = None) None[source]

    Create an Activation.

    The annotations are loaded first. The variables and their values are loaded second, and placed in front of the annotations in the chain of name resolutions.

    @@ -3853,7 +3858,7 @@

    Timzone Details
    -class celpy.evaluation.Evaluator(ast: Tree, activation: Activation)[source]
    +class celpy.evaluation.Evaluator(ast: Tree, activation: Activation)[source]

    Evaluate an AST in the context of a specific Activation.

    See https://github.com/google/cel-go/blob/master/examples/README.md

    General Evaluation.

    @@ -4387,7 +4392,7 @@

    Timzone Details
    -class celpy.evaluation.TranspilerTree(data: str, children: Sequence[Token | TranspilerTree], meta: Meta | None = None)[source]
    +class celpy.evaluation.TranspilerTree(data: str, children: Sequence[Token | TranspilerTree], meta: Meta | None = None)[source]
    data: str
    @@ -4412,7 +4417,7 @@

    Timzone Details
    -class celpy.evaluation.Transpiler(ast: TranspilerTree, activation: Activation)[source]
    +class celpy.evaluation.Transpiler(ast: TranspilerTree, activation: Activation)[source]

    Transpile the CEL construct(s) to Python functions. This is a Facade that wraps two visitor subclasses to do two phases of transpilation.

    @@ -4508,7 +4513,7 @@

    Timzone Details
    -class celpy.evaluation.Phase1Transpiler(facade: Transpiler)[source]
    +class celpy.evaluation.Phase1Transpiler(facade: Transpiler)[source]

    Decorate all nodes with transpiled Python code, where possible. For short-circuit operators or macros, where a “checked exception” is required, a simple ex_{n} name is present, and separate statements are provided as @@ -4746,7 +4751,7 @@

    Timzone Details
    -class celpy.evaluation.Phase2Transpiler(facade: Transpiler)[source]
    +class celpy.evaluation.Phase2Transpiler(facade: Transpiler)[source]

    Extract any checked_exception evaluation statements that decorate the parse tree. Also, get the overall top-level expression, assigned to special variable, CEL.

    >>> from unittest.mock import Mock
    @@ -4933,7 +4938,7 @@ 

    Related Topics

    ©2020, CapitalOne. | - Powered by Sphinx 8.2.3 + Powered by Sphinx 8.1.3 & Alabaster 1.0.0 | diff --git a/docs/build/html/c7n_functions.html b/docs/build/html/c7n_functions.html index 73d7d37..34535fa 100644 --- a/docs/build/html/c7n_functions.html +++ b/docs/build/html/c7n_functions.html @@ -7,7 +7,7 @@ C7N Functions Required — CEL in Python documentation - + @@ -10004,7 +10004,7 @@

    Related Topics

    ©2020, CapitalOne. | - Powered by Sphinx 8.2.3 + Powered by Sphinx 8.1.3 & Alabaster 1.0.0 | diff --git a/docs/build/html/cli.html b/docs/build/html/cli.html index 6fe7704..1b14300 100644 --- a/docs/build/html/cli.html +++ b/docs/build/html/cli.html @@ -7,7 +7,7 @@ CLI Use of CEL-Python — CEL in Python documentation - + @@ -372,7 +372,7 @@

    Related Topics

    ©2020, CapitalOne. | - Powered by Sphinx 8.2.3 + Powered by Sphinx 8.1.3 & Alabaster 1.0.0 | diff --git a/docs/build/html/configuration.html b/docs/build/html/configuration.html index bb586dd..f0cb5ed 100644 --- a/docs/build/html/configuration.html +++ b/docs/build/html/configuration.html @@ -7,7 +7,7 @@ Configuration — CEL in Python documentation - + @@ -143,7 +143,7 @@

    Related Topics

    ©2020, CapitalOne. | - Powered by Sphinx 8.2.3 + Powered by Sphinx 8.1.3 & Alabaster 1.0.0 | diff --git a/docs/build/html/development.html b/docs/build/html/development.html index 6834ffd..cf06065 100644 --- a/docs/build/html/development.html +++ b/docs/build/html/development.html @@ -7,7 +7,7 @@ Development Tools — CEL in Python documentation - + @@ -45,60 +45,36 @@

    Development Toolspb2g.py, converts the test cases from Protobuf messages to Gherkin scenarios.

    -

    -@startuml
-
-file source as "source protobuf test cases"
-file features as "Gherkin feature files"
-
-source --> [pb2g.py]
-[pb2g.py] --> [Docker] : "Uses"
-[Docker] ..> [mkgherkin.go] : "Runs"
-[pb2g.py] --> features
-@enduml -

    -
    -

    The pb2g Tool

    -

    The pb2g.py Python application converts a protobuf test case collection into a Gherkin Feature file. -These can be used to update the features directory.

    +

    A tool, gherkinize.py, converts the test cases from Protobuf messages to Gherkin scenarios.

    +
    +

    The gherkinize.py Tool

    +

    The gherkinize.py tool converts a .textproto test case collection into a Gherkin .feature file. +This can be used to update the conformance tests in the features directory.

    -

    SYNOPSIS

    +

    Synopsis

    -
    --g <docker | local>, --gherkinizer <docker | local
    -

    Sets the method for converting the Protobuf messages to interim JSON documents. -Either a local Go binary can be run, -or a Docker image, using the tools/Dockerfile can be run. -Using -g docker requires installing Docker (https://www.docker.com)

    -

    Using -g local requires a local version compiled for your platform. -Install the Go tools (https://go.dev/learn/) and compile tools/mkgherkin.go.

    -

    Docker is the default.

    -
    - -
    -
    --o <output>, --output <output>
    +
    +-o <output>, --output <output>

    Where to write the feature file. Generally, it’s helpful to have the .textproto and .feature stems match. The Makefile assures this.

    -
    --s, --silent
    +
    +-s, --silent

    No console output is produced

    -
    --v, --verbose
    +
    +-v, --verbose

    Verbose debugging output on the console.

    -
    -source
    +
    +source

    A source .textproto file. This is often the path to a file in a local download of https://github.com/google/cel-spec/tree/master/tests/simple/testdata.

    A URL for the source is not supported.

    @@ -106,35 +82,23 @@

    SYNOPSIS

    -

    DESCRIPTION

    -

    Convert one .textproto file to a Gherkin .feature file. -There are two steps to the conversion:

    -
      -
    1. Rewrite the .textproto into JSON. -This relies on common Go libraries, and is little more than a syntactic conversion.

    2. -
    3. Rewrite the JSON copy of the .textproto into Gherkin. -This a little more fraught with special cases and exceptions. -The .textproto semantics can be confusing.

    4. -
    +

    Description

    +

    Convert one .textproto file to a Gherkin .feature file.

    -

    FILES

    +

    Files

    source:
    -

    A .textproto test case file from the CEL-spec repository.

    +

    A .textproto test case file from the cel-spec repository.

    output:

    A .feature file with the same stem as the source file is written to the output directory. basic.textproto will create basic.feature.

    -
    interim:
    -

    An interim JSON-format file is created and deleted. -These are only visible in the event of a fatal error creating the Gherkin output.

    -
    -

    EXAMPLES

    +

    Examples

    The basic.textproto starts like this:

    name: "basic"
     description: "Basic conformance tests that all implementations should pass."
    @@ -153,70 +117,102 @@ 

    EXAMPLES }

    -

    The Feature file created looks like this:

    -
    Feature: basic
    -         Basic conformance tests that all implementations should pass.
    +

    The basic.feature file created looks like this:

    +
    @conformance
    +Feature: basic
    +        Basic conformance tests that all implementations should pass.
     
    -# self_eval_zeroish -- Simple self-evaluating forms to zero-ish values.
     
    -Scenario: self_eval_int_zero
    +# self_eval_zeroish -- Simple self-evaluating forms to zero-ish values.
     
    -    When CEL expression "0" is evaluated
    -    #    int64_value:0
    -    Then value is IntType(source=0)
    +Scenario: self_eval_zeroish/self_eval_int_zero
     
    +    When CEL expression '0' is evaluated
    +    Then value is celpy.celtypes.IntType(source=0)
     
    -Scenario: self_eval_uint_zero
    +Scenario: self_eval_zeroish/self_eval_uint_zero
     
    -    When CEL expression "0u" is evaluated
    -    #    uint64_value:0
    -    Then value is UintType(source=0)
    +    When CEL expression '0u' is evaluated
    +    Then value is celpy.celtypes.UintType(source=0)
    +
    +
    +

    The source .textproto files have a “section” heading which doesn’t have a precise parallel in the Gherkin language. +The sections become comments in the .feature file, and the section name is used to prefix each feature name.

    +
    +
    +
    +class gherkinize.Config(path: str)[source]
    +

    This class reads in optional configuration for conformance tests. Each scenario +is within a feature and a section.

    + + + + + + + + + + + + + + + +

    feature

    section

    scenario

    example

    string_ext

    ascii_casing

    lowerascii_unicode

    +

    The value for each scenario can be a string tag (which must begin with +@), an array of tags (each of which must begin with @) or a dictionary +with a tags key containing an array of tags (each of which… y’know).

    +

    For example, each of the following are valid:

    +
    [bindings_ext.bind]
    +bind_nested = "@wip"
    +boolean_literal = [ "@wip" ]
    +
    +[bindings_ext.bind.macro_exists]
    +tags = [ "@wip" ]
     
    -

    The source files have a “section” heading which doesn’t have a precise parallel in the Gherkin language. -The sections become comments in the Feature file.

    +

    In the future, dictionaries with additional features may be supported.

    +
    +
    +__init__(path: str) None[source]
    +
    + +
    +
    +tags_for(feature: str, section: str, scenario: str) list[str][source]
    +

    Get a list of tags for a given scenario.

    +
    + +
    + +
    +
    +

    The features/steps Directory

    The features/steps directory has step definition modules that implement the Given, When, and Then clauses.

    Provides step definitions for the c7n_interface.feature. This is not part of the CEL language specification.

    Provides step definitions for the expr_test_bc.feature, json_query.feature, neither of which are part of the CEL language specificaiton.

    -

    Provides step definitions for the features generated by the pb2g.py tool.

    -
    +

    Provides step definitions for the features generated by the gherkinize.py tool.

    The features/Makefile

    This Makefile has the following targets:

    -
    -
    %.textproto:
    -

    This copies textproto files from the source directory -to the features directory. -The source is defined by the CEL_SIMPLE_TESTDATA environment variable. -This will overwrite out-of-date files in the features directory.

    -

    It’s important to use git wisely and start with a clean branch of the project so changes can be rolled back.

    -
    -
    %.feature:
    -

    This creates the .feature file from the .textproto file.

    -
    -
    scan:
    -

    This phony target reads all of the .textproto files to be sure they can be converted to Gherkin. -If it concludes with the output "All files scanned successfully", then there are no surprising or unexpected features in the .textproto files.

    -
    -
    clean-broken:
    -

    This phony target removes empty .feature files that may be left over when the conversion process crashes with a fatal error.

    -
    -
    clean-features:
    -

    This phony target removes all of the .textproto-based .feature files. -Manually created .feature files are left intact.

    -
    -
    clean:
    -

    This phony target removes all .textproto and .feature files that are built from the CEL specification. -Manually created .feature files are left intact.

    -
    -
    +
     Available commands:
    +   %.textproto   copies the .textproto from the cel-spec directory
    +   %.feature     generates Gherkin feature from %.textproto source
    +   clean         cleans generated feature files
    +   clean         cleans generated feature files and textproto sources
    +
    +

    Currently, the following feature files are built from the CEL specification.

    -
    basic.feature
    +
    basic.feature
    +bindings_ext.feature
    +block_ext.feature
     comparisons.feature
     conversions.feature
     dynamic.feature
    +encoders_ext.feature
     enums.feature
     fields.feature
     fp_math.feature
    @@ -224,14 +220,21 @@ 

    The features/Ma lists.feature logic.feature macros.feature +macros2.feature +math_ext.feature namespace.feature +optionals.feature parse.feature plumbing.feature proto2.feature +proto2_ext.feature proto3.feature string.feature +string_ext.feature timestamps.feature +type_deduction.feature unknowns.feature +wrappers.feature

    @@ -239,58 +242,80 @@

    The features/Ma

    The docs/Makefile

    This is a Sphinx Makefile to build documentation. For more information, see https://www.sphinx-doc.org/en/master/index.html

    +
    Sphinx v8.1.3
    +Please use `make target' where target is one of
    +  html        to make standalone HTML files
    +  dirhtml     to make HTML files named index.html in directories
    +  singlehtml  to make a single large HTML file
    +  pickle      to make pickle files
    +  json        to make JSON files
    +  htmlhelp    to make HTML files and an HTML help project
    +  qthelp      to make HTML files and a qthelp project
    +  devhelp     to make HTML files and a Devhelp project
    +  epub        to make an epub
    +  latex       to make LaTeX files, you can set PAPER=a4 or PAPER=letter
    +  latexpdf    to make LaTeX and PDF files (default pdflatex)
    +  latexpdfja  to make LaTeX files and run them through platex/dvipdfmx
    +  text        to make text files
    +  man         to make manual pages
    +  texinfo     to make Texinfo files
    +  info        to make Texinfo files and run them through makeinfo
    +  gettext     to make PO message catalogs
    +  changes     to make an overview of all changed/added/deprecated items
    +  xml         to make Docutils-native XML files
    +  pseudoxml   to make pseudoxml-XML files for display purposes
    +  linkcheck   to check all external links for integrity
    +  doctest     to run all doctests embedded in the documentation (if enabled)
    +  coverage    to run coverage check of the documentation (if enabled)
    +  clean       to remove everything in the build directory
    +
    +

    The Project Makefile

    A top-level Makefile has a number of phony targets:

    -
    -
    build:
    -

    Runs uv build to create a distribution kit.

    -
    -
    install-tools:
    -

    Pulls a golang Docker image and builds the mkgherkin image.

    -
    -
    test:
    -

    Runs the Python 3.12 test environment to execute a quick test.

    -
    -
    test-all:
    -

    Update the features files and run the full test suite.

    -
    -
    test-wip:
    -

    Update the features files and run the WIP test environment – these are tests flagged with @WIP markers.

    -
    -
    test-tools:
    -

    Run a test of only the tools, then scan the features files to be sure they’re still valid after the tool change.

    -
    -
    docs:
    -

    Build the HTML documentation.

    -
    -
    lint:
    -

    Runs the lint test environment to get code coverage, type hint checking, and other lint checks.

    -
    -
    coverage:
    -

    Reproduce the most recent coverage report.

    -
    -
    clean:
    -

    Remove a number of directories and their files:

    -
      -
    • .tox

    • -
    • .Python

    • -
    • bin

    • -
    • include

    • -
    • lib

    • -
    • pip-selfcheck

    • -
    • .json

    • -
    -
    -
    benchmarks:
    -

    Run the applications in the benches directory to gather performance benchmark data.

    -
      -
    • large_resource_set.py

    • -
    • complex_expression.py

    • -
    -
    -
    +
     Available commands:
    +   build         runs uv build to create a distribution kit
    +   build-all     alias of build, conformance, and docs
    + 
    +   test          runs the Python 3.12 test environment to execute a quick test
    +   test-all      runs the full test suite
    +   test-<env>    runs tests for any of the available tox environments:
    + 
    +     default environments:
    +     py39                     -> test suite
    +     py310                    -> test suite
    +     py311                    -> test suite
    +     py312                    -> test suite
    +     py313                    -> test suite
    +     lint                     -> check types, formatting, and best practices
    +     tools                    -> conformance suite conversion tools
    +     
    +     additional environments:
    +     wip                      -> work-in-progress test suite
    +     conformance              -> test suite
    +     conformance-compiled     -> compiled runner
    +     conformance-wip          -> work in progress
    +     conformance-wip-compiled -> work in progress + compiled runner
    +     coverage                 -> generate coverage reports
    + 
    +   conformance   generates conformance tests
    +   conf-clean    cleans generated conformance tests
    + 
    +   docs          generates HTML documentation
    +   docs-clean    lints documentation sources
    +   docs-clean    cleans generated HTML documentation
    + 
    +   lint          runs code coverage, type hint checking, and other lint checks
    +                 (alias of test-lint)
    + 
    +   format        runs code formatting
    +   coverage      generates code coverage reports
    +   clean         cleans all content ignored by git
    +   clean-all     alias of clean, conformance-clean, and docs-clean
    +   benchmarks    runs performance benchmarks
    +
    +
    @@ -329,7 +354,8 @@

    CEL in Python

  • Architecture and Design
  • API Reference
  • Development Tools @@ -175,13 +168,6 @@

    Symbols

  • -
  • - -g - -
  • @@ -202,7 +188,7 @@

    Symbols

    -o
  • @@ -218,14 +204,14 @@

    Symbols

  • -v
  • @@ -382,6 +368,8 @@

    _

  • (celpy.evaluation.Transpiler method)
  • (celpy.evaluation.TranspilerTree method) +
  • +
  • (gherkinize.Config method)
  • __le__() (celpy.celtypes.IntType method) @@ -717,8 +705,6 @@

    C

  • CEL_PARSER (celpy.celparser.CELParser attribute)
  • CEL_REPL (class in celpy.__main__) -
  • -
  • CEL_SIMPLE_TESTDATA
  • CEL_TRACE, [1]
  • @@ -866,9 +852,13 @@

    C

  • (celpy.evaluation.Phase2Transpiler method)
  • +
  • Config (class in gherkinize) +
  • contains() (celpy.c7nlib.IPv4Network method) @@ -1597,7 +1590,7 @@

    S

    source
  • @@ -1620,6 +1613,8 @@

    S

    T

      +
    • tags_for() (gherkinize.Config method) +
    • text_from() (in module celpy.c7nlib)
    • the_activation (in module celpy.evaluation) @@ -1783,7 +1778,7 @@

      Related Topics

      ©2020, CapitalOne. | - Powered by Sphinx 8.2.3 + Powered by Sphinx 8.1.3 & Alabaster 1.0.0 diff --git a/docs/build/html/index.html b/docs/build/html/index.html index b850f08..4988ea5 100644 --- a/docs/build/html/index.html +++ b/docs/build/html/index.html @@ -7,7 +7,7 @@ Pure Python Google Common Expression Language (CEL) — CEL in Python documentation - + @@ -89,7 +89,8 @@

      Pure Python Google Common Expression Language (CEL)

    • Development Tools
        -
      • The pb2g Tool
      • +
      • The gherkinize.py Tool
      • +
      • The features/steps Directory
      • The features/Makefile
      • The docs/Makefile
      • The Project Makefile
      • @@ -194,7 +195,7 @@

        Related Topics

        ©2020, CapitalOne. | - Powered by Sphinx 8.2.3 + Powered by Sphinx 8.1.3 & Alabaster 1.0.0 | diff --git a/docs/build/html/installation.html b/docs/build/html/installation.html index c643683..9794b2e 100644 --- a/docs/build/html/installation.html +++ b/docs/build/html/installation.html @@ -7,7 +7,7 @@ Installation — CEL in Python documentation - + @@ -121,7 +121,7 @@

        Related Topics

        ©2020, CapitalOne. | - Powered by Sphinx 8.2.3 + Powered by Sphinx 8.1.3 & Alabaster 1.0.0 | diff --git a/docs/build/html/integration.html b/docs/build/html/integration.html index c75731e..6a5d6af 100644 --- a/docs/build/html/integration.html +++ b/docs/build/html/integration.html @@ -7,7 +7,7 @@ Application Integration — CEL in Python documentation - + @@ -672,7 +672,7 @@

        Related Topics

        ©2020, CapitalOne. | - Powered by Sphinx 8.2.3 + Powered by Sphinx 8.1.3 & Alabaster 1.0.0 | diff --git a/docs/build/html/objects.inv b/docs/build/html/objects.inv index 08d86c5..f6b60ef 100644 Binary files a/docs/build/html/objects.inv and b/docs/build/html/objects.inv differ diff --git a/docs/build/html/py-modindex.html b/docs/build/html/py-modindex.html index 11d1d06..460e630 100644 --- a/docs/build/html/py-modindex.html +++ b/docs/build/html/py-modindex.html @@ -6,7 +6,7 @@ Python Module Index — CEL in Python documentation - + @@ -38,7 +38,8 @@

        Python Module Index

        c | - f + f | + g
        @@ -110,6 +111,14 @@

        Python Module Index

        + + + + +
            features.steps.integration_binding
         
        + g
        + gherkinize +
        @@ -173,7 +182,7 @@

        Related Topics

        ©2020, CapitalOne. | - Powered by Sphinx 8.2.3 + Powered by Sphinx 8.1.3 & Alabaster 1.0.0 diff --git a/docs/build/html/search.html b/docs/build/html/search.html index 227fb10..d2352ae 100644 --- a/docs/build/html/search.html +++ b/docs/build/html/search.html @@ -6,7 +6,7 @@ Search — CEL in Python documentation - + @@ -116,7 +116,7 @@

        Related Topics

        ©2020, CapitalOne. | - Powered by Sphinx 8.2.3 + Powered by Sphinx 8.1.3 & Alabaster 1.0.0 diff --git a/docs/build/html/searchindex.js b/docs/build/html/searchindex.js index 71299a7..4f91488 100644 --- a/docs/build/html/searchindex.js +++ b/docs/build/html/searchindex.js @@ -1 +1 @@ -Search.setIndex({"alltitles":{"API Reference":[[0,null]],"Additional Functions":[[0,"additional-functions"]],"Application Integration":[[7,null]],"Architecture and Design":[[8,null]],"Arguments, Types, and Namespaces":[[2,"arguments-types-and-namespaces"]],"Baseline C7N Example":[[7,"baseline-c7n-example"]],"Bulk Filter Example":[[7,"bulk-filter-example"]],"C7N Cache":[[1,"c7n-cache"]],"C7N Context Object":[[0,"c7n-context-object"],[1,"c7n-context-object"]],"C7N Filter and Resource Types":[[7,"c7n-filter-and-resource-types"]],"C7N Functions Required":[[1,null]],"CEL Types":[[8,"cel-types"]],"CELFilter Design":[[1,"celfilter-design"]],"CLI Use of CEL-Python":[[2,null]],"CONFIGURATION":[[2,"configuration"]],"Cloud Custodian (C7N) Integration":[[7,"cloud-custodian-c7n-integration"]],"Common C7N Constructs":[[1,"common-c7n-constructs"]],"Common/Boolean Filters":[[1,"common-boolean-filters"]],"Common/Non-Bool Filters":[[1,"common-non-bool-filters"]],"Compile-Time":[[8,"compile-time"]],"Components":[[8,"components"]],"Configuration":[[3,null]],"Container":[[8,"container"]],"Contents":[[1,"contents"]],"Context":[[8,"context"]],"Custom function in Go":[[7,"custom-function-in-go"]],"DESCRIPTION":[[2,"description"],[4,"description"]],"Define custom global function":[[7,"define-custom-global-function"]],"Design Principles":[[1,"design-principles"]],"Development Tools":[[4,null]],"Documentation Content:":[[5,null]],"ENVIRONMENT VARIABLES":[[2,"environment-variables"]],"EXAMPLES":[[2,"examples"],[4,"examples"]],"EXIT STATUS":[[2,"exit-status"]],"Evaluation-Time":[[8,"evaluation-time"]],"Exceptions and Errors":[[7,"exceptions-and-errors"]],"External API":[[7,"external-api"]],"FILES":[[2,"files"],[4,"files"]],"Function Bindings":[[7,"function-bindings"]],"Indices and tables":[[5,"indices-and-tables"]],"Installation":[[6,null]],"Integration Essentials":[[7,"integration-essentials"]],"Integration Overview":[[5,"integration-overview"]],"More Examples from the Go implementation":[[7,"more-examples-from-the-go-implementation"]],"Name Resolution":[[0,"name-resolution"]],"Numeric Details":[[0,"numeric-details"]],"Pure Python Google Common Expression Language (CEL)":[[5,null]],"SYNOPSIS":[[2,"synopsis"],[4,"synopsis"]],"Simple example using builtin types":[[7,"simple-example-using-builtin-types"]],"Singleton/Boolean Filters":[[1,"singleton-boolean-filters"]],"Singleton/Non-Bool Filters":[[1,"singleton-non-bool-filters"]],"Summary":[[1,"summary"]],"The API":[[0,"the-api"]],"The Member-Dot Production":[[8,"the-member-dot-production"]],"The Project Makefile":[[4,"the-project-makefile"]],"The docs/Makefile":[[4,"the-docs-makefile"]],"The features/Makefile":[[4,"the-features-makefile"]],"The pb2g Tool":[[4,"the-pb2g-tool"]],"The type: value Features":[[0,"the-type-value-features"]],"The type: value_from features":[[0,"the-type-value-from-features"]],"Timzone Details":[[0,"timzone-details"]],"Todo":[[0,"id2"],[0,"id3"],[0,"id4"],[0,"id5"],[0,"id6"],[0,"id7"],[0,"id8"],[0,"id9"],[0,"id10"],[0,"id11"],[0,"id12"],[0,"id13"],[0,"id14"],[0,"id15"],[0,"id16"],[0,"id17"],[0,"id18"],[0,"id19"],[0,"id20"],[0,"id21"],[0,"id22"],[0,"id23"],[0,"id24"],[0,"id25"],[0,"id26"],[0,"id27"],[0,"id28"],[0,"id29"],[0,"id30"],[0,"id31"],[0,"id32"],[0,"id33"],[0,"id34"],[0,"id35"],[0,"id36"],[0,"id37"],[0,"id38"],[0,"id39"],[0,"id40"],[0,"id41"]],"Transpiler Missing Names":[[8,"transpiler-missing-names"]],"Type Adapter":[[0,"type-adapter"]],"Type Provider":[[0,"type-provider"]],"Types":[[0,"types"]],"__main__":[[0,"module-celpy.__main__"]],"access-key":[[1,"access-key"]],"adapter":[[0,"module-celpy.adapter"]],"age":[[1,"age"]],"bucket-encryption (no examples)":[[1,"bucket-encryption-no-examples"]],"bucket-notification (no examples)":[[1,"bucket-notification-no-examples"]],"c7nlib":[[0,"module-celpy.c7nlib"]],"capacity-delta":[[1,"capacity-delta"]],"celparser":[[0,"module-celpy.celparser"]],"celpy":[[0,"module-celpy.__init__"]],"celtypes":[[0,"module-celpy.celtypes"]],"check-cloudtrail":[[1,"check-cloudtrail"]],"check-config":[[1,"check-config"]],"config-compliance (no examples)":[[1,"config-compliance-no-examples"]],"credential":[[1,"credential"]],"cross-account":[[1,"cross-account"]],"data-events (no examples)":[[1,"data-events-no-examples"]],"db-parameter (no examples)":[[1,"db-parameter-no-examples"]],"default-vpc (no examples)":[[1,"default-vpc-no-examples"]],"dhcp-options (no examples)":[[1,"dhcp-options-no-examples"]],"diff (no examples)":[[1,"diff-no-examples"]],"ebs":[[1,"ebs"]],"egress":[[1,"egress"]],"ephemeral (no examples)":[[1,"ephemeral-no-examples"]],"evaluation":[[0,"module-celpy.evaluation"]],"event":[[1,"event"]],"event-source (no examples)":[[1,"event-source-no-examples"]],"fault-tolerant (no examples)":[[1,"fault-tolerant-no-examples"]],"finding (no examples)":[[1,"finding-no-examples"]],"flow-logs":[[1,"flow-logs"]],"global-grants":[[1,"global-grants"]],"grant-count":[[1,"grant-count"]],"group (no examples)":[[1,"group-no-examples"]],"has-allow-all (no examples)":[[1,"has-allow-all-no-examples"]],"has-inline-policy (no examples)":[[1,"has-inline-policy-no-examples"]],"has-specific-managed-policy (no examples)":[[1,"has-specific-managed-policy-no-examples"]],"has-statement":[[1,"has-statement"]],"has-users (no examples)":[[1,"has-users-no-examples"]],"has-virtual-mfa (no examples)":[[1,"has-virtual-mfa-no-examples"]],"health-event":[[1,"health-event"]],"healthcheck-protocol-mismatch (no examples)":[[1,"healthcheck-protocol-mismatch-no-examples"]],"iam-summary (no examples)":[[1,"iam-summary-no-examples"]],"image":[[1,"image"]],"image-age":[[1,"image-age"]],"ingress":[[1,"ingress"]],"instance (no examples)":[[1,"instance-no-examples"]],"instance-age":[[1,"instance-age"]],"instance-attribute (no examples)":[[1,"instance-attribute-no-examples"]],"instance-uptime":[[1,"instance-uptime"]],"invalid":[[1,"invalid"]],"inventory (no examples)":[[1,"inventory-no-examples"]],"is-log-target":[[1,"is-log-target"]],"is-logging":[[1,"is-logging"]],"is-not-logging":[[1,"is-not-logging"]],"is-shadow (no examples)":[[1,"is-shadow-no-examples"]],"is-ssl (no examples)":[[1,"is-ssl-no-examples"]],"key-rotation-status":[[1,"key-rotation-status"]],"kms-alias":[[1,"kms-alias"]],"kms-key":[[1,"kms-key"]],"last-write":[[1,"last-write"]],"latest":[[1,"latest"]],"launch-config":[[1,"launch-config"]],"lifecycle-rule (no examples)":[[1,"lifecycle-rule-no-examples"]],"listener":[[1,"listener"]],"locked (no examples)":[[1,"locked-no-examples"]],"marked-for-op":[[1,"marked-for-op"]],"metrics":[[1,"metrics"]],"mfa-device":[[1,"mfa-device"]],"mismatch-s3-origin":[[1,"mismatch-s3-origin"]],"missing":[[1,"missing"]],"missing-policy-statement":[[1,"missing-policy-statement"]],"missing-route (no examples)":[[1,"missing-route-no-examples"]],"modifyable (no examples)":[[1,"modifyable-no-examples"]],"network-location":[[1,"network-location"]],"no-encryption-statement (no examples)":[[1,"no-encryption-statement-no-examples"]],"no-specific-managed-policy (no examples)":[[1,"no-specific-managed-policy-no-examples"]],"not-encrypted":[[1,"not-encrypted"]],"offhour":[[1,"offhour"]],"onhour":[[1,"onhour"]],"op Implementations":[[1,"op-implementations"]],"param (no examples)":[[1,"param-no-examples"]],"password-policy":[[1,"password-policy"]],"policy":[[1,"policy"]],"progagated-tags (no examples)":[[1,"progagated-tags-no-examples"]],"query-logging-enabled (no examples)":[[1,"query-logging-enabled-no-examples"]],"reserved-concurrency":[[1,"reserved-concurrency"]],"rest-integration (no examples)":[[1,"rest-integration-no-examples"]],"rest-method (no examples)":[[1,"rest-method-no-examples"]],"route (no examples)":[[1,"route-no-examples"]],"s3-cidr (no examples)":[[1,"s3-cidr-no-examples"]],"s3-public-block (no examples)":[[1,"s3-public-block-no-examples"]],"security-group":[[1,"security-group"]],"service-limit":[[1,"service-limit"]],"shield-enabled":[[1,"shield-enabled"]],"shield-metrics (no examples)":[[1,"shield-metrics-no-examples"]],"singleton (no examples)":[[1,"singleton-no-examples"]],"skip-ami-snapshots":[[1,"skip-ami-snapshots"]],"ssl-policy":[[1,"ssl-policy"]],"ssm (no examples)":[[1,"ssm-no-examples"]],"stale (no examples)":[[1,"stale-no-examples"]],"state-age":[[1,"state-age"]],"status (no examples)":[[1,"status-no-examples"]],"subnet":[[1,"subnet"]],"tag-count":[[1,"tag-count"]],"target-group (no examples)":[[1,"target-group-no-examples"]],"task-definition (no examples)":[[1,"task-definition-no-examples"]],"termination-protected (no examples)":[[1,"termination-protected-no-examples"]],"unused":[[1,"unused"]],"upgrade-available (no examples)":[[1,"upgrade-available-no-examples"]],"used":[[1,"used"]],"user-data (no examples)":[[1,"user-data-no-examples"]],"valid":[[1,"valid"]],"value":[[1,"value"]],"value_from External Data":[[1,"value-from-external-data"]],"value_type Conversions":[[1,"value-type-conversions"]],"vpc":[[1,"vpc"]],"vpc-attributes (no examples)":[[1,"vpc-attributes-no-examples"]],"vpc-id":[[1,"vpc-id"]],"waf-enabled":[[1,"waf-enabled"]],"xray-encrypt-key (no examples)":[[1,"xray-encrypt-key-no-examples"]]},"docnames":["api","c7n_functions","cli","configuration","development","index","installation","integration","structure"],"envversion":{"sphinx":65,"sphinx.domains.c":3,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":9,"sphinx.domains.index":1,"sphinx.domains.javascript":3,"sphinx.domains.math":2,"sphinx.domains.python":4,"sphinx.domains.rst":2,"sphinx.domains.std":2,"sphinx.ext.todo":2,"sphinx.ext.viewcode":1},"filenames":["api.rst","c7n_functions.rst","cli.rst","configuration.rst","development.rst","index.rst","installation.rst","integration.rst","structure.rst"],"indexentries":{"__abstractmethods__ (celpy.__init__.compiledrunner attribute)":[[0,"celpy.__init__.CompiledRunner.__abstractmethods__",false]],"__abstractmethods__ (celpy.__init__.interpretedrunner attribute)":[[0,"celpy.__init__.InterpretedRunner.__abstractmethods__",false]],"__abstractmethods__ (celpy.__init__.runner attribute)":[[0,"celpy.__init__.Runner.__abstractmethods__",false]],"__abstractmethods__ (celpy.c7nlib.c7n_interpreted_runner attribute)":[[0,"celpy.c7nlib.C7N_Interpreted_Runner.__abstractmethods__",false]],"__abstractmethods__ (celpy.evaluation.evaluator attribute)":[[0,"celpy.evaluation.Evaluator.__abstractmethods__",false]],"__add__() (celpy.celtypes.durationtype method)":[[0,"celpy.celtypes.DurationType.__add__",false]],"__add__() (celpy.celtypes.inttype method)":[[0,"celpy.celtypes.IntType.__add__",false]],"__add__() (celpy.celtypes.timestamptype method)":[[0,"celpy.celtypes.TimestampType.__add__",false]],"__add__() (celpy.celtypes.uinttype method)":[[0,"celpy.celtypes.UintType.__add__",false]],"__add__() (celpy.evaluation.celevalerror method)":[[0,"celpy.evaluation.CELEvalError.__add__",false]],"__call__() (celpy.celtypes.functiontype method)":[[0,"celpy.celtypes.FunctionType.__call__",false]],"__call__() (celpy.evaluation.celevalerror method)":[[0,"celpy.evaluation.CELEvalError.__call__",false]],"__contains__() (celpy.c7nlib.ipv4network method)":[[0,"celpy.c7nlib.IPv4Network.__contains__",false]],"__enter__() (celpy.c7nlib.c7ncontext method)":[[0,"celpy.c7nlib.C7NContext.__enter__",false]],"__eq__() (celpy.c7nlib.comparableversion method)":[[0,"celpy.c7nlib.ComparableVersion.__eq__",false]],"__eq__() (celpy.celtypes.doubletype method)":[[0,"celpy.celtypes.DoubleType.__eq__",false]],"__eq__() (celpy.celtypes.inttype method)":[[0,"celpy.celtypes.IntType.__eq__",false]],"__eq__() (celpy.celtypes.listtype method)":[[0,"celpy.celtypes.ListType.__eq__",false]],"__eq__() (celpy.celtypes.maptype method)":[[0,"celpy.celtypes.MapType.__eq__",false]],"__eq__() (celpy.celtypes.nulltype method)":[[0,"celpy.celtypes.NullType.__eq__",false]],"__eq__() (celpy.celtypes.stringtype method)":[[0,"celpy.celtypes.StringType.__eq__",false]],"__eq__() (celpy.celtypes.uinttype method)":[[0,"celpy.celtypes.UintType.__eq__",false]],"__eq__() (celpy.evaluation.celevalerror method)":[[0,"celpy.evaluation.CELEvalError.__eq__",false]],"__eq__() (celpy.evaluation.referent method)":[[0,"celpy.evaluation.Referent.__eq__",false]],"__exit__() (celpy.c7nlib.c7ncontext method)":[[0,"celpy.c7nlib.C7NContext.__exit__",false]],"__floordiv__() (celpy.celtypes.inttype method)":[[0,"celpy.celtypes.IntType.__floordiv__",false]],"__floordiv__() (celpy.celtypes.uinttype method)":[[0,"celpy.celtypes.UintType.__floordiv__",false]],"__floordiv__() (celpy.evaluation.celevalerror method)":[[0,"celpy.evaluation.CELEvalError.__floordiv__",false]],"__ge__() (celpy.celtypes.inttype method)":[[0,"celpy.celtypes.IntType.__ge__",false]],"__ge__() (celpy.celtypes.listtype method)":[[0,"celpy.celtypes.ListType.__ge__",false]],"__getattr__() (celpy.evaluation.activation method)":[[0,"celpy.evaluation.Activation.__getattr__",false]],"__getitem__() (celpy.celtypes.maptype method)":[[0,"celpy.celtypes.MapType.__getitem__",false]],"__gt__() (celpy.celtypes.inttype method)":[[0,"celpy.celtypes.IntType.__gt__",false]],"__gt__() (celpy.celtypes.listtype method)":[[0,"celpy.celtypes.ListType.__gt__",false]],"__hash__ (celpy.c7nlib.comparableversion attribute)":[[0,"celpy.c7nlib.ComparableVersion.__hash__",false]],"__hash__ (celpy.celtypes.listtype attribute)":[[0,"celpy.celtypes.ListType.__hash__",false]],"__hash__ (celpy.celtypes.maptype attribute)":[[0,"celpy.celtypes.MapType.__hash__",false]],"__hash__ (celpy.celtypes.nulltype attribute)":[[0,"celpy.celtypes.NullType.__hash__",false]],"__hash__ (celpy.evaluation.celevalerror attribute)":[[0,"celpy.evaluation.CELEvalError.__hash__",false]],"__hash__ (celpy.evaluation.referent attribute)":[[0,"celpy.evaluation.Referent.__hash__",false]],"__hash__() (celpy.celtypes.booltype method)":[[0,"celpy.celtypes.BoolType.__hash__",false]],"__hash__() (celpy.celtypes.doubletype method)":[[0,"celpy.celtypes.DoubleType.__hash__",false]],"__hash__() (celpy.celtypes.inttype method)":[[0,"celpy.celtypes.IntType.__hash__",false]],"__hash__() (celpy.celtypes.stringtype method)":[[0,"celpy.celtypes.StringType.__hash__",false]],"__hash__() (celpy.celtypes.uinttype method)":[[0,"celpy.celtypes.UintType.__hash__",false]],"__init__() (celpy.__init__.compiledrunner method)":[[0,"celpy.__init__.CompiledRunner.__init__",false]],"__init__() (celpy.__init__.environment method)":[[0,"celpy.__init__.Environment.__init__",false]],"__init__() (celpy.__init__.runner method)":[[0,"celpy.__init__.Runner.__init__",false]],"__init__() (celpy.c7nlib.c7ncontext method)":[[0,"celpy.c7nlib.C7NContext.__init__",false]],"__init__() (celpy.celparser.celparseerror method)":[[0,"celpy.celparser.CELParseError.__init__",false]],"__init__() (celpy.celparser.celparser method)":[[0,"celpy.celparser.CELParser.__init__",false]],"__init__() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.__init__",false]],"__init__() (celpy.celtypes.maptype method)":[[0,"celpy.celtypes.MapType.__init__",false]],"__init__() (celpy.celtypes.messagetype method)":[[0,"celpy.celtypes.MessageType.__init__",false]],"__init__() (celpy.evaluation.activation method)":[[0,"celpy.evaluation.Activation.__init__",false]],"__init__() (celpy.evaluation.celevalerror method)":[[0,"celpy.evaluation.CELEvalError.__init__",false]],"__init__() (celpy.evaluation.celsyntaxerror method)":[[0,"celpy.evaluation.CELSyntaxError.__init__",false]],"__init__() (celpy.evaluation.celunsupportederror method)":[[0,"celpy.evaluation.CELUnsupportedError.__init__",false]],"__init__() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.__init__",false]],"__init__() (celpy.evaluation.namecontainer method)":[[0,"celpy.evaluation.NameContainer.__init__",false]],"__init__() (celpy.evaluation.phase1transpiler method)":[[0,"celpy.evaluation.Phase1Transpiler.__init__",false]],"__init__() (celpy.evaluation.phase2transpiler method)":[[0,"celpy.evaluation.Phase2Transpiler.__init__",false]],"__init__() (celpy.evaluation.referent method)":[[0,"celpy.evaluation.Referent.__init__",false]],"__init__() (celpy.evaluation.transpiler method)":[[0,"celpy.evaluation.Transpiler.__init__",false]],"__init__() (celpy.evaluation.transpilertree method)":[[0,"celpy.evaluation.TranspilerTree.__init__",false]],"__le__() (celpy.celtypes.inttype method)":[[0,"celpy.celtypes.IntType.__le__",false]],"__le__() (celpy.celtypes.listtype method)":[[0,"celpy.celtypes.ListType.__le__",false]],"__lt__() (celpy.celtypes.inttype method)":[[0,"celpy.celtypes.IntType.__lt__",false]],"__lt__() (celpy.celtypes.listtype method)":[[0,"celpy.celtypes.ListType.__lt__",false]],"__mod__() (celpy.celtypes.doubletype method)":[[0,"celpy.celtypes.DoubleType.__mod__",false]],"__mod__() (celpy.celtypes.inttype method)":[[0,"celpy.celtypes.IntType.__mod__",false]],"__mod__() (celpy.celtypes.uinttype method)":[[0,"celpy.celtypes.UintType.__mod__",false]],"__mod__() (celpy.evaluation.celevalerror method)":[[0,"celpy.evaluation.CELEvalError.__mod__",false]],"__mul__() (celpy.celtypes.inttype method)":[[0,"celpy.celtypes.IntType.__mul__",false]],"__mul__() (celpy.celtypes.uinttype method)":[[0,"celpy.celtypes.UintType.__mul__",false]],"__mul__() (celpy.evaluation.celevalerror method)":[[0,"celpy.evaluation.CELEvalError.__mul__",false]],"__ne__() (celpy.celtypes.doubletype method)":[[0,"celpy.celtypes.DoubleType.__ne__",false]],"__ne__() (celpy.celtypes.inttype method)":[[0,"celpy.celtypes.IntType.__ne__",false]],"__ne__() (celpy.celtypes.listtype method)":[[0,"celpy.celtypes.ListType.__ne__",false]],"__ne__() (celpy.celtypes.maptype method)":[[0,"celpy.celtypes.MapType.__ne__",false]],"__ne__() (celpy.celtypes.nulltype method)":[[0,"celpy.celtypes.NullType.__ne__",false]],"__ne__() (celpy.celtypes.stringtype method)":[[0,"celpy.celtypes.StringType.__ne__",false]],"__ne__() (celpy.celtypes.uinttype method)":[[0,"celpy.celtypes.UintType.__ne__",false]],"__neg__() (celpy.celtypes.booltype method)":[[0,"celpy.celtypes.BoolType.__neg__",false]],"__neg__() (celpy.celtypes.doubletype method)":[[0,"celpy.celtypes.DoubleType.__neg__",false]],"__neg__() (celpy.celtypes.inttype method)":[[0,"celpy.celtypes.IntType.__neg__",false]],"__neg__() (celpy.celtypes.uinttype method)":[[0,"celpy.celtypes.UintType.__neg__",false]],"__neg__() (celpy.evaluation.celevalerror method)":[[0,"celpy.evaluation.CELEvalError.__neg__",false]],"__new__() (celpy.__init__.int32value static method)":[[0,"celpy.__init__.Int32Value.__new__",false]],"__new__() (celpy.celtypes.booltype static method)":[[0,"celpy.celtypes.BoolType.__new__",false]],"__new__() (celpy.celtypes.bytestype static method)":[[0,"celpy.celtypes.BytesType.__new__",false]],"__new__() (celpy.celtypes.doubletype static method)":[[0,"celpy.celtypes.DoubleType.__new__",false]],"__new__() (celpy.celtypes.durationtype static method)":[[0,"celpy.celtypes.DurationType.__new__",false]],"__new__() (celpy.celtypes.inttype static method)":[[0,"celpy.celtypes.IntType.__new__",false]],"__new__() (celpy.celtypes.stringtype static method)":[[0,"celpy.celtypes.StringType.__new__",false]],"__new__() (celpy.celtypes.timestamptype static method)":[[0,"celpy.celtypes.TimestampType.__new__",false]],"__new__() (celpy.celtypes.typetype static method)":[[0,"celpy.celtypes.TypeType.__new__",false]],"__new__() (celpy.celtypes.uinttype static method)":[[0,"celpy.celtypes.UintType.__new__",false]],"__orig_bases__ (celpy.celtypes.listtype attribute)":[[0,"celpy.celtypes.ListType.__orig_bases__",false]],"__orig_bases__ (celpy.celtypes.maptype attribute)":[[0,"celpy.celtypes.MapType.__orig_bases__",false]],"__orig_bases__ (celpy.evaluation.namecontainer attribute)":[[0,"celpy.evaluation.NameContainer.__orig_bases__",false]],"__parameters__ (celpy.celparser.dumpast attribute)":[[0,"celpy.celparser.DumpAST.__parameters__",false]],"__parameters__ (celpy.celtypes.listtype attribute)":[[0,"celpy.celtypes.ListType.__parameters__",false]],"__parameters__ (celpy.celtypes.maptype attribute)":[[0,"celpy.celtypes.MapType.__parameters__",false]],"__parameters__ (celpy.celtypes.messagetype attribute)":[[0,"celpy.celtypes.MessageType.__parameters__",false]],"__parameters__ (celpy.celtypes.packagetype attribute)":[[0,"celpy.celtypes.PackageType.__parameters__",false]],"__parameters__ (celpy.evaluation.evaluator attribute)":[[0,"celpy.evaluation.Evaluator.__parameters__",false]],"__parameters__ (celpy.evaluation.namecontainer attribute)":[[0,"celpy.evaluation.NameContainer.__parameters__",false]],"__parameters__ (celpy.evaluation.phase1transpiler attribute)":[[0,"celpy.evaluation.Phase1Transpiler.__parameters__",false]],"__parameters__ (celpy.evaluation.phase2transpiler attribute)":[[0,"celpy.evaluation.Phase2Transpiler.__parameters__",false]],"__parameters__ (celpy.evaluation.transpilertree attribute)":[[0,"celpy.evaluation.TranspilerTree.__parameters__",false]],"__pow__() (celpy.evaluation.celevalerror method)":[[0,"celpy.evaluation.CELEvalError.__pow__",false]],"__radd__() (celpy.celtypes.durationtype method)":[[0,"celpy.celtypes.DurationType.__radd__",false]],"__radd__() (celpy.celtypes.inttype method)":[[0,"celpy.celtypes.IntType.__radd__",false]],"__radd__() (celpy.celtypes.timestamptype method)":[[0,"celpy.celtypes.TimestampType.__radd__",false]],"__radd__() (celpy.celtypes.uinttype method)":[[0,"celpy.celtypes.UintType.__radd__",false]],"__radd__() (celpy.evaluation.celevalerror method)":[[0,"celpy.evaluation.CELEvalError.__radd__",false]],"__repr__() (celpy.__init__.environment method)":[[0,"celpy.__init__.Environment.__repr__",false]],"__repr__() (celpy.__init__.runner method)":[[0,"celpy.__init__.Runner.__repr__",false]],"__repr__() (celpy.c7nlib.c7ncontext method)":[[0,"celpy.c7nlib.C7NContext.__repr__",false]],"__repr__() (celpy.celtypes.booltype method)":[[0,"celpy.celtypes.BoolType.__repr__",false]],"__repr__() (celpy.celtypes.bytestype method)":[[0,"celpy.celtypes.BytesType.__repr__",false]],"__repr__() (celpy.celtypes.doubletype method)":[[0,"celpy.celtypes.DoubleType.__repr__",false]],"__repr__() (celpy.celtypes.durationtype method)":[[0,"celpy.celtypes.DurationType.__repr__",false]],"__repr__() (celpy.celtypes.inttype method)":[[0,"celpy.celtypes.IntType.__repr__",false]],"__repr__() (celpy.celtypes.listtype method)":[[0,"celpy.celtypes.ListType.__repr__",false]],"__repr__() (celpy.celtypes.maptype method)":[[0,"celpy.celtypes.MapType.__repr__",false]],"__repr__() (celpy.celtypes.stringtype method)":[[0,"celpy.celtypes.StringType.__repr__",false]],"__repr__() (celpy.celtypes.timestamptype method)":[[0,"celpy.celtypes.TimestampType.__repr__",false]],"__repr__() (celpy.celtypes.uinttype method)":[[0,"celpy.celtypes.UintType.__repr__",false]],"__repr__() (celpy.evaluation.activation method)":[[0,"celpy.evaluation.Activation.__repr__",false]],"__repr__() (celpy.evaluation.celevalerror method)":[[0,"celpy.evaluation.CELEvalError.__repr__",false]],"__repr__() (celpy.evaluation.namecontainer method)":[[0,"celpy.evaluation.NameContainer.__repr__",false]],"__repr__() (celpy.evaluation.referent method)":[[0,"celpy.evaluation.Referent.__repr__",false]],"__rfloordiv__() (celpy.celtypes.inttype method)":[[0,"celpy.celtypes.IntType.__rfloordiv__",false]],"__rfloordiv__() (celpy.celtypes.uinttype method)":[[0,"celpy.celtypes.UintType.__rfloordiv__",false]],"__rfloordiv__() (celpy.evaluation.celevalerror method)":[[0,"celpy.evaluation.CELEvalError.__rfloordiv__",false]],"__rmod__() (celpy.celtypes.doubletype method)":[[0,"celpy.celtypes.DoubleType.__rmod__",false]],"__rmod__() (celpy.celtypes.inttype method)":[[0,"celpy.celtypes.IntType.__rmod__",false]],"__rmod__() (celpy.celtypes.uinttype method)":[[0,"celpy.celtypes.UintType.__rmod__",false]],"__rmod__() (celpy.evaluation.celevalerror method)":[[0,"celpy.evaluation.CELEvalError.__rmod__",false]],"__rmul__() (celpy.celtypes.inttype method)":[[0,"celpy.celtypes.IntType.__rmul__",false]],"__rmul__() (celpy.celtypes.uinttype method)":[[0,"celpy.celtypes.UintType.__rmul__",false]],"__rmul__() (celpy.evaluation.celevalerror method)":[[0,"celpy.evaluation.CELEvalError.__rmul__",false]],"__rpow__() (celpy.evaluation.celevalerror method)":[[0,"celpy.evaluation.CELEvalError.__rpow__",false]],"__rsub__() (celpy.celtypes.inttype method)":[[0,"celpy.celtypes.IntType.__rsub__",false]],"__rsub__() (celpy.celtypes.uinttype method)":[[0,"celpy.celtypes.UintType.__rsub__",false]],"__rsub__() (celpy.evaluation.celevalerror method)":[[0,"celpy.evaluation.CELEvalError.__rsub__",false]],"__rtruediv__() (celpy.celtypes.doubletype method)":[[0,"celpy.celtypes.DoubleType.__rtruediv__",false]],"__rtruediv__() (celpy.celtypes.inttype method)":[[0,"celpy.celtypes.IntType.__rtruediv__",false]],"__rtruediv__() (celpy.celtypes.uinttype method)":[[0,"celpy.celtypes.UintType.__rtruediv__",false]],"__rtruediv__() (celpy.evaluation.celevalerror method)":[[0,"celpy.evaluation.CELEvalError.__rtruediv__",false]],"__str__() (celpy.celtypes.booltype method)":[[0,"celpy.celtypes.BoolType.__str__",false]],"__str__() (celpy.celtypes.doubletype method)":[[0,"celpy.celtypes.DoubleType.__str__",false]],"__str__() (celpy.celtypes.durationtype method)":[[0,"celpy.celtypes.DurationType.__str__",false]],"__str__() (celpy.celtypes.inttype method)":[[0,"celpy.celtypes.IntType.__str__",false]],"__str__() (celpy.celtypes.timestamptype method)":[[0,"celpy.celtypes.TimestampType.__str__",false]],"__str__() (celpy.celtypes.uinttype method)":[[0,"celpy.celtypes.UintType.__str__",false]],"__sub__() (celpy.celtypes.inttype method)":[[0,"celpy.celtypes.IntType.__sub__",false]],"__sub__() (celpy.celtypes.timestamptype method)":[[0,"celpy.celtypes.TimestampType.__sub__",false]],"__sub__() (celpy.celtypes.uinttype method)":[[0,"celpy.celtypes.UintType.__sub__",false]],"__sub__() (celpy.evaluation.celevalerror method)":[[0,"celpy.evaluation.CELEvalError.__sub__",false]],"__truediv__() (celpy.celtypes.doubletype method)":[[0,"celpy.celtypes.DoubleType.__truediv__",false]],"__truediv__() (celpy.celtypes.inttype method)":[[0,"celpy.celtypes.IntType.__truediv__",false]],"__truediv__() (celpy.celtypes.uinttype method)":[[0,"celpy.celtypes.UintType.__truediv__",false]],"__truediv__() (celpy.evaluation.celevalerror method)":[[0,"celpy.evaluation.CELEvalError.__truediv__",false]],"absent() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.absent",false]],"activation (class in celpy.evaluation)":[[0,"celpy.evaluation.Activation",false]],"addition() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.addition",false]],"addition() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.addition",false]],"addition() (celpy.evaluation.phase1transpiler method)":[[0,"celpy.evaluation.Phase1Transpiler.addition",false]],"addition_add() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.addition_add",false]],"addition_sub() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.addition_sub",false]],"all_dbsubenet_groups() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.all_dbsubenet_groups",false]],"all_images() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.all_images",false]],"all_instance_profiles() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.all_instance_profiles",false]],"all_launch_configuration_names() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.all_launch_configuration_names",false]],"all_scan_groups() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.all_scan_groups",false]],"all_service_roles() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.all_service_roles",false]],"all_snapshots() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.all_snapshots",false]],"ambiguous_literals() (celpy.celparser.celparser static method)":[[0,"celpy.celparser.CELParser.ambiguous_literals",false]],"arg_type_value() (in module celpy.__main__)":[[0,"celpy.__main__.arg_type_value",false]],"arn_split() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.arn_split",false]],"bool_eq() (in module celpy.evaluation)":[[0,"celpy.evaluation.bool_eq",false]],"bool_ge() (in module celpy.evaluation)":[[0,"celpy.evaluation.bool_ge",false]],"bool_gt() (in module celpy.evaluation)":[[0,"celpy.evaluation.bool_gt",false]],"bool_le() (in module celpy.evaluation)":[[0,"celpy.evaluation.bool_le",false]],"bool_lt() (in module celpy.evaluation)":[[0,"celpy.evaluation.bool_lt",false]],"bool_ne() (in module celpy.evaluation)":[[0,"celpy.evaluation.bool_ne",false]],"boolean() (in module celpy.evaluation)":[[0,"celpy.evaluation.boolean",false]],"booltype (class in celpy.celtypes)":[[0,"celpy.celtypes.BoolType",false]],"build_macro_eval() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.build_macro_eval",false]],"build_reduce_macro_eval() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.build_reduce_macro_eval",false]],"build_ss_macro_eval() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.build_ss_macro_eval",false]],"bytestype (class in celpy.celtypes)":[[0,"celpy.celtypes.BytesType",false]],"c7n_interpreted_runner (class in celpy.c7nlib)":[[0,"celpy.c7nlib.C7N_Interpreted_Runner",false]],"c7ncontext (class in celpy.c7nlib)":[[0,"celpy.c7nlib.C7NContext",false]],"cel_eval() (celpy.__main__.cel_repl method)":[[0,"celpy.__main__.CEL_REPL.cel_eval",false]],"cel_parser (celpy.celparser.celparser attribute)":[[0,"celpy.celparser.CELParser.CEL_PARSER",false]],"cel_repl (class in celpy.__main__)":[[0,"celpy.__main__.CEL_REPL",false]],"cel_trace":[[0,"index-0",false]],"celbytes() (in module celpy.evaluation)":[[0,"celpy.evaluation.celbytes",false]],"celevalerror":[[0,"celpy.evaluation.CELEvalError",false]],"celjsondecoder (class in celpy.adapter)":[[0,"celpy.adapter.CELJSONDecoder",false]],"celjsonencoder (class in celpy.adapter)":[[0,"celpy.adapter.CELJSONEncoder",false]],"celparseerror":[[0,"celpy.celparser.CELParseError",false]],"celparser (class in celpy.celparser)":[[0,"celpy.celparser.CELParser",false]],"celpy.__init__":[[0,"module-celpy.__init__",false]],"celpy.__main__":[[0,"module-celpy.__main__",false]],"celpy.adapter":[[0,"module-celpy.adapter",false]],"celpy.c7nlib":[[0,"module-celpy.c7nlib",false]],"celpy.celparser":[[0,"module-celpy.celparser",false]],"celpy.celtypes":[[0,"module-celpy.celtypes",false]],"celpy.evaluation":[[0,"module-celpy.evaluation",false]],"celstr() (in module celpy.evaluation)":[[0,"celpy.evaluation.celstr",false]],"celsyntaxerror":[[0,"celpy.evaluation.CELSyntaxError",false]],"celunsupportederror":[[0,"celpy.evaluation.CELUnsupportedError",false]],"children (celpy.evaluation.transpilertree attribute)":[[0,"celpy.evaluation.TranspilerTree.children",false]],"clone() (celpy.evaluation.activation method)":[[0,"celpy.evaluation.Activation.clone",false]],"clone() (celpy.evaluation.namecontainer method)":[[0,"celpy.evaluation.NameContainer.clone",false]],"clone() (celpy.evaluation.referent method)":[[0,"celpy.evaluation.Referent.clone",false]],"comparableversion (class in celpy.c7nlib)":[[0,"celpy.c7nlib.ComparableVersion",false]],"compile() (celpy.__init__.environment method)":[[0,"celpy.__init__.Environment.compile",false]],"compiledrunner (class in celpy.__init__)":[[0,"celpy.__init__.CompiledRunner",false]],"conditionaland() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.conditionaland",false]],"conditionaland() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.conditionaland",false]],"conditionaland() (celpy.evaluation.phase1transpiler method)":[[0,"celpy.evaluation.Phase1Transpiler.conditionaland",false]],"conditionaland() (celpy.evaluation.phase2transpiler method)":[[0,"celpy.evaluation.Phase2Transpiler.conditionaland",false]],"conditionalor() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.conditionalor",false]],"conditionalor() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.conditionalor",false]],"conditionalor() (celpy.evaluation.phase1transpiler method)":[[0,"celpy.evaluation.Phase1Transpiler.conditionalor",false]],"conditionalor() (celpy.evaluation.phase2transpiler method)":[[0,"celpy.evaluation.Phase2Transpiler.conditionalor",false]],"contains() (celpy.c7nlib.ipv4network method)":[[0,"celpy.c7nlib.IPv4Network.contains",false]],"contains() (celpy.celtypes.listtype method)":[[0,"celpy.celtypes.ListType.contains",false]],"contains() (celpy.celtypes.maptype method)":[[0,"celpy.celtypes.MapType.contains",false]],"contains() (celpy.celtypes.stringtype method)":[[0,"celpy.celtypes.StringType.contains",false]],"credentials() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.credentials",false]],"data (celpy.evaluation.transpilertree attribute)":[[0,"celpy.evaluation.TranspilerTree.data",false]],"decode() (celpy.adapter.celjsondecoder method)":[[0,"celpy.adapter.CELJSONDecoder.decode",false]],"default() (celpy.__main__.cel_repl method)":[[0,"celpy.__main__.CEL_REPL.default",false]],"default() (celpy.adapter.celjsonencoder method)":[[0,"celpy.adapter.CELJSONEncoder.default",false]],"describe_db_snapshot_attributes() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.describe_db_snapshot_attributes",false]],"describe_subscription_filters() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.describe_subscription_filters",false]],"dict_find_name() (celpy.evaluation.namecontainer static method)":[[0,"celpy.evaluation.NameContainer.dict_find_name",false]],"difference() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.difference",false]],"display() (celpy.celparser.dumpast class method)":[[0,"celpy.celparser.DumpAST.display",false]],"do_bye() (celpy.__main__.cel_repl method)":[[0,"celpy.__main__.CEL_REPL.do_bye",false]],"do_eof() (celpy.__main__.cel_repl method)":[[0,"celpy.__main__.CEL_REPL.do_EOF",false]],"do_exit() (celpy.__main__.cel_repl method)":[[0,"celpy.__main__.CEL_REPL.do_exit",false]],"do_quit() (celpy.__main__.cel_repl method)":[[0,"celpy.__main__.CEL_REPL.do_quit",false]],"do_set() (celpy.__main__.cel_repl method)":[[0,"celpy.__main__.CEL_REPL.do_set",false]],"do_show() (celpy.__main__.cel_repl method)":[[0,"celpy.__main__.CEL_REPL.do_show",false]],"dot_ident() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.dot_ident",false]],"dot_ident() (celpy.evaluation.phase1transpiler method)":[[0,"celpy.evaluation.Phase1Transpiler.dot_ident",false]],"dot_ident_arg() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.dot_ident_arg",false]],"dot_ident_arg() (celpy.evaluation.phase1transpiler method)":[[0,"celpy.evaluation.Phase1Transpiler.dot_ident_arg",false]],"doubletype (class in celpy.celtypes)":[[0,"celpy.celtypes.DoubleType",false]],"dumpast (class in celpy.celparser)":[[0,"celpy.celparser.DumpAST",false]],"durationtype (class in celpy.celtypes)":[[0,"celpy.celtypes.DurationType",false]],"encode() (celpy.adapter.celjsonencoder method)":[[0,"celpy.adapter.CELJSONEncoder.encode",false]],"environment (class in celpy.__init__)":[[0,"celpy.__init__.Environment",false]],"environment variable":[[0,"index-0",false]],"error_text() (celpy.celparser.celparser method)":[[0,"celpy.celparser.CELParser.error_text",false]],"eval_error() (in module celpy.evaluation)":[[0,"celpy.evaluation.eval_error",false]],"evaluate() (celpy.__init__.compiledrunner method)":[[0,"celpy.__init__.CompiledRunner.evaluate",false]],"evaluate() (celpy.__init__.interpretedrunner method)":[[0,"celpy.__init__.InterpretedRunner.evaluate",false]],"evaluate() (celpy.__init__.runner method)":[[0,"celpy.__init__.Runner.evaluate",false]],"evaluate() (celpy.c7nlib.c7n_interpreted_runner method)":[[0,"celpy.c7nlib.C7N_Interpreted_Runner.evaluate",false]],"evaluate() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.evaluate",false]],"evaluate() (celpy.evaluation.transpiler method)":[[0,"celpy.evaluation.Transpiler.evaluate",false]],"evaluator (class in celpy.evaluation)":[[0,"celpy.evaluation.Evaluator",false]],"expr() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.expr",false]],"expr() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.expr",false]],"expr() (celpy.evaluation.phase1transpiler method)":[[0,"celpy.evaluation.Phase1Transpiler.expr",false]],"expr() (celpy.evaluation.phase2transpiler method)":[[0,"celpy.evaluation.Phase2Transpiler.expr",false]],"exprlist() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.exprlist",false]],"exprlist() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.exprlist",false]],"exprlist() (celpy.evaluation.phase1transpiler method)":[[0,"celpy.evaluation.Phase1Transpiler.exprlist",false]],"extended_name_path (celpy.evaluation.namecontainer attribute)":[[0,"celpy.evaluation.NameContainer.extended_name_path",false]],"fieldinits() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.fieldinits",false]],"fieldinits() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.fieldinits",false]],"fieldinits() (celpy.evaluation.phase1transpiler method)":[[0,"celpy.evaluation.Phase1Transpiler.fieldinits",false]],"find_name() (celpy.evaluation.namecontainer method)":[[0,"celpy.evaluation.NameContainer.find_name",false]],"flow_logs() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.flow_logs",false]],"func_name() (celpy.evaluation.phase1transpiler method)":[[0,"celpy.evaluation.Phase1Transpiler.func_name",false]],"function_contains() (in module celpy.evaluation)":[[0,"celpy.evaluation.function_contains",false]],"function_endswith() (in module celpy.evaluation)":[[0,"celpy.evaluation.function_endsWith",false]],"function_eval() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.function_eval",false]],"function_getdate() (in module celpy.evaluation)":[[0,"celpy.evaluation.function_getDate",false]],"function_getdayofmonth() (in module celpy.evaluation)":[[0,"celpy.evaluation.function_getDayOfMonth",false]],"function_getdayofweek() (in module celpy.evaluation)":[[0,"celpy.evaluation.function_getDayOfWeek",false]],"function_getdayofyear() (in module celpy.evaluation)":[[0,"celpy.evaluation.function_getDayOfYear",false]],"function_getfullyear() (in module celpy.evaluation)":[[0,"celpy.evaluation.function_getFullYear",false]],"function_gethours() (in module celpy.evaluation)":[[0,"celpy.evaluation.function_getHours",false]],"function_getmilliseconds() (in module celpy.evaluation)":[[0,"celpy.evaluation.function_getMilliseconds",false]],"function_getminutes() (in module celpy.evaluation)":[[0,"celpy.evaluation.function_getMinutes",false]],"function_getmonth() (in module celpy.evaluation)":[[0,"celpy.evaluation.function_getMonth",false]],"function_getseconds() (in module celpy.evaluation)":[[0,"celpy.evaluation.function_getSeconds",false]],"function_matches() (in module celpy.evaluation)":[[0,"celpy.evaluation.function_matches",false]],"function_size() (in module celpy.evaluation)":[[0,"celpy.evaluation.function_size",false]],"function_startswith() (in module celpy.evaluation)":[[0,"celpy.evaluation.function_startsWith",false]],"functiontype (class in celpy.celtypes)":[[0,"celpy.celtypes.FunctionType",false]],"get() (celpy.celtypes.maptype method)":[[0,"celpy.celtypes.MapType.get",false]],"get() (celpy.evaluation.activation method)":[[0,"celpy.evaluation.Activation.get",false]],"get() (celpy.evaluation.namecontainer method)":[[0,"celpy.evaluation.NameContainer.get",false]],"get_access_log() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.get_access_log",false]],"get_accounts() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.get_accounts",false]],"get_endpoints() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.get_endpoints",false]],"get_health_events() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.get_health_events",false]],"get_key_policy() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.get_key_policy",false]],"get_load_balancer() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.get_load_balancer",false]],"get_metrics() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.get_metrics",false]],"get_options() (in module celpy.__main__)":[[0,"celpy.__main__.get_options",false]],"get_orgids() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.get_orgids",false]],"get_protocols() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.get_protocols",false]],"get_raw_health_events() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.get_raw_health_events",false]],"get_raw_metrics() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.get_raw_metrics",false]],"get_related_ids() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.get_related_ids",false]],"get_related_igws() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.get_related_igws",false]],"get_related_kms_keys() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.get_related_kms_keys",false]],"get_related_nat_gateways() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.get_related_nat_gateways",false]],"get_related_security_configs() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.get_related_security_configs",false]],"get_related_sgs() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.get_related_sgs",false]],"get_related_subnets() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.get_related_subnets",false]],"get_related_vpc() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.get_related_vpc",false]],"get_resource_policy() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.get_resource_policy",false]],"get_vpces() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.get_vpces",false]],"get_vpcs() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.get_vpcs",false]],"getdate() (celpy.celtypes.timestamptype method)":[[0,"celpy.celtypes.TimestampType.getDate",false]],"getdayofmonth() (celpy.celtypes.timestamptype method)":[[0,"celpy.celtypes.TimestampType.getDayOfMonth",false]],"getdayofweek() (celpy.celtypes.timestamptype method)":[[0,"celpy.celtypes.TimestampType.getDayOfWeek",false]],"getdayofyear() (celpy.celtypes.timestamptype method)":[[0,"celpy.celtypes.TimestampType.getDayOfYear",false]],"getfullyear() (celpy.celtypes.timestamptype method)":[[0,"celpy.celtypes.TimestampType.getFullYear",false]],"gethours() (celpy.celtypes.durationtype method)":[[0,"celpy.celtypes.DurationType.getHours",false]],"gethours() (celpy.celtypes.timestamptype method)":[[0,"celpy.celtypes.TimestampType.getHours",false]],"getmilliseconds() (celpy.celtypes.durationtype method)":[[0,"celpy.celtypes.DurationType.getMilliseconds",false]],"getmilliseconds() (celpy.celtypes.timestamptype method)":[[0,"celpy.celtypes.TimestampType.getMilliseconds",false]],"getminutes() (celpy.celtypes.durationtype method)":[[0,"celpy.celtypes.DurationType.getMinutes",false]],"getminutes() (celpy.celtypes.timestamptype method)":[[0,"celpy.celtypes.TimestampType.getMinutes",false]],"getmonth() (celpy.celtypes.timestamptype method)":[[0,"celpy.celtypes.TimestampType.getMonth",false]],"getseconds() (celpy.celtypes.durationtype method)":[[0,"celpy.celtypes.DurationType.getSeconds",false]],"getseconds() (celpy.celtypes.timestamptype method)":[[0,"celpy.celtypes.TimestampType.getSeconds",false]],"glob() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.glob",false]],"ident() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.ident",false]],"ident() (celpy.evaluation.phase1transpiler method)":[[0,"celpy.evaluation.Phase1Transpiler.ident",false]],"ident_arg() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.ident_arg",false]],"ident_arg() (celpy.evaluation.phase1transpiler method)":[[0,"celpy.evaluation.Phase1Transpiler.ident_arg",false]],"ident_arg() (celpy.evaluation.phase2transpiler method)":[[0,"celpy.evaluation.Phase2Transpiler.ident_arg",false]],"ident_pat (celpy.evaluation.namecontainer attribute)":[[0,"celpy.evaluation.NameContainer.ident_pat",false]],"ident_value() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.ident_value",false]],"image() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.image",false]],"int32value (class in celpy.__init__)":[[0,"celpy.__init__.Int32Value",false]],"int64() (in module celpy.celtypes)":[[0,"celpy.celtypes.int64",false]],"interpretedrunner (class in celpy.__init__)":[[0,"celpy.__init__.InterpretedRunner",false]],"intersect() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.intersect",false]],"intro (celpy.__main__.cel_repl attribute)":[[0,"celpy.__main__.CEL_REPL.intro",false]],"inttype (class in celpy.celtypes)":[[0,"celpy.celtypes.IntType",false]],"ipv4network (class in celpy.c7nlib)":[[0,"celpy.c7nlib.IPv4Network",false]],"jmes_path() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.jmes_path",false]],"jmes_path_map() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.jmes_path_map",false]],"json_to_cel() (in module celpy.adapter)":[[0,"celpy.adapter.json_to_cel",false]],"key() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.key",false]],"kms_alias() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.kms_alias",false]],"kms_key() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.kms_key",false]],"list_lit() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.list_lit",false]],"list_lit() (celpy.evaluation.phase1transpiler method)":[[0,"celpy.evaluation.Phase1Transpiler.list_lit",false]],"listtype (class in celpy.celtypes)":[[0,"celpy.celtypes.ListType",false]],"literal() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.literal",false]],"literal() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.literal",false]],"literal() (celpy.evaluation.phase1transpiler method)":[[0,"celpy.evaluation.Phase1Transpiler.literal",false]],"load_annotations() (celpy.evaluation.namecontainer method)":[[0,"celpy.evaluation.NameContainer.load_annotations",false]],"load_values() (celpy.evaluation.namecontainer method)":[[0,"celpy.evaluation.NameContainer.load_values",false]],"logger (celpy.__main__.cel_repl attribute)":[[0,"celpy.__main__.CEL_REPL.logger",false]],"logger (celpy.evaluation.evaluator attribute)":[[0,"celpy.evaluation.Evaluator.logger",false]],"logger (celpy.evaluation.namecontainer attribute)":[[0,"celpy.evaluation.NameContainer.logger",false]],"logger (celpy.evaluation.transpiler attribute)":[[0,"celpy.evaluation.Transpiler.logger",false]],"logical_and() (in module celpy.celtypes)":[[0,"celpy.celtypes.logical_and",false]],"logical_condition() (in module celpy.celtypes)":[[0,"celpy.celtypes.logical_condition",false]],"logical_not() (in module celpy.celtypes)":[[0,"celpy.celtypes.logical_not",false]],"logical_or() (in module celpy.celtypes)":[[0,"celpy.celtypes.logical_or",false]],"macro_all() (in module celpy.evaluation)":[[0,"celpy.evaluation.macro_all",false]],"macro_exists() (in module celpy.evaluation)":[[0,"celpy.evaluation.macro_exists",false]],"macro_exists_one() (in module celpy.evaluation)":[[0,"celpy.evaluation.macro_exists_one",false]],"macro_filter() (in module celpy.evaluation)":[[0,"celpy.evaluation.macro_filter",false]],"macro_has_eval() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.macro_has_eval",false]],"macro_map() (in module celpy.evaluation)":[[0,"celpy.evaluation.macro_map",false]],"main() (in module celpy.__main__)":[[0,"celpy.__main__.main",false]],"map_lit() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.map_lit",false]],"map_lit() (celpy.evaluation.phase1transpiler method)":[[0,"celpy.evaluation.Phase1Transpiler.map_lit",false]],"mapinits() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.mapinits",false]],"mapinits() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.mapinits",false]],"mapinits() (celpy.evaluation.phase1transpiler method)":[[0,"celpy.evaluation.Phase1Transpiler.mapinits",false]],"maptype (class in celpy.celtypes)":[[0,"celpy.celtypes.MapType",false]],"marked_key() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.marked_key",false]],"maxseconds (celpy.celtypes.durationtype attribute)":[[0,"celpy.celtypes.DurationType.MaxSeconds",false]],"member() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.member",false]],"member() (celpy.evaluation.phase1transpiler method)":[[0,"celpy.evaluation.Phase1Transpiler.member",false]],"member_dot() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.member_dot",false]],"member_dot() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.member_dot",false]],"member_dot() (celpy.evaluation.phase1transpiler method)":[[0,"celpy.evaluation.Phase1Transpiler.member_dot",false]],"member_dot_arg() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.member_dot_arg",false]],"member_dot_arg() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.member_dot_arg",false]],"member_dot_arg() (celpy.evaluation.phase1transpiler method)":[[0,"celpy.evaluation.Phase1Transpiler.member_dot_arg",false]],"member_dot_arg() (celpy.evaluation.phase2transpiler method)":[[0,"celpy.evaluation.Phase2Transpiler.member_dot_arg",false]],"member_index() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.member_index",false]],"member_index() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.member_index",false]],"member_index() (celpy.evaluation.phase1transpiler method)":[[0,"celpy.evaluation.Phase1Transpiler.member_index",false]],"member_object() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.member_object",false]],"member_object() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.member_object",false]],"member_object() (celpy.evaluation.phase1transpiler method)":[[0,"celpy.evaluation.Phase1Transpiler.member_object",false]],"messagetype (class in celpy.celtypes)":[[0,"celpy.celtypes.MessageType",false]],"method_eval() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.method_eval",false]],"minseconds (celpy.celtypes.durationtype attribute)":[[0,"celpy.celtypes.DurationType.MinSeconds",false]],"module":[[0,"module-celpy.__init__",false],[0,"module-celpy.__main__",false],[0,"module-celpy.adapter",false],[0,"module-celpy.c7nlib",false],[0,"module-celpy.celparser",false],[0,"module-celpy.celtypes",false],[0,"module-celpy.evaluation",false]],"multiplication() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.multiplication",false]],"multiplication() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.multiplication",false]],"multiplication() (celpy.evaluation.phase1transpiler method)":[[0,"celpy.evaluation.Phase1Transpiler.multiplication",false]],"multiplication_div() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.multiplication_div",false]],"multiplication_mod() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.multiplication_mod",false]],"multiplication_mul() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.multiplication_mul",false]],"namecontainer (class in celpy.evaluation)":[[0,"celpy.evaluation.NameContainer",false]],"namecontainer.notfound":[[0,"celpy.evaluation.NameContainer.NotFound",false]],"nanosecondspersecond (celpy.celtypes.durationtype attribute)":[[0,"celpy.celtypes.DurationType.NanosecondsPerSecond",false]],"nested_activation() (celpy.evaluation.activation method)":[[0,"celpy.evaluation.Activation.nested_activation",false]],"new_activation() (celpy.__init__.runner method)":[[0,"celpy.__init__.Runner.new_activation",false]],"normalize() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.normalize",false]],"nulltype (class in celpy.celtypes)":[[0,"celpy.celtypes.NullType",false]],"operator_in() (in module celpy.evaluation)":[[0,"celpy.evaluation.operator_in",false]],"packagetype (class in celpy.celtypes)":[[0,"celpy.celtypes.PackageType",false]],"paren_expr() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.paren_expr",false]],"paren_expr() (celpy.evaluation.phase1transpiler method)":[[0,"celpy.evaluation.Phase1Transpiler.paren_expr",false]],"parent_iter() (celpy.evaluation.namecontainer method)":[[0,"celpy.evaluation.NameContainer.parent_iter",false]],"parse() (celpy.celparser.celparser method)":[[0,"celpy.celparser.CELParser.parse",false]],"parse_cidr() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.parse_cidr",false]],"parse_text() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.parse_text",false]],"phase1transpiler (class in celpy.evaluation)":[[0,"celpy.evaluation.Phase1Transpiler",false]],"phase2transpiler (class in celpy.evaluation)":[[0,"celpy.evaluation.Phase2Transpiler",false]],"preloop() (celpy.__main__.cel_repl method)":[[0,"celpy.__main__.CEL_REPL.preloop",false]],"present() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.present",false]],"primary() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.primary",false]],"primary() (celpy.evaluation.phase1transpiler method)":[[0,"celpy.evaluation.Phase1Transpiler.primary",false]],"process_json_doc() (in module celpy.__main__)":[[0,"celpy.__main__.process_json_doc",false]],"program() (celpy.__init__.environment method)":[[0,"celpy.__init__.Environment.program",false]],"prompt (celpy.__main__.cel_repl attribute)":[[0,"celpy.__main__.CEL_REPL.prompt",false]],"referent (class in celpy.evaluation)":[[0,"celpy.evaluation.Referent",false]],"relation() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.relation",false]],"relation() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.relation",false]],"relation() (celpy.evaluation.phase1transpiler method)":[[0,"celpy.evaluation.Phase1Transpiler.relation",false]],"relation_eq() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.relation_eq",false]],"relation_ge() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.relation_ge",false]],"relation_gt() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.relation_gt",false]],"relation_in() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.relation_in",false]],"relation_le() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.relation_le",false]],"relation_lt() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.relation_lt",false]],"relation_ne() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.relation_ne",false]],"resolve_function() (celpy.evaluation.activation method)":[[0,"celpy.evaluation.Activation.resolve_function",false]],"resolve_name() (celpy.evaluation.namecontainer method)":[[0,"celpy.evaluation.NameContainer.resolve_name",false]],"resolve_variable() (celpy.evaluation.activation method)":[[0,"celpy.evaluation.Activation.resolve_variable",false]],"resource_schedule() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.resource_schedule",false]],"result() (in module celpy.evaluation)":[[0,"celpy.evaluation.result",false]],"runner (class in celpy.__init__)":[[0,"celpy.__init__.Runner",false]],"scale (celpy.celtypes.durationtype attribute)":[[0,"celpy.celtypes.DurationType.scale",false]],"security_group() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.security_group",false]],"set_activation() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.set_activation",false]],"shield_protection() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.shield_protection",false]],"shield_subscription() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.shield_subscription",false]],"size_parse_cidr() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.size_parse_cidr",false]],"stat() (in module celpy.__main__)":[[0,"celpy.__main__.stat",false]],"statements() (celpy.evaluation.phase2transpiler method)":[[0,"celpy.evaluation.Phase2Transpiler.statements",false]],"stringtype (class in celpy.celtypes)":[[0,"celpy.celtypes.StringType",false]],"sub_evaluator() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.sub_evaluator",false]],"subnet() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.subnet",false]],"subst() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.subst",false]],"text_from() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.text_from",false]],"the_activation (in module celpy.evaluation)":[[0,"celpy.evaluation.the_activation",false]],"timestamptype (class in celpy.celtypes)":[[0,"celpy.celtypes.TimestampType",false]],"to_python() (celpy.adapter.celjsonencoder static method)":[[0,"celpy.adapter.CELJSONEncoder.to_python",false]],"trace() (in module celpy.evaluation)":[[0,"celpy.evaluation.trace",false]],"transpile() (celpy.evaluation.transpiler method)":[[0,"celpy.evaluation.Transpiler.transpile",false]],"transpiler (class in celpy.evaluation)":[[0,"celpy.evaluation.Transpiler",false]],"transpilertree (class in celpy.evaluation)":[[0,"celpy.evaluation.TranspilerTree",false]],"tree_dump() (in module celpy.celparser)":[[0,"celpy.celparser.tree_dump",false]],"tree_node_class (celpy.__init__.compiledrunner attribute)":[[0,"celpy.__init__.CompiledRunner.tree_node_class",false]],"tree_node_class (celpy.__init__.runner attribute)":[[0,"celpy.__init__.Runner.tree_node_class",false]],"type_matched() (in module celpy.celtypes)":[[0,"celpy.celtypes.type_matched",false]],"typetype (class in celpy.celtypes)":[[0,"celpy.celtypes.TypeType",false]],"tz_aliases (celpy.celtypes.timestamptype attribute)":[[0,"celpy.celtypes.TimestampType.TZ_ALIASES",false]],"tz_name_lookup() (celpy.celtypes.timestamptype class method)":[[0,"celpy.celtypes.TimestampType.tz_name_lookup",false]],"tz_offset_parse() (celpy.celtypes.timestamptype class method)":[[0,"celpy.celtypes.TimestampType.tz_offset_parse",false]],"tz_parse() (celpy.celtypes.timestamptype static method)":[[0,"celpy.celtypes.TimestampType.tz_parse",false]],"uint64() (in module celpy.celtypes)":[[0,"celpy.celtypes.uint64",false]],"uinttype (class in celpy.celtypes)":[[0,"celpy.celtypes.UintType",false]],"unary() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.unary",false]],"unary() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.unary",false]],"unary() (celpy.evaluation.phase1transpiler method)":[[0,"celpy.evaluation.Phase1Transpiler.unary",false]],"unary_neg() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.unary_neg",false]],"unary_not() (celpy.celparser.dumpast method)":[[0,"celpy.celparser.DumpAST.unary_not",false]],"unique_size() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.unique_size",false]],"valid_key_type() (celpy.celtypes.maptype static method)":[[0,"celpy.celtypes.MapType.valid_key_type",false]],"value (celpy.evaluation.referent property)":[[0,"celpy.evaluation.Referent.value",false]],"value_from() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.value_from",false]],"version() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.version",false]],"visit() (celpy.evaluation.phase1transpiler method)":[[0,"celpy.evaluation.Phase1Transpiler.visit",false]],"visit_children() (celpy.evaluation.evaluator method)":[[0,"celpy.evaluation.Evaluator.visit_children",false]],"vpc() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.vpc",false]],"web_acls() (in module celpy.c7nlib)":[[0,"celpy.c7nlib.web_acls",false]],"with_traceback() (celpy.evaluation.celevalerror method)":[[0,"celpy.evaluation.CELEvalError.with_traceback",false]]},"objects":{"celpy":[[0,0,0,"-","__init__"],[0,0,0,"-","__main__"],[0,0,0,"-","adapter"],[0,0,0,"-","c7nlib"],[0,0,0,"-","celparser"],[0,0,0,"-","celtypes"],[0,0,0,"-","evaluation"],[2,8,1,"cmdoption-celpy-a","--arg"],[2,8,1,"cmdoption-celpy-b","--boolean"],[2,8,1,"cmdoption-celpy-f","--format"],[2,8,1,"cmdoption-celpy-i","--interactive"],[2,8,1,"cmdoption-celpy-d","--json-document"],[2,8,1,"cmdoption-celpy-p","--json-package"],[2,8,1,"cmdoption-celpy-n","--null-input"],[2,8,1,"cmdoption-celpy-s","--slurp"],[2,8,1,"cmdoption-celpy-a","-a"],[2,8,1,"cmdoption-celpy-b","-b"],[2,8,1,"cmdoption-celpy-d","-d"],[2,8,1,"cmdoption-celpy-f","-f"],[2,8,1,"cmdoption-celpy-i","-i"],[2,8,1,"cmdoption-celpy-n","-n"],[2,8,1,"cmdoption-celpy-p","-p"],[2,8,1,"cmdoption-celpy-s","-s"],[2,8,1,"cmdoption-celpy-arg-expr","expr"]],"celpy.__init__":[[0,1,1,"","CompiledRunner"],[0,1,1,"","Environment"],[0,1,1,"","Int32Value"],[0,1,1,"","InterpretedRunner"],[0,1,1,"","Runner"]],"celpy.__init__.CompiledRunner":[[0,2,1,"","__abstractmethods__"],[0,3,1,"","__init__"],[0,3,1,"","evaluate"],[0,2,1,"","tree_node_class"]],"celpy.__init__.Environment":[[0,3,1,"","__init__"],[0,3,1,"","__repr__"],[0,3,1,"","compile"],[0,3,1,"","program"]],"celpy.__init__.Int32Value":[[0,3,1,"","__new__"]],"celpy.__init__.InterpretedRunner":[[0,2,1,"","__abstractmethods__"],[0,3,1,"","evaluate"]],"celpy.__init__.Runner":[[0,2,1,"","__abstractmethods__"],[0,3,1,"","__init__"],[0,3,1,"","__repr__"],[0,3,1,"","evaluate"],[0,3,1,"","new_activation"],[0,2,1,"","tree_node_class"]],"celpy.__main__":[[0,1,1,"","CEL_REPL"],[0,4,1,"","arg_type_value"],[0,4,1,"","get_options"],[0,4,1,"","main"],[0,4,1,"","process_json_doc"],[0,4,1,"","stat"]],"celpy.__main__.CEL_REPL":[[0,3,1,"","cel_eval"],[0,3,1,"","default"],[0,3,1,"","do_EOF"],[0,3,1,"","do_bye"],[0,3,1,"","do_exit"],[0,3,1,"","do_quit"],[0,3,1,"","do_set"],[0,3,1,"","do_show"],[0,2,1,"","intro"],[0,2,1,"","logger"],[0,3,1,"","preloop"],[0,2,1,"","prompt"]],"celpy.adapter":[[0,1,1,"","CELJSONDecoder"],[0,1,1,"","CELJSONEncoder"],[0,4,1,"","json_to_cel"]],"celpy.adapter.CELJSONDecoder":[[0,3,1,"","decode"]],"celpy.adapter.CELJSONEncoder":[[0,3,1,"","default"],[0,3,1,"","encode"],[0,3,1,"","to_python"]],"celpy.c7nlib":[[0,1,1,"","C7NContext"],[0,1,1,"","C7N_Interpreted_Runner"],[0,1,1,"","ComparableVersion"],[0,1,1,"","IPv4Network"],[0,4,1,"","absent"],[0,4,1,"","all_dbsubenet_groups"],[0,4,1,"","all_images"],[0,4,1,"","all_instance_profiles"],[0,4,1,"","all_launch_configuration_names"],[0,4,1,"","all_scan_groups"],[0,4,1,"","all_service_roles"],[0,4,1,"","all_snapshots"],[0,4,1,"","arn_split"],[0,4,1,"","credentials"],[0,4,1,"","describe_db_snapshot_attributes"],[0,4,1,"","describe_subscription_filters"],[0,4,1,"","difference"],[0,4,1,"","flow_logs"],[0,4,1,"","get_access_log"],[0,4,1,"","get_accounts"],[0,4,1,"","get_endpoints"],[0,4,1,"","get_health_events"],[0,4,1,"","get_key_policy"],[0,4,1,"","get_load_balancer"],[0,4,1,"","get_metrics"],[0,4,1,"","get_orgids"],[0,4,1,"","get_protocols"],[0,4,1,"","get_raw_health_events"],[0,4,1,"","get_raw_metrics"],[0,4,1,"","get_related_ids"],[0,4,1,"","get_related_igws"],[0,4,1,"","get_related_kms_keys"],[0,4,1,"","get_related_nat_gateways"],[0,4,1,"","get_related_security_configs"],[0,4,1,"","get_related_sgs"],[0,4,1,"","get_related_subnets"],[0,4,1,"","get_related_vpc"],[0,4,1,"","get_resource_policy"],[0,4,1,"","get_vpces"],[0,4,1,"","get_vpcs"],[0,4,1,"","glob"],[0,4,1,"","image"],[0,4,1,"","intersect"],[0,4,1,"","jmes_path"],[0,4,1,"","jmes_path_map"],[0,4,1,"","key"],[0,4,1,"","kms_alias"],[0,4,1,"","kms_key"],[0,4,1,"","marked_key"],[0,4,1,"","normalize"],[0,4,1,"","parse_cidr"],[0,4,1,"","parse_text"],[0,4,1,"","present"],[0,4,1,"","resource_schedule"],[0,4,1,"","security_group"],[0,4,1,"","shield_protection"],[0,4,1,"","shield_subscription"],[0,4,1,"","size_parse_cidr"],[0,4,1,"","subnet"],[0,4,1,"","subst"],[0,4,1,"","text_from"],[0,4,1,"","unique_size"],[0,4,1,"","value_from"],[0,4,1,"","version"],[0,4,1,"","vpc"],[0,4,1,"","web_acls"]],"celpy.c7nlib.C7NContext":[[0,3,1,"","__enter__"],[0,3,1,"","__exit__"],[0,3,1,"","__init__"],[0,3,1,"","__repr__"]],"celpy.c7nlib.C7N_Interpreted_Runner":[[0,2,1,"","__abstractmethods__"],[0,3,1,"","evaluate"]],"celpy.c7nlib.ComparableVersion":[[0,3,1,"","__eq__"],[0,2,1,"","__hash__"]],"celpy.c7nlib.IPv4Network":[[0,3,1,"","__contains__"],[0,3,1,"","contains"]],"celpy.celparser":[[0,5,1,"","CELParseError"],[0,1,1,"","CELParser"],[0,1,1,"","DumpAST"],[0,4,1,"","tree_dump"]],"celpy.celparser.CELParseError":[[0,3,1,"","__init__"]],"celpy.celparser.CELParser":[[0,2,1,"","CEL_PARSER"],[0,3,1,"","__init__"],[0,3,1,"","ambiguous_literals"],[0,3,1,"","error_text"],[0,3,1,"","parse"]],"celpy.celparser.DumpAST":[[0,3,1,"","__init__"],[0,2,1,"","__parameters__"],[0,3,1,"","addition"],[0,3,1,"","addition_add"],[0,3,1,"","addition_sub"],[0,3,1,"","conditionaland"],[0,3,1,"","conditionalor"],[0,3,1,"","display"],[0,3,1,"","dot_ident"],[0,3,1,"","dot_ident_arg"],[0,3,1,"","expr"],[0,3,1,"","exprlist"],[0,3,1,"","fieldinits"],[0,3,1,"","ident"],[0,3,1,"","ident_arg"],[0,3,1,"","list_lit"],[0,3,1,"","literal"],[0,3,1,"","map_lit"],[0,3,1,"","mapinits"],[0,3,1,"","member_dot"],[0,3,1,"","member_dot_arg"],[0,3,1,"","member_index"],[0,3,1,"","member_object"],[0,3,1,"","multiplication"],[0,3,1,"","multiplication_div"],[0,3,1,"","multiplication_mod"],[0,3,1,"","multiplication_mul"],[0,3,1,"","paren_expr"],[0,3,1,"","relation"],[0,3,1,"","relation_eq"],[0,3,1,"","relation_ge"],[0,3,1,"","relation_gt"],[0,3,1,"","relation_in"],[0,3,1,"","relation_le"],[0,3,1,"","relation_lt"],[0,3,1,"","relation_ne"],[0,3,1,"","unary"],[0,3,1,"","unary_neg"],[0,3,1,"","unary_not"]],"celpy.celtypes":[[0,1,1,"","BoolType"],[0,1,1,"","BytesType"],[0,1,1,"","DoubleType"],[0,1,1,"","DurationType"],[0,1,1,"","FunctionType"],[0,1,1,"","IntType"],[0,1,1,"","ListType"],[0,1,1,"","MapType"],[0,1,1,"","MessageType"],[0,1,1,"","NullType"],[0,1,1,"","PackageType"],[0,1,1,"","StringType"],[0,1,1,"","TimestampType"],[0,1,1,"","TypeType"],[0,1,1,"","UintType"],[0,4,1,"","int64"],[0,4,1,"","logical_and"],[0,4,1,"","logical_condition"],[0,4,1,"","logical_not"],[0,4,1,"","logical_or"],[0,4,1,"","type_matched"],[0,4,1,"","uint64"]],"celpy.celtypes.BoolType":[[0,3,1,"","__hash__"],[0,3,1,"","__neg__"],[0,3,1,"","__new__"],[0,3,1,"","__repr__"],[0,3,1,"","__str__"]],"celpy.celtypes.BytesType":[[0,3,1,"","__new__"],[0,3,1,"","__repr__"]],"celpy.celtypes.DoubleType":[[0,3,1,"","__eq__"],[0,3,1,"","__hash__"],[0,3,1,"","__mod__"],[0,3,1,"","__ne__"],[0,3,1,"","__neg__"],[0,3,1,"","__new__"],[0,3,1,"","__repr__"],[0,3,1,"","__rmod__"],[0,3,1,"","__rtruediv__"],[0,3,1,"","__str__"],[0,3,1,"","__truediv__"]],"celpy.celtypes.DurationType":[[0,2,1,"","MaxSeconds"],[0,2,1,"","MinSeconds"],[0,2,1,"","NanosecondsPerSecond"],[0,3,1,"","__add__"],[0,3,1,"","__new__"],[0,3,1,"","__radd__"],[0,3,1,"","__repr__"],[0,3,1,"","__str__"],[0,3,1,"","getHours"],[0,3,1,"","getMilliseconds"],[0,3,1,"","getMinutes"],[0,3,1,"","getSeconds"],[0,2,1,"","scale"]],"celpy.celtypes.FunctionType":[[0,3,1,"","__call__"]],"celpy.celtypes.IntType":[[0,3,1,"","__add__"],[0,3,1,"","__eq__"],[0,3,1,"","__floordiv__"],[0,3,1,"","__ge__"],[0,3,1,"","__gt__"],[0,3,1,"","__hash__"],[0,3,1,"","__le__"],[0,3,1,"","__lt__"],[0,3,1,"","__mod__"],[0,3,1,"","__mul__"],[0,3,1,"","__ne__"],[0,3,1,"","__neg__"],[0,3,1,"","__new__"],[0,3,1,"","__radd__"],[0,3,1,"","__repr__"],[0,3,1,"","__rfloordiv__"],[0,3,1,"","__rmod__"],[0,3,1,"","__rmul__"],[0,3,1,"","__rsub__"],[0,3,1,"","__rtruediv__"],[0,3,1,"","__str__"],[0,3,1,"","__sub__"],[0,3,1,"","__truediv__"]],"celpy.celtypes.ListType":[[0,3,1,"","__eq__"],[0,3,1,"","__ge__"],[0,3,1,"","__gt__"],[0,2,1,"","__hash__"],[0,3,1,"","__le__"],[0,3,1,"","__lt__"],[0,3,1,"","__ne__"],[0,2,1,"","__orig_bases__"],[0,2,1,"","__parameters__"],[0,3,1,"","__repr__"],[0,3,1,"","contains"]],"celpy.celtypes.MapType":[[0,3,1,"","__eq__"],[0,3,1,"","__getitem__"],[0,2,1,"","__hash__"],[0,3,1,"","__init__"],[0,3,1,"","__ne__"],[0,2,1,"","__orig_bases__"],[0,2,1,"","__parameters__"],[0,3,1,"","__repr__"],[0,3,1,"","contains"],[0,3,1,"","get"],[0,3,1,"","valid_key_type"]],"celpy.celtypes.MessageType":[[0,3,1,"","__init__"],[0,2,1,"","__parameters__"]],"celpy.celtypes.NullType":[[0,3,1,"","__eq__"],[0,2,1,"","__hash__"],[0,3,1,"","__ne__"]],"celpy.celtypes.PackageType":[[0,2,1,"","__parameters__"]],"celpy.celtypes.StringType":[[0,3,1,"","__eq__"],[0,3,1,"","__hash__"],[0,3,1,"","__ne__"],[0,3,1,"","__new__"],[0,3,1,"","__repr__"],[0,3,1,"","contains"]],"celpy.celtypes.TimestampType":[[0,2,1,"","TZ_ALIASES"],[0,3,1,"","__add__"],[0,3,1,"","__new__"],[0,3,1,"","__radd__"],[0,3,1,"","__repr__"],[0,3,1,"","__str__"],[0,3,1,"","__sub__"],[0,3,1,"","getDate"],[0,3,1,"","getDayOfMonth"],[0,3,1,"","getDayOfWeek"],[0,3,1,"","getDayOfYear"],[0,3,1,"","getFullYear"],[0,3,1,"","getHours"],[0,3,1,"","getMilliseconds"],[0,3,1,"","getMinutes"],[0,3,1,"","getMonth"],[0,3,1,"","getSeconds"],[0,3,1,"","tz_name_lookup"],[0,3,1,"","tz_offset_parse"],[0,3,1,"","tz_parse"]],"celpy.celtypes.TypeType":[[0,3,1,"","__new__"]],"celpy.celtypes.UintType":[[0,3,1,"","__add__"],[0,3,1,"","__eq__"],[0,3,1,"","__floordiv__"],[0,3,1,"","__hash__"],[0,3,1,"","__mod__"],[0,3,1,"","__mul__"],[0,3,1,"","__ne__"],[0,3,1,"","__neg__"],[0,3,1,"","__new__"],[0,3,1,"","__radd__"],[0,3,1,"","__repr__"],[0,3,1,"","__rfloordiv__"],[0,3,1,"","__rmod__"],[0,3,1,"","__rmul__"],[0,3,1,"","__rsub__"],[0,3,1,"","__rtruediv__"],[0,3,1,"","__str__"],[0,3,1,"","__sub__"],[0,3,1,"","__truediv__"]],"celpy.evaluation":[[0,1,1,"","Activation"],[0,5,1,"","CELEvalError"],[0,5,1,"","CELSyntaxError"],[0,5,1,"","CELUnsupportedError"],[0,1,1,"","Evaluator"],[0,1,1,"","NameContainer"],[0,1,1,"","Phase1Transpiler"],[0,1,1,"","Phase2Transpiler"],[0,1,1,"","Referent"],[0,1,1,"","Transpiler"],[0,1,1,"","TranspilerTree"],[0,4,1,"","bool_eq"],[0,4,1,"","bool_ge"],[0,4,1,"","bool_gt"],[0,4,1,"","bool_le"],[0,4,1,"","bool_lt"],[0,4,1,"","bool_ne"],[0,4,1,"","boolean"],[0,4,1,"","celbytes"],[0,4,1,"","celstr"],[0,4,1,"","eval_error"],[0,4,1,"","function_contains"],[0,4,1,"","function_endsWith"],[0,4,1,"","function_getDate"],[0,4,1,"","function_getDayOfMonth"],[0,4,1,"","function_getDayOfWeek"],[0,4,1,"","function_getDayOfYear"],[0,4,1,"","function_getFullYear"],[0,4,1,"","function_getHours"],[0,4,1,"","function_getMilliseconds"],[0,4,1,"","function_getMinutes"],[0,4,1,"","function_getMonth"],[0,4,1,"","function_getSeconds"],[0,4,1,"","function_matches"],[0,4,1,"","function_size"],[0,4,1,"","function_startsWith"],[0,4,1,"","macro_all"],[0,4,1,"","macro_exists"],[0,4,1,"","macro_exists_one"],[0,4,1,"","macro_filter"],[0,4,1,"","macro_map"],[0,4,1,"","operator_in"],[0,4,1,"","result"],[0,7,1,"","the_activation"],[0,4,1,"","trace"]],"celpy.evaluation.Activation":[[0,3,1,"","__getattr__"],[0,3,1,"","__init__"],[0,3,1,"","__repr__"],[0,3,1,"","clone"],[0,3,1,"","get"],[0,3,1,"","nested_activation"],[0,3,1,"","resolve_function"],[0,3,1,"","resolve_variable"]],"celpy.evaluation.CELEvalError":[[0,3,1,"","__add__"],[0,3,1,"","__call__"],[0,3,1,"","__eq__"],[0,3,1,"","__floordiv__"],[0,2,1,"","__hash__"],[0,3,1,"","__init__"],[0,3,1,"","__mod__"],[0,3,1,"","__mul__"],[0,3,1,"","__neg__"],[0,3,1,"","__pow__"],[0,3,1,"","__radd__"],[0,3,1,"","__repr__"],[0,3,1,"","__rfloordiv__"],[0,3,1,"","__rmod__"],[0,3,1,"","__rmul__"],[0,3,1,"","__rpow__"],[0,3,1,"","__rsub__"],[0,3,1,"","__rtruediv__"],[0,3,1,"","__sub__"],[0,3,1,"","__truediv__"],[0,3,1,"","with_traceback"]],"celpy.evaluation.CELSyntaxError":[[0,3,1,"","__init__"]],"celpy.evaluation.CELUnsupportedError":[[0,3,1,"","__init__"]],"celpy.evaluation.Evaluator":[[0,2,1,"","__abstractmethods__"],[0,3,1,"","__init__"],[0,2,1,"","__parameters__"],[0,3,1,"","addition"],[0,3,1,"","build_macro_eval"],[0,3,1,"","build_reduce_macro_eval"],[0,3,1,"","build_ss_macro_eval"],[0,3,1,"","conditionaland"],[0,3,1,"","conditionalor"],[0,3,1,"","evaluate"],[0,3,1,"","expr"],[0,3,1,"","exprlist"],[0,3,1,"","fieldinits"],[0,3,1,"","function_eval"],[0,3,1,"","ident_value"],[0,3,1,"","literal"],[0,2,1,"","logger"],[0,3,1,"","macro_has_eval"],[0,3,1,"","mapinits"],[0,3,1,"","member"],[0,3,1,"","member_dot"],[0,3,1,"","member_dot_arg"],[0,3,1,"","member_index"],[0,3,1,"","member_object"],[0,3,1,"","method_eval"],[0,3,1,"","multiplication"],[0,3,1,"","primary"],[0,3,1,"","relation"],[0,3,1,"","set_activation"],[0,3,1,"","sub_evaluator"],[0,3,1,"","unary"],[0,3,1,"","visit_children"]],"celpy.evaluation.NameContainer":[[0,5,1,"","NotFound"],[0,3,1,"","__init__"],[0,2,1,"","__orig_bases__"],[0,2,1,"","__parameters__"],[0,3,1,"","__repr__"],[0,3,1,"","clone"],[0,3,1,"","dict_find_name"],[0,2,1,"","extended_name_path"],[0,3,1,"","find_name"],[0,3,1,"","get"],[0,2,1,"","ident_pat"],[0,3,1,"","load_annotations"],[0,3,1,"","load_values"],[0,2,1,"","logger"],[0,3,1,"","parent_iter"],[0,3,1,"","resolve_name"]],"celpy.evaluation.Phase1Transpiler":[[0,3,1,"","__init__"],[0,2,1,"","__parameters__"],[0,3,1,"","addition"],[0,3,1,"","conditionaland"],[0,3,1,"","conditionalor"],[0,3,1,"","dot_ident"],[0,3,1,"","dot_ident_arg"],[0,3,1,"","expr"],[0,3,1,"","exprlist"],[0,3,1,"","fieldinits"],[0,3,1,"","func_name"],[0,3,1,"","ident"],[0,3,1,"","ident_arg"],[0,3,1,"","list_lit"],[0,3,1,"","literal"],[0,3,1,"","map_lit"],[0,3,1,"","mapinits"],[0,3,1,"","member"],[0,3,1,"","member_dot"],[0,3,1,"","member_dot_arg"],[0,3,1,"","member_index"],[0,3,1,"","member_object"],[0,3,1,"","multiplication"],[0,3,1,"","paren_expr"],[0,3,1,"","primary"],[0,3,1,"","relation"],[0,3,1,"","unary"],[0,3,1,"","visit"]],"celpy.evaluation.Phase2Transpiler":[[0,3,1,"","__init__"],[0,2,1,"","__parameters__"],[0,3,1,"","conditionaland"],[0,3,1,"","conditionalor"],[0,3,1,"","expr"],[0,3,1,"","ident_arg"],[0,3,1,"","member_dot_arg"],[0,3,1,"","statements"]],"celpy.evaluation.Referent":[[0,3,1,"","__eq__"],[0,2,1,"","__hash__"],[0,3,1,"","__init__"],[0,3,1,"","__repr__"],[0,3,1,"","clone"],[0,6,1,"","value"]],"celpy.evaluation.Transpiler":[[0,3,1,"","__init__"],[0,3,1,"","evaluate"],[0,2,1,"","logger"],[0,3,1,"","transpile"]],"celpy.evaluation.TranspilerTree":[[0,3,1,"","__init__"],[0,2,1,"","__parameters__"],[0,2,1,"","children"],[0,2,1,"","data"]],"features.steps":[[4,0,0,"-","c7n_integration"],[4,0,0,"-","cli_binding"],[4,0,0,"-","integration_binding"]],"python-tools/pb2g.py-[-g-docker|local]-[-o-output]-[-sv]-source":[[4,8,1,"cmdoption-python-tools-pb2g.py-g-docker-local-o-output-sv-source-g","--gherkinizer"],[4,8,1,"cmdoption-python-tools-pb2g.py-g-docker-local-o-output-sv-source-o","--output"],[4,8,1,"cmdoption-python-tools-pb2g.py-g-docker-local-o-output-sv-source-s","--silent"],[4,8,1,"cmdoption-python-tools-pb2g.py-g-docker-local-o-output-sv-source-v","--verbose"],[4,8,1,"cmdoption-python-tools-pb2g.py-g-docker-local-o-output-sv-source-g","-g"],[4,8,1,"cmdoption-python-tools-pb2g.py-g-docker-local-o-output-sv-source-o","-o"],[4,8,1,"cmdoption-python-tools-pb2g.py-g-docker-local-o-output-sv-source-s","-s"],[4,8,1,"cmdoption-python-tools-pb2g.py-g-docker-local-o-output-sv-source-v","-v"],[4,8,1,"cmdoption-python-tools-pb2g.py-g-docker-local-o-output-sv-source-arg-source","source"]]},"objnames":{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","attribute","Python attribute"],"3":["py","method","Python method"],"4":["py","function","Python function"],"5":["py","exception","Python exception"],"6":["py","property","Python property"],"7":["py","data","Python data"],"8":["std","cmdoption","program option"]},"objtypes":{"0":"py:module","1":"py:class","2":"py:attribute","3":"py:method","4":"py:function","5":"py:exception","6":"py:property","7":"py:data","8":"std:cmdoption"},"terms":{"":[0,1,2,3,4,7,8],"0":[0,1,2,4,7],"00":7,"001":0,"002":1,"01":1,"011":1,"01ab23cd":1,"02":[0,1],"03":1,"03t16":7,"03z":[2,7],"04":[1,7],"05":1,"06":0,"06t05":7,"06t20":2,"07":[1,2,7],"08":[1,7],"084":1,"09":0,"0u":4,"1":[0,1,2,3,7],"10":[0,1],"100":[1,2],"1000":1,"10000":1,"1000000000":0,"1004":1,"101":1,"1021":1,"1023":1,"10240":1,"1026":1,"103":1,"1034":1,"104":1,"1041":1,"1045":1,"105":1,"1057":1,"106":1,"1066":1,"108":1,"1080":1,"10am":1,"11":[1,2],"111":1,"1124":1,"113":2,"1144":1,"115":1,"116":1,"117":1,"1178":1,"1180":1,"1191":1,"12":[1,4],"121":1,"1211":1,"122":1,"123":[0,1,7],"1232":1,"1234567890":0,"123u":0,"125":1,"127":[0,1],"128":1,"1295":1,"12ab34cd":1,"13":[2,6],"131":1,"132":1,"1333":1,"134":1,"135":2,"136":1,"138":0,"13t23":0,"14":[0,1],"140":7,"1410":1,"14159":[],"1415929203539825":2,"1437":1,"145":1,"147":1,"1474":1,"149":0,"1493":1,"15":[1,7],"1505":1,"1513":1,"154":1,"1584":1,"16":1,"161":1,"1613":1,"162":1,"167":1,"16777234":2,"1686":1,"17":1,"1704":1,"171":1,"1728":1,"173":1,"1779":1,"178":1,"1787":1,"179":1,"1793":1,"1799":1,"18":[0,1],"182":1,"183":1,"184":1,"18446744073709551615":0,"185":1,"189":1,"19":1,"190":1,"194":1,"1954":1,"196":1,"197":1,"198":1,"1e":0,"1st":1,"1u":0,"2":[0,1,2],"20":1,"2006":2,"2009":0,"2012":1,"2016":1,"2017":1,"2018":7,"2019":1,"2020":1,"2021":1,"2025":2,"203":1,"2048":1,"205":1,"206":1,"20z":2,"21":[0,1,7],"212":1,"21d":1,"21z":2,"22":1,"223":1,"2242":1,"228":1,"2292":1,"23":[1,7],"232":1,"237":1,"238":1,"24":1,"24h":7,"24x5":1,"25":1,"250":1,"2500000":1,"256":0,"257":1,"26":1,"262":1,"268":1,"27":[1,2,7],"273":1,"277":[0,1],"2788":1,"27t18":2,"28":1,"285":0,"29":1,"293":1,"299":1,"2h45m":0,"2nd":[],"3":[0,1,2,4,6,7],"30":[0,1,2],"300m":0,"301":1,"305":1,"30z":0,"31":[0,2],"313":1,"314":1,"315576000000":0,"317":1,"318":1,"32":1,"325":1,"329":1,"34":1,"341":1,"341035":2,"345":1,"348":1,"35":1,"355":[0,2],"35dai":1,"36":1,"3600":0,"364":1,"37":1,"372":1,"373":1,"390":1,"3a":1,"4":[0,1],"40":[1,7],"400":1,"402":1,"408":1,"409":1,"4096":2,"41":[1,2],"412":1,"413":1,"42":[0,1,2,8],"424":1,"429":1,"42u":0,"43":1,"431":1,"4320":2,"432u":0,"436":1,"438":1,"443":1,"448":1,"45":1,"453":1,"455":1,"456":0,"47":[1,7],"48":1,"485":1,"490":1,"493":1,"4d":0,"5":[0,1],"50":1,"500":7,"5000":1,"505":1,"5103":1,"512":1,"5120":1,"514":1,"516":1,"52":1,"54":1,"548":1,"549":1,"55":1,"556":1,"562":1,"563":1,"567":1,"569":1,"57":1,"575":1,"5759":7,"58":1,"592":1,"597":1,"5h":0,"6":[0,1,2],"60":[0,1],"600":7,"604":1,"608":1,"610":1,"612000":1,"615":1,"619":1,"622":1,"628":1,"63":0,"64":[1,7,8],"643":1,"644":1,"65":1,"656":1,"659":1,"66":1,"662":1,"666":1,"667":1,"676":1,"69":1,"692":1,"6am":1,"6f":2,"6hr":1,"6pm":1,"7":[0,1,2],"70":0,"711":1,"720":1,"729":1,"739":1,"74":1,"744":1,"748":1,"758":1,"767":1,"78":1,"786":1,"791":1,"7am":1,"7pm":1,"8":[1,7],"80":1,"806":1,"8098":1,"81":1,"812":1,"826":1,"829":1,"830985915492956":2,"842":1,"845":1,"86":1,"86400":[0,1],"87":1,"88":1,"8x5":1,"9":[0,1],"90":1,"92":1,"9223372036854775807":0,"9223372036854775808":0,"93":1,"932":1,"934":1,"94":1,"97":1,"98":1,"987":1,"988":1,"99":1,"9pm":1,"A":[0,1,2,4,7,8],"AND":0,"And":[0,2],"As":[0,2,7,8],"At":[0,8],"But":0,"By":[0,2],"For":[0,1,2,4,6,7,8],"If":[0,1,2,3,4,7,8],"In":[0,1,2,3,6,7,8],"It":[0,1,2,4,7,8],"NOT":[0,1],"No":[0,1,4,7,8],"Not":[0,1],"Of":1,"On":[1,7],"One":[0,1],"Or":0,"Such":8,"THe":2,"That":0,"The":[1,2,3,5,6,7],"Then":[0,1,4],"There":[0,1,2,4,5,7,8],"These":[0,1,4,7,8],"To":[0,3,7],"With":[0,1],"_":[0,7],"__abstractmethods__":0,"__add__":0,"__call__":[0,7],"__contains__":0,"__enter__":0,"__eq__":0,"__exit__":0,"__floordiv__":0,"__ge__":0,"__getattr__":0,"__getitem__":0,"__globals__":[],"__gt__":0,"__hash__":0,"__init__":[0,1,7,8],"__isinstance__":0,"__le__":0,"__lt__":0,"__main__":[5,8],"__mod__":0,"__mul__":0,"__ne__":0,"__neg__":0,"__new__":0,"__orig_bases__":0,"__parameters__":0,"__pow__":0,"__radd__":0,"__repr__":0,"__rfloordiv__":0,"__rmod__":0,"__rmul__":0,"__rpow__":0,"__rsub__":0,"__rtruediv__":0,"__str__":0,"__sub__":0,"__traceback__":0,"__truediv__":0,"_a":0,"_init":[],"_leaf_t":[],"_oper":0,"_pull_ami_snapshot":[0,1],"_pull_asg_imag":[0,1],"_pull_asg_snapshot":[0,1],"_pull_ec2_imag":[0,1],"_w":0,"ab":0,"abandond":1,"abc":[0,1],"abil":2,"abl":[0,1],"about":[1,5,7],"abov":[0,1,7],"absenc":1,"absent":[0,1],"absolut":0,"abstract":[0,7],"abstractmethod":0,"accept":[0,1],"access":0,"access_kei":1,"accesskeysperuserquota":1,"accesslog":1,"account":[0,7],"account_id":[0,1],"account_shield_subscript":[0,1],"accountaccesskeyspres":1,"accountcredentialreport":1,"accountmfaen":1,"accountnumb":1,"accountpasswordpolici":1,"accounts_url":1,"accountsigningcertificatespres":1,"achiev":2,"acl":1,"aclawss3cidr":1,"aclsubnetfilt":1,"acm":[1,7],"acquir":1,"across":[1,5],"act":1,"action":[0,1,7],"action_d":[0,1],"activ":[0,1,2,7,8],"actual":[0,7],"ad":[0,1],"adapat":[],"adapt":[5,7,8],"add":[0,1,3,6,8],"addit":[1,7,8],"addition":[0,1,2,7,8],"addition_add":0,"addition_sub":0,"additionalproperti":1,"addo":[],"addr":1,"address":[0,1],"adher":1,"admin":1,"administratoraccess":1,"advanc":1,"advantag":2,"advisor":1,"aes128":1,"aes256":1,"after":[0,1,4],"ag":7,"again":[0,7],"against":[0,1],"agefilt":1,"agre":0,"ahom":2,"akward":0,"alarm":1,"alb":1,"alblog":1,"alert":1,"alia":0,"alias":[0,1],"aliasnam":1,"all":[0,2,3,4,7,8],"all_dbsubenet_group":[0,1],"all_imag":[0,1],"all_instance_profil":[0,1],"all_launch_configuration_nam":[0,1],"all_scan_group":[0,1],"all_service_rol":[0,1],"all_snapshot":[0,1],"all_valu":1,"alloc":1,"allocatedstorag":1,"allow":[0,2,7,8],"allow_nan":0,"allow_websit":1,"allowalliampolici":1,"almost":0,"alon":[1,8],"along":[0,1],"alreadi":0,"also":[0,1,2,7,8],"altern":[0,1],"alwai":[0,1,8],"amazon":1,"amazonaw":1,"amazons3":1,"ambigu":0,"ambiguous_liter":0,"america":1,"ami":0,"amicrossaccountfilt":1,"among":[0,1],"amort":8,"an":[0,1,2,4,5,7,8],"analysi":1,"analyt":1,"analyz":0,"ancient":1,"ani":[0,1,2,3,4,7,8],"annot":[0,1,7,8],"anoth":[0,1,2,5,7,8],"anyof":1,"ap":1,"api":[1,5,8],"apigw":1,"apikeyrequir":1,"app":[1,8],"appear":[0,1],"appelb":[0,1],"appelbdefaultvpcfilt":1,"appelbhealthcheckprotocolmismatchfilt":1,"appelblistenerfilt":1,"appelbmetr":1,"appelbtargetgroup":1,"appelbtargetgroupdefaultvpcfilt":1,"appelbtargetgroupfilt":1,"append":0,"appid":1,"appli":[0,1,7],"applic":[0,1,2,3,4,5,8],"applicationnam":1,"approach":[7,8],"appropri":[0,7],"approxim":0,"ar":[0,1,2,4,5,7,8],"arbitrari":0,"architectur":[5,6],"aren":[0,1,7],"arg":[0,2,7],"arg_name_arg":7,"arg_type_valu":0,"argtyp":[],"argument":[0,7],"argv":0,"arithmet":2,"arithmetic_oper":0,"aritmet":[],"arm64":6,"arn":[0,1],"arn_split":[0,1],"around":[0,1],"arrai":[0,1],"arriv":[1,7],"asg":[0,1],"asid":0,"assert":[0,1,7],"assign":[0,1],"assoc":1,"associ":[0,1,2,7],"associatepublicipaddress":1,"assum":[0,1,8],"assumerolepolicysizequota":1,"assumpt":1,"assur":[0,4],"ast":[0,2,7,8],"ast2":0,"asv":1,"asvredact":1,"atm":1,"atom":[0,7],"atot":2,"attach":[0,1],"attachedinstancefilt":1,"attachedpoliciespergroupquota":1,"attachedpoliciesperrolequota":1,"attachedpoliciesperuserquota":1,"attachedvolum":1,"attachmentcount":1,"attack":1,"attempt":[0,1],"attr":1,"attribit":1,"attribut":[0,2,7],"attributesfilt":1,"atyp":7,"audit":1,"augment":1,"aurora":1,"auth":7,"author":7,"auto":1,"automat":1,"autosc":1,"autoscal":1,"avail":[0,2],"aval":1,"averag":[0,1],"avoid":[0,1,2],"aw":[0,1],"awar":2,"aws_ebs_degraded_ebs_volume_perform":1,"aws_ebs_volume_lost":1,"awsec2":1,"awslambda":1,"ax":2,"az1":1,"azr":1,"azur":1,"b":[0,2,7],"ba":1,"back":[0,1,4],"backoff":1,"backup":1,"bad1":7,"bad2":7,"balanc":[1,7],"base":[0,1,2,4,5,7,8],"base_activ":0,"base_funct":0,"based_on":0,"baseexcept":0,"baselin":1,"bash":2,"basi":1,"basic":[1,4],"batch":1,"baz":0,"bc":2,"beast":0,"becaus":[0,1,2,5,7,8],"becom":[0,1,2,4,8],"been":[0,1,8],"befor":[1,2],"behav":[0,7],"behavior":[0,1,2],"being":[0,1],"below":0,"bench":4,"benchmark":[0,4],"best":0,"better":[0,1,7],"between":[0,1,2,7,8],"beyond":[],"big":[],"bin":4,"binari":[0,4,7],"bind":[0,2,5,8],"bind_vari":0,"bit":[1,2,5,8],"blacklist":1,"blob":[0,1,4,7],"block":[0,2],"blockdevicemap":1,"bn":2,"bool":[0,5,7,8],"bool_eq":0,"bool_g":0,"bool_gt":0,"bool_l":0,"bool_lit":0,"bool_lt":0,"bool_n":0,"bool_valu":0,"boolean":[0,2,5,7],"boolean_to_statu":0,"booleangroupfilt":7,"booltyp":[0,7,8],"boolvalu":0,"both":[0,1],"boto3":1,"bottl":0,"bottom":[0,8],"bound":[0,2,7],"bracket":1,"branch":4,"break":0,"breakdown":7,"bring":1,"broken":[1,4],"broker":1,"bucket":0,"bucketencrypt":1,"bucketnotificationfilt":1,"buffer":0,"build":[0,1,4,7,8],"build_macro_ev":0,"build_reduce_macro_ev":0,"build_ss_macro_ev":0,"buildsecuritygroupfilt":1,"buildsubnetfilt":1,"buildvpcfilt":1,"built":[0,1,2,4,7,8],"bulki":1,"bunch":1,"burden":2,"bye":2,"byol":1,"byt":0,"byte":[0,8],"bytes_lit":0,"bytes_valu":0,"bytestyp":[0,8],"bytesvalu":0,"c":[0,2,7],"c4":8,"c7n":[5,8],"c7n_interfac":4,"c7n_interpreted_runn":[0,1],"c7n_s3_policy_requir":1,"c7ncontext":[0,1],"c7nlib":[1,3,5,7,8],"cach":[0,5,8],"calcul":2,"call":[0,1],"callabl":[0,8],"can":[0,1,2,3,4,5,6,7,8],"cannot":[0,1],"capabl":[0,1,2],"capacitydelta":1,"capitalon":1,"capon":1,"captur":0,"cardda_tagcompli":1,"cardin":1,"case":[0,1,2,4,6,7,8],"categori":[1,7],"caught":0,"caus":0,"causesresourc":1,"cbhfqv":1,"cbr":1,"cde":1,"ce":7,"cel":[0,1,4,6,7],"cel_activ":[0,1],"cel_ast":[0,1],"cel_env":[0,1],"cel_ev":0,"cel_expr":0,"cel_funct":7,"cel_gen":0,"cel_object":0,"cel_pars":0,"cel_prgm":0,"cel_program":7,"cel_repl":0,"cel_simple_testdata":4,"cel_sourc":7,"cel_test":7,"cel_trac":[0,2,3],"celbyt":0,"celevalerror":[0,7,8],"celfilt":[0,5,7],"celfilter_inst":0,"celfunct":[0,8],"celjsondecod":0,"celjsonencod":0,"celpars":[5,8],"celparseerror":0,"celpi":[1,2,3,5,7,8],"celstr":0,"celsyntaxerror":[0,7],"celtyp":[1,2,3,5,7,8],"celunsupportederror":0,"central":[0,7],"cert":1,"certain":[0,1],"certif":1,"cet":0,"cf":1,"cfn":1,"chain":[0,8],"chainmap":[0,8],"challeng":4,"chang":[0,1,4,7],"char":7,"charact":[0,2],"character":0,"check":[0,4,7],"check_circular":0,"check_custom_origin":1,"checked_except":0,"checker":7,"child":0,"childnr":0,"children":0,"choci":[],"choic":[0,8],"choos":0,"chosen":0,"chunk":1,"ci":1,"cidr":0,"cidr_contain":0,"cidr_siz":[0,1],"cidrblock":1,"cipher":1,"circuit":[0,7],"cl":0,"claim":7,"class":[0,1,3,7,8],"classic":1,"classmethod":0,"claus":[1,4,7],"clean":[1,4],"clear":[1,2],"cli":[0,5,8],"client":[0,1],"clock":1,"clone":0,"close":[0,1,2,7],"closur":0,"cloud":[0,1,5,8],"cloudform":1,"cloudfront":[0,1],"cloudhsm":1,"cloudsearch":1,"cloudtrailen":1,"cloudwatch":[0,1],"cluster":1,"cm":1,"cm6aws11":1,"cmdbenviron":1,"cmdloop":0,"cml":1,"co":7,"code":[0,1,2,4,7,8],"codebuild":1,"codebuildproject":1,"codecommit":1,"codepipelin":1,"coerc":0,"coercion":[0,7],"collab":[],"collabor":0,"collect":[0,1,4,8],"collis":[0,1],"color":1,"column":[0,1],"com":[0,1,2,4,7],"combin":[0,1,5,7],"come":[0,1,2],"command":[0,2,6,8],"comment":[1,4],"common":[0,4,7,8],"commonli":0,"commun":1,"commut":0,"compar":[0,1,2],"comparablevers":[0,1],"comparison":[0,1,2,4,7],"compat":0,"compil":[0,1,4,6,7],"compiledrunn":[0,8],"complement":1,"complet":[0,7],"completekei":0,"complex":[0,1,2,5,7,8],"complex_express":4,"compli":1,"compliant":[1,7],"complic":[0,7],"compon":[1,3,5,7],"compons":[],"compos":[1,7],"composit":1,"compromis":7,"comput":[0,1,2,7,8],"computeenviron":1,"computesgfilt":1,"computesubnetfilt":1,"conceal":1,"concept":[0,7],"conceptu":8,"concern":[0,2],"conclud":4,"concret":0,"condit":[0,1,8],"conditionaland":0,"conditionalor":0,"configen":1,"configrul":1,"configur":[1,5,6],"conflat":[],"conform":4,"confus":[0,4],"connect":1,"connectionsecuritygroupfilt":1,"connectionsubnetfilt":1,"consequ":8,"consid":[0,1,8],"consider":1,"consist":0,"consol":[3,4],"consolid":[],"constant":0,"constraint":8,"construct":[0,5,7],"constructor":0,"contain":[0,1,3,5,7],"containerdefinit":1,"content":0,"context":[2,5,7],"continu":7,"control":1,"convers":[0,2,4,7,8],"convert":[0,1,4,7],"copi":[0,1,4],"core":[0,1],"correct":1,"correctli":0,"cost":8,"could":[0,2,7],"count":[0,7],"countnumb":1,"cours":0,"cover":[0,7],"coverag":4,"cpp":0,"cpu":1,"cpuutil":[0,1],"crash":[4,7],"creat":[0,1,4,7,8],"created":1,"createdtim":1,"creation":[0,1],"creationd":1,"creationtimestamp":7,"credenti":0,"credentialreport":[0,1],"credentialreportmixin":[0,1],"crossaccountaccess":1,"crossaccountaccessfilt":[0,1],"crossaccountaccessmixin":[0,1],"crossaccountfilt":1,"crossaccountp":1,"crossregiontransf":1,"crypto":1,"csv":1,"csv2dict":1,"ct":1,"ctl":1,"current":[0,1,2,4,5,7,8],"custodian":[1,5,8],"custodian_asv":1,"custodian_cleanup":1,"custodian_downtim":1,"custodian_invalid":1,"custodian_invalid_asg":1,"custodian_rds_offhours_ct":1,"custodian_rds_offhours_et":1,"custodian_rds_offhours_pt":1,"custodian_res":1,"custodian_s3_ns_templ":1,"custodian_snapshot":1,"custodian_statu":1,"custodian_stop":1,"custodian_tag":1,"custom":1,"cut":0,"cw":1,"d":[0,1,2,3,7],"dai":[0,1],"daili":1,"darwin":6,"data":[0,2,4,5,7,8],"databas":[0,1],"databaseconnect":1,"dataev":1,"datapipelin":1,"datapoint":1,"date":[0,1,4],"datetim":[0,1,7,8],"dateutil":0,"dax":1,"daxsecuritygroupfilt":1,"daxsubnetfilt":1,"daylight":1,"dbclusteridentifi":1,"dbsubnetgroup":1,"dbsubnetgroupnam":1,"dd":1,"deal":0,"debug":[0,3,4],"decid":7,"decim":[0,2],"decis":1,"decl":[0,1,7],"declar":[0,1,7],"decod":0,"decompos":0,"decomposit":0,"decor":[0,3,7],"deduc":0,"deep":0,"deepli":0,"def":[0,1,7],"default":[0,2,4,7,8],"default_tz":1,"default_vpc":1,"defaultvpc":1,"defer":0,"defien":[],"defin":[0,1,2,4,8],"definit":[0,2,4,7,8],"deleg":0,"delet":[1,4,7,8],"deleteprotect":7,"delimit":[1,2],"deliv":1,"demand":1,"deni":1,"denial":1,"denot":8,"depend":[0,1,2,4,5,6,7,8],"deprec":[1,8],"deriv":0,"descend":0,"describ":[0,1,7,8],"describe_db_snapshot_attribut":[0,1],"describe_subscription_filt":[0,1],"descript":[0,1,5,7],"design":[0,5],"desir":1,"desk":2,"destin":1,"detail":[1,2,3,7,8],"detect":1,"determin":[1,2,7],"dev":[1,4,7],"develop":[0,5],"dfunction":0,"dhcpoptionsfilt":1,"dhe":1,"dict":[0,1,8],"dict_find_nam":0,"dictionari":[0,1],"did":0,"didn":7,"differ":[0,1,2,5,7],"difficult":[0,1],"digest":1,"digit":0,"dimens":[0,1],"direct":0,"directconnect":1,"directli":[0,1,2],"directori":[1,2,3,4],"directorysecuritygroupfilt":1,"directorysubnetfilt":1,"directoryvpcfilt":1,"disabl":[0,1,7],"disableapitermin":1,"discard":0,"discern":8,"discov":0,"dispatch":[],"displai":0,"displaynam":1,"distinct":[0,7,8],"distinguish":[0,7],"distribut":[1,4],"disutil":0,"diverg":1,"divid":0,"dividebyzeroerror":7,"divis":0,"dlm":1,"dm":1,"dn":1,"dnshostnam":1,"dnsname":1,"dnssupport":1,"do":[0,1,2,3,7,8],"do_by":0,"do_eof":0,"do_exit":0,"do_quit":0,"do_set":0,"do_show":0,"doc":[0,1,5],"docker":4,"dockerfil":4,"document":[0,1,2,4,7,8],"doe":[0,1,2,7,8],"doesn":[0,1,4,7,8],"doin":0,"domain":[0,1,8],"don":[0,1,2,7],"done":[0,1,3,8],"dot":5,"dot_id":[0,8],"dot_ident_arg":[0,8],"doubl":2,"double_valu":0,"doubletyp":[0,2,8],"doublevalu":0,"down":[0,1],"download":4,"dpb":0,"dramat":[],"dsl":[1,2,5,7,8],"duck":7,"due":1,"dump":0,"dumpast":0,"duplic":0,"durat":[0,1,7],"durationtyp":[0,1,8],"dure":[0,1,2,6],"dyn":0,"dynam":4,"dynamodb":1,"dynamodbacceler":1,"e":[0,1,2],"e1":0,"e2":0,"each":[0,1,2,7,8],"easi":0,"easier":[1,7],"easili":[0,5],"east":[0,1],"east1":7,"eastern":1,"eb":0,"ebnf":4,"ebsoptim":1,"ec":1,"ec2":[0,1,7],"ec2_userdata_stop":1,"ecdh":1,"ecdsa":1,"echo":2,"ecr":1,"ecrcrossaccountaccessfilt":1,"ecsclust":1,"ecsmetr":1,"ef":1,"effect":[0,1,2],"effort":4,"egress_viol":1,"eip":1,"either":[0,1,4],"ek":1,"ekssgfilt":1,"ekssubnetfilt":1,"eksvpcfilt":1,"elast":1,"elasticach":1,"elasticachesnapshot":1,"elasticachesnapshotag":1,"elasticbeanstalk":1,"elasticfilesystem":0,"elasticfilesystemmounttarget":1,"elasticmapreduc":1,"elasticsearch":1,"elasticsearchdomain":1,"elb":[0,1],"elblog":1,"elbsecuritypolici":1,"elem":0,"element":[1,7],"elif":0,"elimin":[],"els":0,"email":[1,7],"email_verifi":7,"emb":2,"embed":[5,7],"emit":[],"emmo":1,"emphat":7,"empti":[0,1,3,4],"emr":1,"emrclust":1,"emrmetr":1,"en":[4,7],"enabl":[0,3,5,7],"enasupport":1,"encod":0,"encount":0,"encounterd":0,"encryptionenabledfilt":1,"end":[0,1,8],"endpoint":1,"endpointcrossaccountfilt":1,"endpointsecuritygroupfilt":1,"endpointsubnetfilt":1,"endpointvpcfilt":1,"endtim":0,"engin":[0,1],"enhanc":2,"eni":1,"ensur":[1,7],"ensure_ascii":0,"ent":1,"enter":[0,2],"enterpris":1,"entir":0,"entri":8,"enum":[0,1,4],"enumtyp":0,"env":[1,7],"environ":[0,1,3,4,5,6,7,8],"environment":[],"eof":2,"ephemeralinstancefilt":1,"eq":[0,1],"eq_test":0,"equal":[0,1],"equival":0,"err":7,"erron":0,"error":[0,2,3,4,5,8],"error_text":0,"escap":0,"eschew":1,"essenc":7,"essenti":[0,1,5,8],"est":1,"establish":0,"et":1,"etc":[0,1],"eu":1,"europ":0,"eustac":0,"eval":[0,2,7,8],"eval_error":0,"eval_filt":1,"evalerror":[],"evalu":[1,2,3,4,5,7],"evauat":[],"even":[0,1],"event":[0,4],"eventrul":1,"eventrulemetr":1,"eventruletarget":1,"eventstatuscod":0,"eventu":[0,7],"ever":7,"everi":[0,1],"everydai":1,"everyone_onli":1,"everyth":2,"evluat":[],"ex":[0,7],"ex_":0,"ex_10":0,"ex_10_l":0,"ex_10_x":0,"exact":1,"exactli":7,"examin":[0,1,2,7],"exampl":[0,5,8],"exc_class":0,"exc_typ":0,"exc_valu":0,"exceed":1,"except":[0,1,2,4,5,8],"exceptionb":[],"exceptionmanualsnapshot":1,"exclud":1,"exclude_imag":1,"exclus":[],"exec":[0,8],"execut":[0,1,2,4,7,8],"exempt":[0,1],"exist":[0,1,3],"exists_on":0,"exit":5,"expand":0,"expans":0,"expcept":[],"expect":[0,1,2,7],"experiment":8,"expir":1,"explicit":[0,1,8],"explicitli":[0,1],"explict":2,"explor":8,"export":0,"expos":[0,1,7,8],"expost":[],"expostur":[],"expr":[0,1,2,4,7,8],"expr_test_bc":4,"express":[0,1,2,4,6,7,8],"exprlist":0,"exprpb":7,"extant":1,"extend":[0,1,2,7,8],"extended_name_path":0,"extens":[0,1,7,8],"extent":[0,1,7],"extern":[0,5],"extra":1,"extract":[0,1],"f":[0,1,2,7,8],"f1":2,"f2":2,"facad":[0,8],"factfind":1,"factori":0,"fail":[0,1],"failur":[0,1,2],"fairli":0,"fall":0,"fallback":0,"fals":[0,1,2,7],"far":0,"fargat":1,"fatal":[3,4],"fatalf":7,"fatalln":7,"faulttolerantsnapshot":1,"favor":0,"featur":[1,5,7,8],"fetch":1,"few":[0,1,7],"ffffffff":1,"field":[0,1,4,7,8],"fieldinit":[0,8],"fifo":2,"file":[0,1,3,5],"filesystem":2,"filter":[0,5,8],"filter_inst":7,"filter_registri":1,"filter_resource_statist":1,"filterrestintegr":1,"filterrestmethod":1,"final":[0,1,2,7,8],"find":[0,2],"find_nam":0,"findid":[],"firehos":1,"first":[0,7,8],"fit":[0,1,7],"fiter":0,"five":7,"fix":[0,1,7],"fixedint":0,"fixedtz":0,"fixtur":0,"fklter":1,"flag":[1,4],"flat":0,"flatten":[],"flavor":0,"fleet":1,"float":[0,2,8],"float_lit":0,"floatvalu":0,"flow":0,"flow_log":[0,1],"flowlogfilt":1,"fmt":7,"fnmatch":[0,1],"focus":1,"follow":[0,1,2,3,4,7,8],"foo":1,"foobar":1,"forbidden":1,"form":[0,1,4,7,8],"formal":[0,7],"format":[0,1,2,3,4,7],"formatt":3,"formerli":0,"forwardref":0,"found":[0,1,8],"foundat":0,"four":[0,1,7,8],"fp_math":4,"fraction":0,"fragment":0,"frame":0,"framework":[7,8],"fraught":4,"fri":1,"friendli":[0,2],"from":[0,1,2,4,5,8],"fromport":1,"front":0,"frozenset":0,"fs_analytical_dev":1,"fs_analytical_qa":1,"fs_core_cas_qa":1,"fs_custodian_tag":1,"fs_manual_ebs_snapshot_expir":1,"fs_manual_rds_snapshot_expir":1,"fsx":1,"fulfil":0,"full":[0,4],"full_control":1,"fulli":0,"func":[0,7],"func_nam":0,"function":[2,5,8],"function_contain":0,"function_endswith":0,"function_ev":0,"function_getd":0,"function_getdayofmonth":0,"function_getdayofweek":0,"function_getdayofyear":0,"function_getfullyear":0,"function_gethour":0,"function_getmillisecond":0,"function_getminut":0,"function_getmonth":0,"function_getsecond":0,"function_match":0,"function_s":0,"function_startswith":0,"functiontyp":[0,7],"functool":7,"fundament":8,"further":0,"futur":0,"g":[0,1,2,4],"g4":0,"gamelift":1,"gatewai":1,"gather":[1,4,7],"gb":1,"gc":1,"gcm":1,"ge":[0,1],"gen":0,"gener":[0,1,4,7,8],"geograph":1,"get":[0,1,2,4,8],"get_access_log":[0,1],"get_account":[0,1],"get_credential_report":[0,1],"get_dbsubnet_group_us":[0,1],"get_endpoint":[0,1],"get_flow_log":1,"get_health_ev":[0,1],"get_instance_imag":[0,1],"get_key_polici":[0,1],"get_launch_configuration_nam":[0,1],"get_load_balanc":[0,1],"get_matching_alias":[0,1],"get_metr":[0,1],"get_metric_statist":1,"get_model":1,"get_nam":0,"get_opt":0,"get_orgid":[0,1],"get_protocol":[0,1],"get_raw_health_ev":[0,1],"get_raw_metr":[0,1],"get_rel":[0,1],"get_related_id":[0,1],"get_related_igw":0,"get_related_kms_kei":0,"get_related_nat_gatewai":0,"get_related_security_config":0,"get_related_sg":0,"get_related_subnet":0,"get_related_vpc":0,"get_resource_polici":[0,1],"get_resource_statist":[0,1],"get_resource_valu":1,"get_type_protect":[0,1],"get_valu":[0,8],"get_vpc":[0,1],"getdat":[0,1],"getdayofmonth":0,"getdayofweek":[0,1],"getdayofyear":0,"getfullyear":0,"gethour":[0,1],"getmillisecond":0,"getminut":0,"getmonth":0,"getsecond":0,"gettz":0,"gherkin":4,"gib":1,"git":4,"github":[0,1,2,4,7],"give":7,"given":[0,1,2,4,7,8],"gl":1,"glacier":1,"glaciercrossaccountaccessfilt":1,"glob":[0,1],"global":0,"globalgrantsfilt":1,"glue":1,"glueconnect":1,"go":[0,1,4,5],"go_mod":0,"goal":0,"golang":[0,4],"goo":1,"good":[1,7],"googl":[0,1,2,4,7],"gracefulli":0,"grai":1,"grammar":[0,4],"grantcount":1,"great":[],"greater":1,"greet":7,"greetfunc":7,"group":[0,7],"group_access":2,"groupid":1,"groupmembership":1,"groupnam":1,"grouppolicysizequota":1,"groupset":1,"groupsperuserquota":1,"groupsquota":1,"gt":[0,1],"gte":1,"h":[0,1,2],"ha":[0,2,4,5,7,8],"had":1,"hand":7,"handl":[0,1,2,7,8],"handler":3,"hapg":1,"happen":0,"hard":0,"hash":0,"hashabl":0,"hasn":8,"hasstatementfilt":1,"hasvirtualmfa":1,"have":[0,1,2,3,4,5,7,8],"haven":1,"head":[0,1,4],"header":1,"healtch":1,"health":0,"health_ev":1,"healthcheckprotocolmismatch":1,"healthev":1,"healtheventfilt":1,"healthfilt":1,"heavi":1,"hello":[0,7],"help":[0,1,2,4,7,8],"here":[0,1,2,7,8],"heredoc":2,"hexadecim":[],"hh":0,"hidden":0,"higher":1,"highli":1,"hint":[0,4,8],"hit":1,"holidai":1,"home":[1,2,3],"hook":0,"host":[0,1],"hostedzon":1,"hostnam":1,"hour":[0,1],"hourli":1,"housekeep_unused_sg":1,"how":[0,1,7],"howev":[0,1,7,8],"hsm":1,"html":[0,1,4,7],"http":[0,1,2,4,5,7],"hybrid":0,"i":[0,2,4,5,6,7,8],"iam":0,"iamaccessfilt":[0,1],"iamgroupinlinepolici":1,"iamgroupus":1,"iaminstanceprofil":[0,1],"iamroleinlinepolici":1,"iamroleusag":[0,1],"iamroleusagemixin":[0,1],"iamsummari":1,"iamuserinlinepolici":1,"iana":[0,1],"id":0,"idea":[0,7],"ideal":0,"ident":[0,1,8],"ident_arg":[0,8],"ident_pat":0,"ident_valu":0,"identif":[],"identifi":[0,1,8],"ie":1,"ietf":0,"ifi":2,"ignor":[0,1,2,7],"ii":0,"imag":[0,4],"imageag":1,"imageagefilt":1,"imagefilt":1,"imageid":[0,1],"imagenam":1,"imagesunusedmixin":[0,1],"imageunusedfilt":[0,1],"immedi":1,"implement":[0,2,4,5,8],"implent":1,"impli":[0,1],"implicit":1,"implicitli":1,"import":[0,1,2,4,5,7,8],"improt":8,"in_tre":[],"includ":[0,1,3,4,5,7,8],"incomplet":0,"incorrect":1,"incorrectlambda":1,"increas":0,"inde":[],"indent":0,"independ":0,"index":[0,4,5],"indexerror":0,"indic":[0,2],"individu":[0,1],"infer":1,"infin":0,"info":[1,3],"inform":[0,1,4,7,8],"infrastructur":5,"init":0,"initi":0,"inject":0,"input":[0,2,7,8],"insid":[0,8],"instal":[4,5],"instanc":[0,7,8],"instance_profile_usag":[0,1],"instanceagefilt":1,"instanceattribut":1,"instancecreatetim":1,"instanceid":0,"instanceimag":1,"instanceimagebas":[0,1],"instanceimagemixin":[0,1],"instanceinitiatedshutdownbehavior":1,"instanceoffhour":1,"instanceonhour":1,"instanceprofil":1,"instanceprofilenam":1,"instanceprofilesquota":1,"instances":7,"instancestorag":1,"instancetyp":1,"instead":[0,1,2,7],"insufficient_data":1,"int":[0,1,2,8],"int32":0,"int32valu":0,"int64":0,"int64_overflow_neg":0,"int64_overflow_posit":0,"int64_valu":[0,4],"int64valu":0,"int_lit":0,"intact":[0,4],"integ":[0,1,2],"integer_math":[0,4],"integr":[0,2,3,8],"intend":0,"intent":[1,2,5],"interact":[0,2,8],"interect":0,"interest":[5,7,8],"interfac":[0,1,7,8],"interfacesecuritygroupfilt":1,"interfacesubnetfilt":1,"interfacevpcfilt":1,"interim":4,"intermedi":[0,7],"intern":[0,1,7,8],"internet":1,"interoper":5,"interpret":0,"interpretedrunn":[0,8],"interrog":0,"intersect":[0,1],"intiial":[],"intoper":0,"intro":0,"introduc":[0,7,8],"introspect":[],"inttyp":[0,2,4,8],"invalid":2,"invalidconfigfilt":1,"invers":1,"invis":1,"involv":[0,2,5,8],"io":[0,7],"iop":1,"iot":1,"ip":1,"ipaddress":0,"ippermiss":1,"ippermissionegress":1,"ipv4address":0,"ipv4network":0,"is_log":[],"ish":4,"islog":1,"isloggingfilt":[0,1],"isn":[0,1,8],"isnotloggingfilt":[0,1],"isqueryloggingen":1,"isrm":1,"iss":7,"isshadow":1,"isshieldprotect":[0,1],"isshieldprotectedmixin":[0,1],"issslfilt":1,"issu":[0,1,7,8],"iswafen":[0,1],"item":[0,1,2,7],"iter":[0,1],"its":[0,1,7],"itself":0,"iunjpz":1,"jme":0,"jmes_path":[0,1],"jmes_path_map":[0,1],"jmespath":[0,1],"job":[0,1],"joda":0,"jq":[0,2,8],"json":[0,1,2,4,7,8],"json_queri":4,"json_to_cel":[0,1,7],"jsonl":0,"jsonlin":2,"just":1,"kai":0,"keep":[0,1],"kei":[0,5,7,8],"kernel":1,"key_id":0,"key_valu":1,"keyalia":1,"keyerror":0,"keyid":1,"keynam":1,"keyrotationen":1,"keyrotationstatu":1,"kind":[0,1,2,7,8],"kinesi":1,"kit":4,"km":0,"kms_alia":[0,1],"kms_kei":[0,1],"kmsfilter":1,"kmskeyalia":1,"known":[0,2,7],"kwarg":0,"l":2,"laast":[],"label":0,"lambda":[0,1],"lambdacrossaccountaccessfilt":1,"lambdaeventsourc":1,"lambdalayervers":1,"langdef":[0,1,4],"languag":[0,1,2,4,7,8],"larg":[1,7],"large_instance_typ":1,"large_resource_set":4,"lark":[0,4,7,8],"last":0,"last_rot":1,"last_used_d":1,"last_used_region":1,"last_used_servic":1,"lastrot":1,"lastupdatedtim":1,"lastwritedai":1,"later":[0,1],"latest":[0,7],"latestsnapshot":1,"launchconfig":1,"launchconfigag":1,"launchconfigfilt":1,"launchconfigurationnam":1,"launchtyp":1,"layer":[0,1,8],"layercrossaccount":1,"lc_userdata":1,"le":[0,1],"lead":[0,1],"learn":4,"least":[0,1],"leav":1,"left":[0,1,4],"legaci":[0,1],"len":[0,1],"length":0,"less":[0,1,7],"let":0,"letter":2,"level":[0,1,3,4,8],"levelnam":3,"leverag":[0,8],"lexic":0,"lh":7,"lib":4,"librari":[0,1,4,7,8],"licens":1,"life":[0,1],"lifecyclerul":1,"like":[0,1,2,3,4,7],"likewis":1,"limit":0,"line":[0,1,2,8],"lineno":3,"link":2,"linkag":1,"lint":4,"linux":2,"list":[0,1,4,7,8],"list_lit":[0,8],"list_typ":[],"listtyp":[0,8],"listvalu":0,"liter":[0,1,2,8],"littl":[0,2,4],"ll":[0,7,8],"load":[0,1],"load_annot":0,"load_valu":0,"local":[0,1,3,4,8],"localized_ev":0,"locat":0,"log":[0,2,3,7],"logcrossaccountfilt":1,"logg":1,"logger":[0,3],"loggroup":1,"logic":[0,2,4,7],"logical_and":0,"logical_condit":0,"logical_not":0,"logical_or":0,"logtarget":1,"long":[0,1],"longer":[1,2],"longest":0,"longtz":0,"look":[0,1,4,7],"lookup":0,"loos":[],"loosevers":0,"los_angel":1,"loss":1,"lot":[],"lower":[0,1],"lowercas":0,"lt":[0,1],"lte":1,"m":[0,1,2,6,7],"m1":7,"m3":1,"machin":1,"machineri":[],"macro":[0,1,4,8],"macro_":0,"macro_al":0,"macro_exist":0,"macro_exists_on":0,"macro_filt":0,"macro_has_ev":0,"macro_map":0,"made":[0,1],"magnet":1,"magnitud":0,"mai":[0,1,4,6,7,8],"maid":1,"maid_offhour":[0,1],"maid_statu":1,"main":[0,8],"major":1,"make":[0,1,2,7,8],"makefil":5,"manag":0,"mani":[0,1,2],"manual":[1,4],"map":[0,1,2,7,8],"map_lit":[0,8],"map_typ":[],"mapinit":0,"mapkeytyp":8,"mappubliciponlaunch":1,"maptyp":[0,1,7,8],"march":0,"mark":[],"marked_kei":[0,1],"markedforop":1,"marker":[0,4],"mask":[0,7],"master":[0,1,4,7],"match":[0,1,4,6,7,8],"matchabl":1,"materi":0,"math":[0,2],"matter":0,"max":1,"maximum":1,"maxproperti":1,"maxsecond":0,"mayb":0,"mccarthi":0,"md":[0,1,4,7],"me":7,"mean":[0,1,2,7,8],"meaning":0,"medium":1,"meet":7,"member":[0,1,5],"member_dot":[0,8],"member_dot_arg":[0,8],"member_index":0,"member_item":[0,8],"member_object":[0,8],"mental":2,"mere":0,"messag":[0,1,3,4,7],"message_liter":0,"messagebrok":1,"messagetyp":[0,8],"meta":0,"meth":0,"method":[0,3,4,7,8],"method_ev":0,"method_id":0,"metric":0,"metricnam":0,"metricsaccess":0,"metricsfilt":1,"mfa_act":1,"mfadevic":1,"mfadevicesinus":1,"mi":1,"middl":0,"might":[0,7],"mimic":2,"min":1,"mini":2,"minim":[0,3,5],"minimum":[0,1],"minimumpasswordlength":1,"minproperti":1,"minsecond":0,"minut":[0,1],"mismatch":0,"mismatchs3origin":1,"miss":[0,5],"missingrout":1,"mistak":1,"mix":0,"mixin":[0,1],"mkgherkin":4,"ml":1,"mlstring_lit":0,"mm":[0,1],"mock":[0,1],"mod":[0,1],"mode":[0,2],"model":[0,1,7],"modern":1,"modif":[1,2],"modifi":[0,1],"modifyablevolum":1,"modul":[0,1,3,4,5,7,8],"modulo":0,"modulu":0,"moment":1,"mon":1,"monad":0,"monitor":1,"monthli":1,"more":[0,1,2,3,4,5,8],"morn":1,"most":[0,1,2,4,7,8],"mount":1,"mq":1,"mqmetric":1,"mqsgfilter":1,"mqsubnetfilt":1,"mssage":1,"much":[0,2],"mul":0,"multi":1,"multilin":2,"multipl":[0,1,2,7,8],"multipli":1,"multiplication_div":0,"multiplication_mod":0,"multiplication_mul":0,"must":[0,1,2,3,4,7,8],"my":1,"my_extens":7,"my_extns":[],"mydata":1,"n":[0,2,7],"nacl":1,"name":[1,2,3,4,5,7],"name1":0,"name2":0,"name_arg":7,"name_token":0,"namecontain":[0,3,8],"nameerror":[0,8],"namespac":[0,1,4],"nano":0,"nanosecondspersecond":0,"narrowli":1,"nat":1,"nativ":[0,1,7],"navgiat":[],"navig":0,"nc":[0,1],"nc1":0,"nc2":0,"ndjson":[0,2],"ne":[0,1],"necessari":0,"necessarili":0,"need":[0,1,3,5,7,8],"needless":0,"needlessli":[],"neg":0,"neither":[4,8],"nest":[0,7,8],"nested_activ":0,"net":[0,1],"networkacl":1,"networkin":1,"networkinterfac":1,"networkloc":1,"networkout":1,"new":[0,1,7],"new_activ":0,"new_text":0,"newenv":7,"newer":7,"newfunct":7,"newinstanceoverload":7,"newli":1,"newlin":2,"newoverload":[],"newvar":7,"next":[0,1,8],"ni":1,"nice":[0,7],"nightli":1,"nil":7,"nljson":[0,2],"no_such_field":0,"node":0,"nodesnaphot":1,"nomin":0,"non":[0,3,5,7],"non_compli":1,"none":[0,1,7],"nonetyp":0,"nonpubl":1,"nor":8,"noreturn":0,"normal":[0,1,2],"nospecificiamrolemanagedpolici":1,"not_":0,"not_applic":1,"not_nul":1,"notabl":2,"notact":1,"note":[0,1,2,7,8],"notebook":1,"notebookinst":1,"notebooksecuritygroupfilt":1,"notebooksubnetfilt":1,"notencryptedfilt":1,"notfound":0,"noth":[0,1],"notifi":1,"notimplementederror":7,"notion":0,"notprincip":1,"notresourc":1,"notsetsentinel":0,"nov":1,"now":[0,1,7],"nsib":[],"nsj7vg":1,"ntp":1,"nuanc":[0,8],"null":[0,1,2],"null_lit":0,"null_typ":[],"null_valu":0,"nulltyp":[0,8],"nullvalu":0,"number":[0,1,2,4,7,8],"number_valu":0,"numer":7,"o":[0,1,4],"obect":0,"object":[2,5,7,8],"object_hook":0,"object_pairs_hook":0,"objecthook":0,"obscur":[0,1],"obsolet":0,"obvers":1,"obviou":7,"occur":[1,7],"octal":0,"odd":0,"off":[0,1],"offer":[0,1,8],"offhour":0,"offhours_except":1,"offset":[0,1],"often":[0,4,5,7],"ok":1,"old":[0,1],"older":1,"omit":[1,2,7],"onc":[0,1],"one":[0,1,2,4,5,7,8],"oneof":[0,1],"onli":[0,1,2,3,4,7],"onlin":1,"onlyport":1,"onto":0,"oop":[0,7],"op":[0,7],"op_name_map":0,"opa":1,"opaqu":0,"open":[0,1],"openpolicyag":[0,1],"opensourc":5,"oper":[0,1,2,7,8],"operand":[0,1],"operator_in":0,"opswork":1,"opt":1,"optim":[0,1,7],"option":[0,2,3,6],"order":[0,1],"ordinari":0,"oreo":1,"org":[0,1,2,4],"organ":[1,5],"organi":8,"organiz":1,"orgid":0,"origin":[0,7],"other":[0,1,2,3,4,6,7,8],"otherwis":0,"out":[0,1,4,7],"outlin":[1,7],"output":[0,2,3,4,7],"outsid":[0,1,7,8],"over":[0,1,2,4,7,8],"overal":[0,7,8],"overdraftlimit":7,"overdraftprotect":7,"overflow":0,"overhead":[0,8],"overlap":0,"overload":[0,7,8],"overloadd":0,"overrid":[0,1,8],"overridden":0,"overwhelm":1,"overwrit":4,"own":[0,1,7],"owner":[1,7],"ownercontact":1,"ownereid":1,"p":[0,2],"paackag":[],"pacif":1,"packag":[0,2,3,5,6,7,8],"packagetyp":0,"page":5,"pair":[0,1],"paragraph":3,"parallel":[0,2,4],"param":[],"paramet":[0,3,7],"parameterfilt":1,"paren_expr":[0,8],"parent":[0,1],"parent_it":0,"pari":0,"pars":[0,1,4,8],"parse_cidr":[0,1],"parse_const":0,"parse_d":1,"parse_float":0,"parse_int":0,"parse_text":[0,1],"parser":[0,1,2,7,8],"part":[0,1,4,5,7,8],"partial":[0,7],"particular":[0,1,2],"particularli":1,"partit":0,"partivular":0,"pass":[0,1,4,7],"password_en":1,"password_last_chang":1,"password_last_us":1,"password_next_rot":1,"passwordpolicyconfigur":1,"past":1,"patch":1,"path":[0,1,4],"path_sourc":0,"pattern":[0,1,2],"payload":0,"pb2g":5,"peer":1,"peeringconnect":1,"pend":0,"pendulum":[0,1],"per":1,"percent":1,"perfectli":1,"perform":[0,1,4,8],"perhap":0,"period":[0,1],"permiss":[1,2],"permissionsboundaryusagecount":1,"permit":[0,1,3,7,8],"persist":0,"person":8,"perspect":7,"pg":1,"pgm":[0,1],"phase":0,"phase1transpil":0,"phase2transpil":0,"phd":1,"phoni":4,"pick":2,"piec":[1,2],"pingstatu":1,"pip":[4,6],"pipe":2,"place":[0,1,2],"plan":[0,1],"platform":[1,4,5,6],"platformnam":1,"platformvers":1,"pleas":1,"pleasant":0,"plu":[0,1],"pluck":0,"plumb":4,"pm":1,"poetri":6,"point":[0,1,2,7,8],"polici":[0,5,7],"policiesquota":1,"policyassign":1,"policynam":1,"policysizequota":1,"policyversionsinus":1,"policyversionsinusequota":1,"polit":0,"pollut":3,"pool":[0,1],"poorli":0,"pop":0,"popul":0,"popular":1,"port":1,"posit":[0,7],"possibl":[0,1,2,8],"possibli":[0,1],"post":1,"power":2,"pprint":0,"pragmat":[0,7],"prcess":1,"precis":4,"predefin":8,"prefer":0,"prefetch_instance_imag":0,"prefix":[0,1],"prefixlen":[0,1],"preloop":0,"prepar":[0,1,8],"prepare_queri":[0,1],"presenc":[0,1,7],"present":[0,1,4],"preserv":1,"presum":2,"pretti":0,"prevent":[0,1,7],"previou":[0,1,7],"previous":1,"prg":7,"prgm":[0,7],"primari":[0,2,8],"primarili":0,"primit":[1,2],"princip":1,"principl":[0,5],"print":0,"println":7,"prior":[0,7],"probabl":1,"problem":[0,1,4,8],"process":[0,1,2,4,7],"process_json_doc":0,"process_resource_set":1,"process_value_typ":1,"prod":7,"prodlog":1,"produc":[0,4,7],"product":[0,5],"productcod":1,"profil":1,"program":[0,1,2,5,7,8],"programopt":7,"progress":0,"project":[0,1,5,7],"promot":1,"prompt":[0,2],"propag":[0,1],"proper":[0,1],"properli":6,"properti":[0,1,7],"propog":0,"propos":1,"proto":[0,7],"proto2":4,"proto3":4,"proto3pb":0,"protobuf":[0,1,2,4,7],"protobuf_messag":8,"protobuf_typ":0,"protobyf":0,"protocol":[0,5],"protubuf":[],"provid":[1,2,3,4,7,8],"provis":[0,1],"proxi":1,"pst":1,"pt":[0,1],"pubfac":1,"public":0,"pull":[1,4],"purchas":1,"pure":0,"purpos":1,"push":0,"put":1,"py":[0,1,4],"pycodeblock":[],"pypi":0,"python":[0,1,4,6,7,8],"pythonpath":[],"pythontranspil":0,"qa":1,"qualifi":0,"qualified_identifier_resolution_uncheck":0,"queri":0,"question":0,"queue":1,"quick":4,"quickli":5,"quietli":0,"quit":[0,2,7,8],"quot":2,"quota":1,"quux":0,"r":[0,2,7],"r53domain":1,"radisti":1,"raft":1,"rais":[0,2,3,7,8],"raisw":[],"ramdisk":1,"rang":[0,8],"rank":1,"rare":[0,1],"rather":7,"raw":[0,1],"rd":[0,1],"rdscluster":1,"rdsclustersnapshot":1,"rdsoffhour":1,"rdsonhour":1,"rdssnapshot":1,"rdssnapshotag":1,"rdssnapshotonhour":1,"rdssubnetgroup":1,"rdt":1,"re":[0,1,4],"re2":[0,6],"reach":[0,1],"read":[0,1,2,4,7],"read_acp":1,"readi":[0,7],"readm":[0,7],"readonli":1,"readonlyrootfilesystem":1,"readreplicadbinstanceidentifi":1,"readreplicasourcedbinstanceidentifi":1,"readthedoc":7,"real":0,"realli":[0,2],"reason":[1,5],"receiv":7,"recent":[0,1,4],"recogn":0,"recommend":1,"recov":1,"recurs":0,"redact":1,"redshift":1,"redshiftsnapshot":1,"redshiftsnapshotag":1,"redshiftsnapshotcrossaccount":1,"reduc":[0,1],"reduct":0,"ref":[0,1,7],"ref_to":0,"refactirubg":1,"refactor":[0,1],"refer":[1,2,5,7,8],"referenc":1,"reflect":[0,4,7],"refractor":[],"refresh_period":1,"refus":0,"regex":[0,1],"region":[0,1],"regist":[0,1],"registri":[0,1],"regular":[1,2,6],"rehydr":[0,1],"reject":1,"rel":0,"relat":[0,1,7,8],"relatedresourcefilt":[0,1],"relatedresourcemixin":[0,1],"relation_eq":0,"relation_g":0,"relation_gt":0,"relation_in":0,"relation_l":0,"relation_lt":0,"relation_n":0,"relationshiup":1,"releas":1,"reli":[0,1,2,4,7],"remain":1,"remaind":0,"remot":0,"remov":[0,1,4,7],"renam":[0,1,8],"reorder":1,"repeat":0,"repeatedli":[0,1],"repl":[0,2,3],"replac":[0,1,7,8],"replicationinst":1,"report":[1,4],"report_delai":1,"report_gener":1,"report_max_ag":1,"repositori":4,"repr":0,"repres":[0,1],"represent":[0,1],"reproduc":4,"request":[0,1,7],"requie":[],"requir":[0,2,4,5,7,8],"require_ssl":1,"requiredencryptedputobject":1,"requireencryptedputobject":1,"requirelowercasecharact":1,"requirenumb":1,"requiresslaccessrdt":1,"requiresymbol":1,"requireuppercasecharact":1,"rerefer":0,"reservedconcurr":1,"resili":1,"resiz":1,"resize_config":1,"resolut":[7,8],"resolv":[0,7],"resolve_funct":0,"resolve_nam":[0,8],"resolve_vari":0,"resourc":[0,1],"resource_count":[0,1],"resource_list":7,"resource_schedul":[0,1],"resource_typ":[1,7],"resourcekmskeyalia":[0,1],"resourcekmskeyaliasmixin":[0,1],"respect":0,"rest":2,"restapi":1,"restapicrossaccount":1,"restor":[0,1],"restresourc":1,"restrict":1,"result":[0,1,2,7,8],"result_funct":0,"result_valu":0,"resum":1,"resut":[],"retriev":2,"return":[0,1,2,7,8],"reus":[0,1],"revers":[0,1],"review":7,"revis":[1,4],"rework":1,"rewrit":[4,7],"rewritten":0,"rfc":0,"rfc3339":0,"rh":7,"rhymjmbbe2":1,"rich":0,"right":[0,8],"role":[0,1],"rolecrossaccountaccess":1,"rolenam":1,"rolepolicysizequota":1,"rolesquota":1,"roll":4,"root":[0,1,3],"root_scop":0,"rootdevicenam":1,"route53":1,"routet":1,"rrset":1,"rsa":1,"rst":[],"rule":[0,7],"rulestatu":1,"run":[0,1,4,5,7,8],"runnabl":0,"runner":[0,3,7,8],"runner_class":[0,1],"runtim":0,"s3":0,"s3bucketnam":1,"s3crossaccountfilt":1,"s3metric":1,"s3publicblock":1,"sagemak":1,"sai":[0,1],"said":0,"same":[0,1,2,4,7,8],"samplecount":1,"save":[0,1,2],"sc":1,"scale":[0,1],"scan":[1,4],"scan_group":[0,1],"scatter":1,"scenario":[0,4],"schedul":1,"schedulepars":[0,1],"schema":[1,7],"scope":0,"script":8,"se":1,"search":[0,1,5],"searchabl":0,"sechema":[],"second":[0,1],"secondari":1,"secondarili":0,"secret":[1,7],"secretsmanag":[0,1],"section":[1,4,8],"secur":[0,2,5],"securetransport":1,"security_group":[0,1],"security_group_id":0,"securitygroup":1,"securitygroupdifffilt":1,"securitygroupfilt":1,"securitygrouplockedfilt":1,"see":[0,1,2,3,4,7,8],"seed":0,"seem":[0,1,8],"select":[0,1],"selector":1,"selector_valu":1,"self":[0,1,4,7],"self_eval_int_zero":4,"self_eval_uint_zero":4,"self_eval_zeroish":4,"selfcheck":4,"selfrefer":1,"semant":[0,1,2,4,5,8],"semicolon":1,"send":1,"sens":8,"sensibl":[0,1],"sentinel":[0,1],"separ":[0,1,2,7,8],"seper":1,"sequenc":[0,1,7,8],"serial":[2,8],"serializ":0,"seriou":0,"serv":0,"server":[0,1],"servercertif":1,"servercertificatesquota":1,"servic":[0,8],"service_role_usag":[0,1],"servicelimit":1,"servicemetr":1,"servicetaskdefinitionfilt":1,"sessioncontext":1,"sessionissu":1,"set":[0,1,2,3,4],"set_activ":0,"set_annot":1,"setgid":2,"setuid":2,"setup":1,"sever":[0,1,2,4,8],"sg":1,"sg_unus":1,"sgdefaultvpc":1,"sgusag":[0,1],"sgusagemixin":[0,1],"sha256":1,"sha384":1,"shadow":0,"shake":7,"shake_hand":7,"shake_hands_string_str":[],"shakefunc":[],"share":1,"shell":[2,8],"shield":0,"shield_protect":[0,1],"shield_subscript":[0,1],"shielden":[0,1],"shieldenabledmixin":[0,1],"shop":1,"short":[0,7],"shorthand":[0,1],"should":[0,1,4,8],"show":[0,2,3,7],"shown":0,"shrink":1,"si":1,"sid":1,"side":[],"sign":[0,8],"signatur":7,"signifi":1,"significantli":6,"signingcertificatesperuserquota":1,"silenc":[0,1],"silent":[0,4,7],"similar":[0,1,2,7],"similarli":[0,1],"simpl":[0,4,8],"simple_test":[],"simpledb":1,"simpler":[0,1],"simplest":[],"simpli":[0,7],"simplifi":0,"sinc":[0,1,2],"singl":[0,1,2,7],"single_bool":0,"single_byt":0,"single_doubl":0,"single_dur":0,"single_fixed32":0,"single_fixed64":0,"single_float":0,"single_int32":0,"single_int64":0,"single_sfixed32":0,"single_sfixed64":0,"single_sint32":0,"single_sint64":0,"single_str":0,"single_timestamp":0,"single_uint32":0,"single_uint32_wrapp":0,"single_uint64":0,"singledispatch":7,"singleton":[0,5,7],"singletonfilt":1,"singular":0,"situat":1,"size":[0,1,7],"size_parse_cidr":[0,1],"skew":1,"skew_hour":1,"skier":1,"skip":0,"skipkei":0,"slice":[],"slight":[1,7],"slightli":[0,1,7,8],"slighyli":7,"slower":1,"slowli":4,"slurp":[0,2],"sm":1,"small":7,"smaller":0,"smarter":8,"smi":1,"sn":[0,1],"snapshot":0,"snapshotag":1,"snapshotcreatetim":1,"snapshotcrossaccountaccess":1,"snapshotid":1,"snapshotskipamisnapshot":1,"snapshottyp":1,"snapshotunusedfilt":[0,1],"snapshotunusedmixin":[0,1],"snowbal":1,"snscrossaccount":[0,1],"snscrossaccountmixin":[0,1],"so":[0,4,7],"socket":2,"some":[0,1,2,3,7,8],"some_activ":0,"some_dict":0,"some_str":0,"someparam":1,"someth":[0,1],"sometim":[0,7],"somev":1,"somewhat":[0,7,8],"sophist":[0,7],"sort":7,"sort_kei":0,"sourc":[0,4,7],"source_data":0,"source_text":0,"sourcedestcheck":1,"sourceforg":0,"span":1,"sparingli":1,"spawn":1,"spec":[0,1,2,4],"special":[0,1,4,7],"specif":[0,3,4,5,7,8],"specifi":1,"specificaiton":4,"specificiamrolemanagedpolici":1,"speed":6,"spell":1,"sphinx":4,"spin":1,"spite":7,"spread":[0,2],"sprintf":7,"sq":1,"sql":1,"sqlserveraudit":1,"sqscrossaccount":1,"squar":1,"src":4,"sriovnetsupport":1,"ssd":1,"ssh":1,"sslnegot":1,"sslpolici":1,"sslpolicyfilt":1,"sslv2":1,"sslv3":1,"ssmstatu":1,"st":1,"st_atim":2,"st_birthtim":2,"st_blksize":2,"st_block":2,"st_ctime":2,"st_dev":2,"st_flag":2,"st_gen":2,"st_ino":2,"st_mtime":2,"st_nlink":2,"st_rdev":2,"st_size":2,"stack":[0,1],"stage":1,"stand":[0,1,8],"standard":[0,1,2,7],"start":[0,1,3,4,7,8],"startswith":7,"starttim":[0,1],"stat":[0,2],"state":[0,7],"statement":[0,7,8],"statement_id":1,"statetransitionag":1,"stati":2,"static":0,"statist":[0,1],"statu":[0,5],"status":[0,1],"stdin":[0,2],"stdout":0,"stem":4,"step":[0,1,4,7],"stick":[],"sticki":2,"still":[0,2,4],"stop":1,"storag":1,"store":1,"stori":[],"str":[0,1,8],"stream":[0,1],"streamhandl":3,"strict":0,"strictli":0,"string":[0,1,2,4,7],"string_greet_str":7,"string_lit":0,"string_valu":0,"stringtyp":[0,7,8],"stringvalu":0,"strip":1,"strong":1,"strongli":1,"struct":0,"structpb":0,"structur":[0,1,7,8],"studi":1,"stuff":7,"sub":[0,1,7],"sub_activ":0,"sub_ev":0,"sub_eval_parti":0,"sub_evalu":0,"sub_transpil":[],"subclass":[0,1,7,8],"subclss":0,"sublanguag":1,"subnet":0,"subnet_id":0,"subnetfilt":1,"subnetid":1,"subnetrout":1,"subscript":1,"subsequ":[0,1],"subset":[0,8],"subsidiari":0,"subst":[0,1],"substanti":7,"substitut":0,"subtl":0,"succesfulli":1,"success":[0,1,7],"successfulli":[0,4],"suffic":1,"suffix":[0,1],"sugar":0,"suggest":1,"suit":[1,4],"suitabl":1,"sum":1,"summari":5,"sun":1,"super":[0,1],"superclass":[0,1],"supertyp":8,"supplement":0,"suppli":[0,2],"support":[0,1,2,4,8],"sure":[1,4],"surpris":4,"survei":1,"suspend":1,"suspendedprocess":1,"swallow":0,"swap":1,"symbol":2,"synopsi":5,"syntact":[0,4],"syntax":[0,1,2,7,8],"system":[0,5],"t":[0,1,2,4,7,8],"tab":0,"tabl":1,"tag":[0,7],"tag_polici":7,"tag_policy_filt":7,"tag_valu":0,"tagstatu":1,"tailor":0,"take":[0,1],"take_act":7,"taken":[1,7],"tangl":8,"target":[0,4],"target_engin":1,"targetfunc":0,"targetgroup":1,"tasktaskdefinitionfilt":1,"tb":0,"tbd":0,"team_nam":1,"tech":1,"techniqu":[],"temp":1,"templat":[0,1],"temporari":[0,8],"ten":8,"tend":0,"ters":1,"tertiari":0,"test":[0,1,2,4,7,8],"test_all_typ":0,"test_c7nlib":0,"testabl":1,"testalltyp":0,"testdata":4,"text":[0,1,2,8],"text2":0,"text_from":[0,1],"textproto":4,"textproto_to_gherkin":[],"than":[0,1,2,4,5,7],"the_activ":0,"the_filt":[0,1],"thei":[0,1,4,7,8],"them":[0,1,2],"thi":[0,1,2,3,4,5,6,7,8],"thing":[0,1,8],"think":0,"thirti":1,"those":[0,1,3,7],"three":[0,1,5,7,8],"threshold":1,"through":[0,1],"tidi":8,"tidyup":1,"time":[0,1,2,7],"timedelta":[0,1,8],"timestamp":[0,1,4,7],"timestamptyp":[0,1,7,8],"timezon":[0,1,7],"tini":2,"titl":1,"titlecas":0,"tl":1,"tlq9fr":1,"tls12":1,"tlsv1":1,"to_python":0,"todo":1,"token":0,"toler":0,"toml":[2,3],"too":[0,8],"tool":[5,6],"top":[0,1,4,8],"topic":[1,2,5],"tot":2,"total":[1,2],"toward":0,"tox":4,"tp":0,"tp1":0,"tp2":0,"tpb":0,"trace":[0,2,3],"traceback":[0,7],"tracebacktyp":0,"track":[0,7],"tradit":[0,2],"traffic":1,"trail":1,"transact":7,"transform":[0,1,4,7],"transient":[0,8],"transit":1,"translat":[0,1],"transpar":0,"transpil":[0,3,5],"transpilertre":0,"travers":1,"treat":[0,2],"tree":[0,4,7,8],"tree_class":0,"tree_dump":0,"tree_for_express":0,"tree_for_vari":0,"tree_node_class":0,"tri":1,"trigger":1,"trim":[0,1],"tripl":0,"trivial":[0,1],"troublingli":1,"true":[0,1,2,3,7],"truncat":0,"trust":1,"truthi":0,"try":[0,7],"tupl":0,"turn":[0,1],"tweet":7,"two":[0,1,2,4,7,8],"txt":[0,1],"typ":0,"type":[1,4,5],"type_match":0,"type_nam":0,"type_name_map":[],"type_schema":1,"typeerror":0,"typetyp":[0,8],"tz":[0,1,7],"tz_alias":[0,1],"tz_name":0,"tz_name_lookup":0,"tz_offset_pars":0,"tz_pars":0,"tzinfo":[0,1],"tzutc":1,"u":[0,1,7],"u0001f431":0,"u270c":0,"ubuntu":1,"uint":0,"uint32":0,"uint32valu":0,"uint64":0,"uint64_overflow_neg":0,"uint64_overflow_posit":0,"uint64_valu":[0,4],"uint64valu":0,"uint_lit":0,"uinttyp":[0,4,7,8],"uk":1,"unari":0,"unary_minus_no_overload":0,"unary_neg":0,"unary_not":0,"unchosen":0,"uncomput":7,"undecid":0,"undeclar":0,"under":1,"underli":8,"understand":8,"underutil":1,"unencrypt":1,"unexpect":4,"unifi":[0,1],"uniform":2,"union":[0,1,8],"uniqu":[0,1,8],"unique_s":[0,1],"unit":0,"unittest":0,"unknown":4,"unless":1,"unlik":0,"unmark":1,"unmodifi":1,"unoptim":1,"unsign":[0,8],"unsupport":0,"untag":1,"until":0,"unus":0,"unusediampolici":1,"unusediamrol":[0,1],"unusedinstanceprofil":[0,1],"unusedlaunchconfig":[0,1],"unusedrdssubnetgroup":[0,1],"unusedsecuritygroup":[0,1],"unusu":1,"unwieldi":1,"up":[0,1,6],"upcom":[0,1],"updat":[0,1,4],"upgradeavail":1,"upper":0,"uptimefilt":1,"uri":0,"url":[0,1,4],"us":[0,3,4,5,6,8],"usabl":[0,8],"usag":[1,2],"usediampolici":1,"usediamrol":1,"usedinstanceprofil":1,"usedsecuritygroup":1,"user":3,"user_access":2,"user_creation_tim":1,"useraccesskei":1,"userag":1,"usercredentialreport":1,"userdata":1,"userdatafilt":1,"userguid":1,"userid":2,"userident":1,"usermfadevic":1,"usernam":1,"userpolici":1,"userpolicysizequota":1,"usersquota":1,"usual":0,"utc":[0,7],"utcnow":[0,1],"util":1,"uv":[4,6],"v":[0,2,4],"val":7,"valid":[0,4],"valid_key_typ":0,"validconfigfilt":1,"valu":[2,3,4,7,8],"value_typ":0,"valueerror":0,"valuefilt":1,"valuekv":1,"values_from":1,"valuesfrom":0,"var":[0,7],"vari":1,"variabl":[0,1,3,4,5,7,8],"variant":[0,1,7],"variat":1,"varieti":[0,8],"variou":[0,1,2,8],"vault":1,"ve":[2,7],"verbos":4,"veri":[0,1,3,4,8],"verifi":1,"version":[0,1,3,4,7],"versionsperpolicyquota":1,"via":[0,1,7,8],"viabl":0,"view":8,"virtual":6,"visibl":[0,4],"visit":[0,8],"visit_children":0,"visitor":0,"visual":7,"vm":1,"vol":1,"volum":1,"volumeid":1,"volumin":2,"vpc":0,"vpc_id":0,"vpcconfig":1,"vpce":0,"vpcendpoint":1,"vpcfilter":[0,1],"vpcid":1,"vpcidfilt":1,"vpclink":1,"vpcsecuritygroupfilt":[0,1],"vpcsubnetfilt":0,"vpn":1,"w":[1,2],"wa":[0,1,7],"wafen":1,"wai":[0,1,2,7],"wait":1,"walk":[0,8],"want":[0,1,2,7],"warn":[0,1,3],"watch":1,"we":[0,1,2,7,8],"web":1,"web_acl":[0,1],"webacl":1,"week":1,"weekdai":1,"weekend":1,"weekli":1,"well":[0,1,2,7,8],"west":1,"what":[0,2,7],"when":[0,1,2,4,6,7,8],"where":[0,1,2,4,6,8],"wherea":8,"whether":[0,1,7],"which":[0,1,4,7,8],"while":[0,1,2,7,8],"whitelist":1,"whitelist_condit":1,"whitelist_endpoint":1,"whitelist_endpoints_from":1,"whitelist_from":1,"whitelist_orgid":1,"whitelist_orgids_from":1,"whitelist_protocol":1,"whitelist_protocols_from":1,"whitelist_vpc":1,"whitelist_vpc_from":1,"whitelist_vpce_from":1,"who":1,"whole":[5,7,8],"whose":1,"why":[0,2],"wide":[1,8],"width":0,"wildcard":[],"win":1,"window":[1,7],"wip":4,"wire":1,"wise":4,"with_traceback":0,"withdraw":7,"within":[0,1,7],"without":[0,1,2,3,7,8],"won":0,"work":[0,1,7,8],"workabl":1,"worker":1,"workflow":1,"world":[0,7],"woth":8,"would":[0,1,7],"wrap":[0,7,8],"wrapper":0,"wrapperspb":0,"wrire":0,"write":[2,4],"write_acp":1,"writen":1,"written":4,"wrt":1,"www":[0,1,4],"x":[0,1,2],"x_sign":0,"xrayencrypt":1,"xyz":1,"y":[0,1],"yaml":7,"ye":[1,2],"yeah":0,"yet":8,"yield":[0,1],"you":[0,1,2,7],"your":[1,4,7],"yyyi":1,"z":[0,1],"z0":0,"za":[0,1],"zero":[0,2,4],"zerodivisionerror":0,"zone":[0,1,7],"\u00b5":0},"titles":["API Reference","C7N Functions Required","CLI Use of CEL-Python","Configuration","Development Tools","Pure Python Google Common Expression Language (CEL)","Installation","Application Integration","Architecture and Design"],"titleterms":{"The":[0,4,8],"__main__":0,"access":1,"account":1,"adapt":0,"addit":0,"ag":1,"alia":1,"all":1,"allow":1,"ami":1,"anoth":[],"api":[0,7],"applic":7,"architectur":8,"argument":2,"attribut":1,"avail":1,"baselin":7,"bind":7,"block":1,"bool":1,"boolean":1,"bucket":1,"builtin":7,"bulk":7,"c7n":[0,1,7],"c7nlib":0,"cach":1,"capac":1,"cel":[2,5,8],"celfilt":1,"celpars":0,"celpi":0,"celtyp":0,"chang":[],"check":1,"cidr":1,"cli":2,"cloud":7,"cloudtrail":1,"common":[1,5],"compil":8,"complianc":1,"compon":8,"concurr":1,"config":1,"configur":[2,3],"construct":1,"contain":8,"content":[1,5],"context":[0,1,8],"convers":1,"count":1,"credenti":1,"cross":1,"custodian":7,"custom":7,"data":1,"db":1,"default":1,"defin":7,"definit":1,"delta":1,"descript":[2,4],"design":[1,8],"detail":0,"develop":4,"devic":1,"dhcp":1,"diff":1,"doc":4,"document":5,"dot":8,"eb":1,"egress":1,"enabl":1,"encrypt":1,"environ":2,"ephemer":1,"error":7,"essenti":7,"evalu":[0,8],"event":1,"exampl":[1,2,4,7],"except":7,"exit":2,"express":5,"extern":[1,7],"fault":1,"featur":[0,4],"file":[2,4],"filter":[1,7],"find":1,"flow":1,"from":7,"function":[0,1,7],"global":[1,7],"go":7,"googl":5,"grant":1,"group":1,"ha":1,"header":[],"health":1,"healthcheck":1,"i":1,"iam":1,"id":1,"imag":1,"implement":[1,7],"indic":5,"ingress":1,"inlin":1,"instal":6,"instanc":1,"integr":[1,5,7],"invalid":1,"inventori":1,"kei":1,"km":1,"languag":5,"last":1,"latest":1,"launch":1,"lifecycl":1,"limit":1,"listen":1,"locat":1,"lock":1,"log":1,"makefil":4,"manag":1,"mark":1,"member":8,"method":1,"metric":1,"mfa":1,"mismatch":1,"miss":[1,8],"modify":1,"more":7,"name":[0,8],"namespac":2,"network":1,"non":1,"note":[],"notif":1,"numer":0,"object":[0,1],"offhour":1,"onhour":1,"op":1,"oper":[],"option":1,"origin":1,"overview":5,"param":1,"paramet":1,"parser":[],"password":1,"pb2g":4,"polici":1,"principl":1,"product":8,"progag":1,"project":4,"protect":1,"protocol":1,"provid":0,"public":1,"pure":5,"py":[],"python":[2,5],"queri":1,"readm":[],"refer":0,"requir":1,"reserv":1,"resolut":0,"resourc":7,"rest":1,"rotat":1,"rout":1,"rule":1,"run":[],"s3":1,"secur":1,"servic":1,"shadow":1,"shield":1,"simpl":7,"singleton":1,"skip":1,"snapshot":1,"sourc":1,"specif":1,"ssl":1,"ssm":1,"stale":1,"state":1,"statement":1,"statu":[1,2],"string":[],"structur":[],"subnet":1,"summari":1,"synopsi":[2,4],"tabl":5,"tag":1,"target":1,"task":1,"termin":1,"textproto_to_gherkin":[],"time":8,"timzon":0,"todo":0,"toler":1,"tool":4,"transpil":8,"type":[0,2,7,8],"unus":1,"upgrad":1,"uptim":1,"us":[1,2,7],"user":1,"valid":1,"valu":[0,1],"value_from":[0,1],"value_typ":1,"variabl":2,"virtual":1,"vpc":1,"waf":1,"write":1,"xrai":1}}) \ No newline at end of file +Search.setIndex({"alltitles": {"API Reference": [[0, null]], "Additional Functions": [[0, "additional-functions"]], "Application Integration": [[7, null]], "Architecture and Design": [[8, null]], "Arguments, Types, and Namespaces": [[2, "arguments-types-and-namespaces"]], "Baseline C7N Example": [[7, "baseline-c7n-example"]], "Bulk Filter Example": [[7, "bulk-filter-example"]], "C7N Cache": [[1, "c7n-cache"]], "C7N Context Object": [[0, "c7n-context-object"], [1, "c7n-context-object"]], "C7N Filter and Resource Types": [[7, "c7n-filter-and-resource-types"]], "C7N Functions Required": [[1, null]], "CEL Types": [[8, "cel-types"]], "CELFilter Design": [[1, "celfilter-design"]], "CLI Use of CEL-Python": [[2, null]], "CONFIGURATION": [[2, "configuration"]], "Cloud Custodian (C7N) Integration": [[7, "cloud-custodian-c7n-integration"]], "Common C7N Constructs": [[1, "common-c7n-constructs"]], "Common/Boolean Filters": [[1, "common-boolean-filters"]], "Common/Non-Bool Filters": [[1, "common-non-bool-filters"]], "Compile-Time": [[8, "compile-time"]], "Components": [[8, "components"]], "Configuration": [[3, null]], "Container": [[8, "container"]], "Contents": [[1, "contents"]], "Context": [[8, "context"]], "Custom function in Go": [[7, "custom-function-in-go"]], "DESCRIPTION": [[2, "description"]], "Define custom global function": [[7, "define-custom-global-function"]], "Description": [[4, "description"]], "Design Principles": [[1, "design-principles"]], "Development Tools": [[4, null]], "Documentation Content:": [[5, null]], "ENVIRONMENT VARIABLES": [[2, "environment-variables"]], "EXAMPLES": [[2, "examples"]], "EXIT STATUS": [[2, "exit-status"]], "Evaluation-Time": [[8, "evaluation-time"]], "Examples": [[4, "examples"]], "Exceptions and Errors": [[7, "exceptions-and-errors"]], "External API": [[7, "external-api"]], "FILES": [[2, "files"]], "Files": [[4, "files"]], "Function Bindings": [[7, "function-bindings"]], "Indices and tables": [[5, "indices-and-tables"]], "Installation": [[6, null]], "Integration Essentials": [[7, "integration-essentials"]], "Integration Overview": [[5, "integration-overview"]], "More Examples from the Go implementation": [[7, "more-examples-from-the-go-implementation"]], "Name Resolution": [[0, "name-resolution"]], "Numeric Details": [[0, "numeric-details"]], "Pure Python Google Common Expression Language (CEL)": [[5, null]], "SYNOPSIS": [[2, "synopsis"]], "Simple example using builtin types": [[7, "simple-example-using-builtin-types"]], "Singleton/Boolean Filters": [[1, "singleton-boolean-filters"]], "Singleton/Non-Bool Filters": [[1, "singleton-non-bool-filters"]], "Summary": [[1, "summary"]], "Synopsis": [[4, "synopsis"]], "The API": [[0, "the-api"]], "The Member-Dot Production": [[8, "the-member-dot-production"]], "The Project Makefile": [[4, "the-project-makefile"]], "The docs/Makefile": [[4, "the-docs-makefile"]], "The features/Makefile": [[4, "the-features-makefile"]], "The features/steps Directory": [[4, "the-features-steps-directory"]], "The gherkinize.py Tool": [[4, "module-gherkinize"]], "The type: value Features": [[0, "the-type-value-features"]], "The type: value_from features": [[0, "the-type-value-from-features"]], "Timzone Details": [[0, "timzone-details"]], "Todo": [[0, "id2"], [0, "id3"], [0, "id4"], [0, "id5"], [0, "id6"], [0, "id7"], [0, "id8"], [0, "id9"], [0, "id10"], [0, "id11"], [0, "id12"], [0, "id13"], [0, "id14"], [0, "id15"], [0, "id16"], [0, "id17"], [0, "id18"], [0, "id19"], [0, "id20"], [0, "id21"], [0, "id22"], [0, "id23"], [0, "id24"], [0, "id25"], [0, "id26"], [0, "id27"], [0, "id28"], [0, "id29"], [0, "id30"], [0, "id31"], [0, "id32"], [0, "id33"], [0, "id34"], [0, "id35"], [0, "id36"], [0, "id37"], [0, "id38"], [0, "id39"], [0, "id40"], [0, "id41"]], "Transpiler Missing Names": [[8, "transpiler-missing-names"]], "Type Adapter": [[0, "type-adapter"]], "Type Provider": [[0, "type-provider"]], "Types": [[0, "types"]], "__main__": [[0, "module-celpy.__main__"]], "access-key": [[1, "access-key"]], "adapter": [[0, "module-celpy.adapter"]], "age": [[1, "age"]], "bucket-encryption (no examples)": [[1, "bucket-encryption-no-examples"]], "bucket-notification (no examples)": [[1, "bucket-notification-no-examples"]], "c7nlib": [[0, "module-celpy.c7nlib"]], "capacity-delta": [[1, "capacity-delta"]], "celparser": [[0, "module-celpy.celparser"]], "celpy": [[0, "module-celpy.__init__"]], "celtypes": [[0, "module-celpy.celtypes"]], "check-cloudtrail": [[1, "check-cloudtrail"]], "check-config": [[1, "check-config"]], "config-compliance (no examples)": [[1, "config-compliance-no-examples"]], "credential": [[1, "credential"]], "cross-account": [[1, "cross-account"]], "data-events (no examples)": [[1, "data-events-no-examples"]], "db-parameter (no examples)": [[1, "db-parameter-no-examples"]], "default-vpc (no examples)": [[1, "default-vpc-no-examples"]], "dhcp-options (no examples)": [[1, "dhcp-options-no-examples"]], "diff (no examples)": [[1, "diff-no-examples"]], "ebs": [[1, "ebs"]], "egress": [[1, "egress"]], "ephemeral (no examples)": [[1, "ephemeral-no-examples"]], "evaluation": [[0, "module-celpy.evaluation"]], "event": [[1, "event"]], "event-source (no examples)": [[1, "event-source-no-examples"]], "fault-tolerant (no examples)": [[1, "fault-tolerant-no-examples"]], "finding (no examples)": [[1, "finding-no-examples"]], "flow-logs": [[1, "flow-logs"]], "global-grants": [[1, "global-grants"]], "grant-count": [[1, "grant-count"]], "group (no examples)": [[1, "group-no-examples"]], "has-allow-all (no examples)": [[1, "has-allow-all-no-examples"]], "has-inline-policy (no examples)": [[1, "has-inline-policy-no-examples"]], "has-specific-managed-policy (no examples)": [[1, "has-specific-managed-policy-no-examples"]], "has-statement": [[1, "has-statement"]], "has-users (no examples)": [[1, "has-users-no-examples"]], "has-virtual-mfa (no examples)": [[1, "has-virtual-mfa-no-examples"]], "health-event": [[1, "health-event"]], "healthcheck-protocol-mismatch (no examples)": [[1, "healthcheck-protocol-mismatch-no-examples"]], "iam-summary (no examples)": [[1, "iam-summary-no-examples"]], "image": [[1, "image"]], "image-age": [[1, "image-age"]], "ingress": [[1, "ingress"]], "instance (no examples)": [[1, "instance-no-examples"]], "instance-age": [[1, "instance-age"]], "instance-attribute (no examples)": [[1, "instance-attribute-no-examples"]], "instance-uptime": [[1, "instance-uptime"]], "invalid": [[1, "invalid"]], "inventory (no examples)": [[1, "inventory-no-examples"]], "is-log-target": [[1, "is-log-target"]], "is-logging": [[1, "is-logging"]], "is-not-logging": [[1, "is-not-logging"]], "is-shadow (no examples)": [[1, "is-shadow-no-examples"]], "is-ssl (no examples)": [[1, "is-ssl-no-examples"]], "key-rotation-status": [[1, "key-rotation-status"]], "kms-alias": [[1, "kms-alias"]], "kms-key": [[1, "kms-key"]], "last-write": [[1, "last-write"]], "latest": [[1, "latest"]], "launch-config": [[1, "launch-config"]], "lifecycle-rule (no examples)": [[1, "lifecycle-rule-no-examples"]], "listener": [[1, "listener"]], "locked (no examples)": [[1, "locked-no-examples"]], "marked-for-op": [[1, "marked-for-op"]], "metrics": [[1, "metrics"]], "mfa-device": [[1, "mfa-device"]], "mismatch-s3-origin": [[1, "mismatch-s3-origin"]], "missing": [[1, "missing"]], "missing-policy-statement": [[1, "missing-policy-statement"]], "missing-route (no examples)": [[1, "missing-route-no-examples"]], "modifyable (no examples)": [[1, "modifyable-no-examples"]], "network-location": [[1, "network-location"]], "no-encryption-statement (no examples)": [[1, "no-encryption-statement-no-examples"]], "no-specific-managed-policy (no examples)": [[1, "no-specific-managed-policy-no-examples"]], "not-encrypted": [[1, "not-encrypted"]], "offhour": [[1, "offhour"]], "onhour": [[1, "onhour"]], "op Implementations": [[1, "op-implementations"]], "param (no examples)": [[1, "param-no-examples"]], "password-policy": [[1, "password-policy"]], "policy": [[1, "policy"]], "progagated-tags (no examples)": [[1, "progagated-tags-no-examples"]], "query-logging-enabled (no examples)": [[1, "query-logging-enabled-no-examples"]], "reserved-concurrency": [[1, "reserved-concurrency"]], "rest-integration (no examples)": [[1, "rest-integration-no-examples"]], "rest-method (no examples)": [[1, "rest-method-no-examples"]], "route (no examples)": [[1, "route-no-examples"]], "s3-cidr (no examples)": [[1, "s3-cidr-no-examples"]], "s3-public-block (no examples)": [[1, "s3-public-block-no-examples"]], "security-group": [[1, "security-group"]], "service-limit": [[1, "service-limit"]], "shield-enabled": [[1, "shield-enabled"]], "shield-metrics (no examples)": [[1, "shield-metrics-no-examples"]], "singleton (no examples)": [[1, "singleton-no-examples"]], "skip-ami-snapshots": [[1, "skip-ami-snapshots"]], "ssl-policy": [[1, "ssl-policy"]], "ssm (no examples)": [[1, "ssm-no-examples"]], "stale (no examples)": [[1, "stale-no-examples"]], "state-age": [[1, "state-age"]], "status (no examples)": [[1, "status-no-examples"]], "subnet": [[1, "subnet"]], "tag-count": [[1, "tag-count"]], "target-group (no examples)": [[1, "target-group-no-examples"]], "task-definition (no examples)": [[1, "task-definition-no-examples"]], "termination-protected (no examples)": [[1, "termination-protected-no-examples"]], "unused": [[1, "unused"]], "upgrade-available (no examples)": [[1, "upgrade-available-no-examples"]], "used": [[1, "used"]], "user-data (no examples)": [[1, "user-data-no-examples"]], "valid": [[1, "valid"]], "value": [[1, "value"]], "value_from External Data": [[1, "value-from-external-data"]], "value_type Conversions": [[1, "value-type-conversions"]], "vpc": [[1, "vpc"]], "vpc-attributes (no examples)": [[1, "vpc-attributes-no-examples"]], "vpc-id": [[1, "vpc-id"]], "waf-enabled": [[1, "waf-enabled"]], "xray-encrypt-key (no examples)": [[1, "xray-encrypt-key-no-examples"]]}, "docnames": ["api", "c7n_functions", "cli", "configuration", "development", "index", "installation", "integration", "structure"], "envversion": {"sphinx": 64, "sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx.ext.todo": 2, "sphinx.ext.viewcode": 1}, "filenames": ["api.rst", "c7n_functions.rst", "cli.rst", "configuration.rst", "development.rst", "index.rst", "installation.rst", "integration.rst", "structure.rst"], "indexentries": {"--arg": [[2, "cmdoption-celpy-a", false]], "--boolean": [[2, "cmdoption-celpy-b", false]], "--format": [[2, "cmdoption-celpy-f", false]], "--interactive": [[2, "cmdoption-celpy-i", false]], "--json-document": [[2, "cmdoption-celpy-d", false]], "--json-package": [[2, "cmdoption-celpy-p", false]], "--null-input": [[2, "cmdoption-celpy-n", false]], "--output": [[4, "cmdoption-python-tools-gherkinize.py-o-output-sv-source-o", false]], "--silent": [[4, "cmdoption-python-tools-gherkinize.py-o-output-sv-source-s", false]], "--slurp": [[2, "cmdoption-celpy-s", false]], "--verbose": [[4, "cmdoption-python-tools-gherkinize.py-o-output-sv-source-v", false]], "-a": [[2, "cmdoption-celpy-a", false]], "-b": [[2, "cmdoption-celpy-b", false]], "-d": [[2, "cmdoption-celpy-d", false]], "-f": [[2, "cmdoption-celpy-f", false]], "-i": [[2, "cmdoption-celpy-i", false]], "-n": [[2, "cmdoption-celpy-n", false]], "-o": [[4, "cmdoption-python-tools-gherkinize.py-o-output-sv-source-o", false]], "-p": [[2, "cmdoption-celpy-p", false]], "-s": [[2, "cmdoption-celpy-s", false], [4, "cmdoption-python-tools-gherkinize.py-o-output-sv-source-s", false]], "-v": [[4, "cmdoption-python-tools-gherkinize.py-o-output-sv-source-v", false]], "__abstractmethods__ (celpy.__init__.compiledrunner attribute)": [[0, "celpy.__init__.CompiledRunner.__abstractmethods__", false]], "__abstractmethods__ (celpy.__init__.interpretedrunner attribute)": [[0, "celpy.__init__.InterpretedRunner.__abstractmethods__", false]], "__abstractmethods__ (celpy.__init__.runner attribute)": [[0, "celpy.__init__.Runner.__abstractmethods__", false]], "__abstractmethods__ (celpy.c7nlib.c7n_interpreted_runner attribute)": [[0, "celpy.c7nlib.C7N_Interpreted_Runner.__abstractmethods__", false]], "__abstractmethods__ (celpy.evaluation.evaluator attribute)": [[0, "celpy.evaluation.Evaluator.__abstractmethods__", false]], "__add__() (celpy.celtypes.durationtype method)": [[0, "celpy.celtypes.DurationType.__add__", false]], "__add__() (celpy.celtypes.inttype method)": [[0, "celpy.celtypes.IntType.__add__", false]], "__add__() (celpy.celtypes.timestamptype method)": [[0, "celpy.celtypes.TimestampType.__add__", false]], "__add__() (celpy.celtypes.uinttype method)": [[0, "celpy.celtypes.UintType.__add__", false]], "__add__() (celpy.evaluation.celevalerror method)": [[0, "celpy.evaluation.CELEvalError.__add__", false]], "__call__() (celpy.celtypes.functiontype method)": [[0, "celpy.celtypes.FunctionType.__call__", false]], "__call__() (celpy.evaluation.celevalerror method)": [[0, "celpy.evaluation.CELEvalError.__call__", false]], "__contains__() (celpy.c7nlib.ipv4network method)": [[0, "celpy.c7nlib.IPv4Network.__contains__", false]], "__enter__() (celpy.c7nlib.c7ncontext method)": [[0, "celpy.c7nlib.C7NContext.__enter__", false]], "__eq__() (celpy.c7nlib.comparableversion method)": [[0, "celpy.c7nlib.ComparableVersion.__eq__", false]], "__eq__() (celpy.celtypes.doubletype method)": [[0, "celpy.celtypes.DoubleType.__eq__", false]], "__eq__() (celpy.celtypes.inttype method)": [[0, "celpy.celtypes.IntType.__eq__", false]], "__eq__() (celpy.celtypes.listtype method)": [[0, "celpy.celtypes.ListType.__eq__", false]], "__eq__() (celpy.celtypes.maptype method)": [[0, "celpy.celtypes.MapType.__eq__", false]], "__eq__() (celpy.celtypes.nulltype method)": [[0, "celpy.celtypes.NullType.__eq__", false]], "__eq__() (celpy.celtypes.stringtype method)": [[0, "celpy.celtypes.StringType.__eq__", false]], "__eq__() (celpy.celtypes.uinttype method)": [[0, "celpy.celtypes.UintType.__eq__", false]], "__eq__() (celpy.evaluation.celevalerror method)": [[0, "celpy.evaluation.CELEvalError.__eq__", false]], "__eq__() (celpy.evaluation.referent method)": [[0, "celpy.evaluation.Referent.__eq__", false]], "__exit__() (celpy.c7nlib.c7ncontext method)": [[0, "celpy.c7nlib.C7NContext.__exit__", false]], "__floordiv__() (celpy.celtypes.inttype method)": [[0, "celpy.celtypes.IntType.__floordiv__", false]], "__floordiv__() (celpy.celtypes.uinttype method)": [[0, "celpy.celtypes.UintType.__floordiv__", false]], "__floordiv__() (celpy.evaluation.celevalerror method)": [[0, "celpy.evaluation.CELEvalError.__floordiv__", false]], "__ge__() (celpy.celtypes.inttype method)": [[0, "celpy.celtypes.IntType.__ge__", false]], "__ge__() (celpy.celtypes.listtype method)": [[0, "celpy.celtypes.ListType.__ge__", false]], "__getattr__() (celpy.evaluation.activation method)": [[0, "celpy.evaluation.Activation.__getattr__", false]], "__getitem__() (celpy.celtypes.maptype method)": [[0, "celpy.celtypes.MapType.__getitem__", false]], "__gt__() (celpy.celtypes.inttype method)": [[0, "celpy.celtypes.IntType.__gt__", false]], "__gt__() (celpy.celtypes.listtype method)": [[0, "celpy.celtypes.ListType.__gt__", false]], "__hash__ (celpy.c7nlib.comparableversion attribute)": [[0, "celpy.c7nlib.ComparableVersion.__hash__", false]], "__hash__ (celpy.celtypes.listtype attribute)": [[0, "celpy.celtypes.ListType.__hash__", false]], "__hash__ (celpy.celtypes.maptype attribute)": [[0, "celpy.celtypes.MapType.__hash__", false]], "__hash__ (celpy.celtypes.nulltype attribute)": [[0, "celpy.celtypes.NullType.__hash__", false]], "__hash__ (celpy.evaluation.celevalerror attribute)": [[0, "celpy.evaluation.CELEvalError.__hash__", false]], "__hash__ (celpy.evaluation.referent attribute)": [[0, "celpy.evaluation.Referent.__hash__", false]], "__hash__() (celpy.celtypes.booltype method)": [[0, "celpy.celtypes.BoolType.__hash__", false]], "__hash__() (celpy.celtypes.doubletype method)": [[0, "celpy.celtypes.DoubleType.__hash__", false]], "__hash__() (celpy.celtypes.inttype method)": [[0, "celpy.celtypes.IntType.__hash__", false]], "__hash__() (celpy.celtypes.stringtype method)": [[0, "celpy.celtypes.StringType.__hash__", false]], "__hash__() (celpy.celtypes.uinttype method)": [[0, "celpy.celtypes.UintType.__hash__", false]], "__init__() (celpy.__init__.compiledrunner method)": [[0, "celpy.__init__.CompiledRunner.__init__", false]], "__init__() (celpy.__init__.environment method)": [[0, "celpy.__init__.Environment.__init__", false]], "__init__() (celpy.__init__.runner method)": [[0, "celpy.__init__.Runner.__init__", false]], "__init__() (celpy.c7nlib.c7ncontext method)": [[0, "celpy.c7nlib.C7NContext.__init__", false]], "__init__() (celpy.celparser.celparseerror method)": [[0, "celpy.celparser.CELParseError.__init__", false]], "__init__() (celpy.celparser.celparser method)": [[0, "celpy.celparser.CELParser.__init__", false]], "__init__() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.__init__", false]], "__init__() (celpy.celtypes.maptype method)": [[0, "celpy.celtypes.MapType.__init__", false]], "__init__() (celpy.celtypes.messagetype method)": [[0, "celpy.celtypes.MessageType.__init__", false]], "__init__() (celpy.evaluation.activation method)": [[0, "celpy.evaluation.Activation.__init__", false]], "__init__() (celpy.evaluation.celevalerror method)": [[0, "celpy.evaluation.CELEvalError.__init__", false]], "__init__() (celpy.evaluation.celsyntaxerror method)": [[0, "celpy.evaluation.CELSyntaxError.__init__", false]], "__init__() (celpy.evaluation.celunsupportederror method)": [[0, "celpy.evaluation.CELUnsupportedError.__init__", false]], "__init__() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.__init__", false]], "__init__() (celpy.evaluation.namecontainer method)": [[0, "celpy.evaluation.NameContainer.__init__", false]], "__init__() (celpy.evaluation.phase1transpiler method)": [[0, "celpy.evaluation.Phase1Transpiler.__init__", false]], "__init__() (celpy.evaluation.phase2transpiler method)": [[0, "celpy.evaluation.Phase2Transpiler.__init__", false]], "__init__() (celpy.evaluation.referent method)": [[0, "celpy.evaluation.Referent.__init__", false]], "__init__() (celpy.evaluation.transpiler method)": [[0, "celpy.evaluation.Transpiler.__init__", false]], "__init__() (celpy.evaluation.transpilertree method)": [[0, "celpy.evaluation.TranspilerTree.__init__", false]], "__init__() (gherkinize.config method)": [[4, "gherkinize.Config.__init__", false]], "__le__() (celpy.celtypes.inttype method)": [[0, "celpy.celtypes.IntType.__le__", false]], "__le__() (celpy.celtypes.listtype method)": [[0, "celpy.celtypes.ListType.__le__", false]], "__lt__() (celpy.celtypes.inttype method)": [[0, "celpy.celtypes.IntType.__lt__", false]], "__lt__() (celpy.celtypes.listtype method)": [[0, "celpy.celtypes.ListType.__lt__", false]], "__mod__() (celpy.celtypes.doubletype method)": [[0, "celpy.celtypes.DoubleType.__mod__", false]], "__mod__() (celpy.celtypes.inttype method)": [[0, "celpy.celtypes.IntType.__mod__", false]], "__mod__() (celpy.celtypes.uinttype method)": [[0, "celpy.celtypes.UintType.__mod__", false]], "__mod__() (celpy.evaluation.celevalerror method)": [[0, "celpy.evaluation.CELEvalError.__mod__", false]], "__mul__() (celpy.celtypes.inttype method)": [[0, "celpy.celtypes.IntType.__mul__", false]], "__mul__() (celpy.celtypes.uinttype method)": [[0, "celpy.celtypes.UintType.__mul__", false]], "__mul__() (celpy.evaluation.celevalerror method)": [[0, "celpy.evaluation.CELEvalError.__mul__", false]], "__ne__() (celpy.celtypes.doubletype method)": [[0, "celpy.celtypes.DoubleType.__ne__", false]], "__ne__() (celpy.celtypes.inttype method)": [[0, "celpy.celtypes.IntType.__ne__", false]], "__ne__() (celpy.celtypes.listtype method)": [[0, "celpy.celtypes.ListType.__ne__", false]], "__ne__() (celpy.celtypes.maptype method)": [[0, "celpy.celtypes.MapType.__ne__", false]], "__ne__() (celpy.celtypes.nulltype method)": [[0, "celpy.celtypes.NullType.__ne__", false]], "__ne__() (celpy.celtypes.stringtype method)": [[0, "celpy.celtypes.StringType.__ne__", false]], "__ne__() (celpy.celtypes.uinttype method)": [[0, "celpy.celtypes.UintType.__ne__", false]], "__neg__() (celpy.celtypes.booltype method)": [[0, "celpy.celtypes.BoolType.__neg__", false]], "__neg__() (celpy.celtypes.doubletype method)": [[0, "celpy.celtypes.DoubleType.__neg__", false]], "__neg__() (celpy.celtypes.inttype method)": [[0, "celpy.celtypes.IntType.__neg__", false]], "__neg__() (celpy.celtypes.uinttype method)": [[0, "celpy.celtypes.UintType.__neg__", false]], "__neg__() (celpy.evaluation.celevalerror method)": [[0, "celpy.evaluation.CELEvalError.__neg__", false]], "__new__() (celpy.__init__.int32value static method)": [[0, "celpy.__init__.Int32Value.__new__", false]], "__new__() (celpy.celtypes.booltype static method)": [[0, "celpy.celtypes.BoolType.__new__", false]], "__new__() (celpy.celtypes.bytestype static method)": [[0, "celpy.celtypes.BytesType.__new__", false]], "__new__() (celpy.celtypes.doubletype static method)": [[0, "celpy.celtypes.DoubleType.__new__", false]], "__new__() (celpy.celtypes.durationtype static method)": [[0, "celpy.celtypes.DurationType.__new__", false]], "__new__() (celpy.celtypes.inttype static method)": [[0, "celpy.celtypes.IntType.__new__", false]], "__new__() (celpy.celtypes.stringtype static method)": [[0, "celpy.celtypes.StringType.__new__", false]], "__new__() (celpy.celtypes.timestamptype static method)": [[0, "celpy.celtypes.TimestampType.__new__", false]], "__new__() (celpy.celtypes.typetype static method)": [[0, "celpy.celtypes.TypeType.__new__", false]], "__new__() (celpy.celtypes.uinttype static method)": [[0, "celpy.celtypes.UintType.__new__", false]], "__orig_bases__ (celpy.celtypes.listtype attribute)": [[0, "celpy.celtypes.ListType.__orig_bases__", false]], "__orig_bases__ (celpy.celtypes.maptype attribute)": [[0, "celpy.celtypes.MapType.__orig_bases__", false]], "__orig_bases__ (celpy.evaluation.namecontainer attribute)": [[0, "celpy.evaluation.NameContainer.__orig_bases__", false]], "__parameters__ (celpy.celparser.dumpast attribute)": [[0, "celpy.celparser.DumpAST.__parameters__", false]], "__parameters__ (celpy.celtypes.listtype attribute)": [[0, "celpy.celtypes.ListType.__parameters__", false]], "__parameters__ (celpy.celtypes.maptype attribute)": [[0, "celpy.celtypes.MapType.__parameters__", false]], "__parameters__ (celpy.celtypes.messagetype attribute)": [[0, "celpy.celtypes.MessageType.__parameters__", false]], "__parameters__ (celpy.celtypes.packagetype attribute)": [[0, "celpy.celtypes.PackageType.__parameters__", false]], "__parameters__ (celpy.evaluation.evaluator attribute)": [[0, "celpy.evaluation.Evaluator.__parameters__", false]], "__parameters__ (celpy.evaluation.namecontainer attribute)": [[0, "celpy.evaluation.NameContainer.__parameters__", false]], "__parameters__ (celpy.evaluation.phase1transpiler attribute)": [[0, "celpy.evaluation.Phase1Transpiler.__parameters__", false]], "__parameters__ (celpy.evaluation.phase2transpiler attribute)": [[0, "celpy.evaluation.Phase2Transpiler.__parameters__", false]], "__parameters__ (celpy.evaluation.transpilertree attribute)": [[0, "celpy.evaluation.TranspilerTree.__parameters__", false]], "__pow__() (celpy.evaluation.celevalerror method)": [[0, "celpy.evaluation.CELEvalError.__pow__", false]], "__radd__() (celpy.celtypes.durationtype method)": [[0, "celpy.celtypes.DurationType.__radd__", false]], "__radd__() (celpy.celtypes.inttype method)": [[0, "celpy.celtypes.IntType.__radd__", false]], "__radd__() (celpy.celtypes.timestamptype method)": [[0, "celpy.celtypes.TimestampType.__radd__", false]], "__radd__() (celpy.celtypes.uinttype method)": [[0, "celpy.celtypes.UintType.__radd__", false]], "__radd__() (celpy.evaluation.celevalerror method)": [[0, "celpy.evaluation.CELEvalError.__radd__", false]], "__repr__() (celpy.__init__.environment method)": [[0, "celpy.__init__.Environment.__repr__", false]], "__repr__() (celpy.__init__.runner method)": [[0, "celpy.__init__.Runner.__repr__", false]], "__repr__() (celpy.c7nlib.c7ncontext method)": [[0, "celpy.c7nlib.C7NContext.__repr__", false]], "__repr__() (celpy.celtypes.booltype method)": [[0, "celpy.celtypes.BoolType.__repr__", false]], "__repr__() (celpy.celtypes.bytestype method)": [[0, "celpy.celtypes.BytesType.__repr__", false]], "__repr__() (celpy.celtypes.doubletype method)": [[0, "celpy.celtypes.DoubleType.__repr__", false]], "__repr__() (celpy.celtypes.durationtype method)": [[0, "celpy.celtypes.DurationType.__repr__", false]], "__repr__() (celpy.celtypes.inttype method)": [[0, "celpy.celtypes.IntType.__repr__", false]], "__repr__() (celpy.celtypes.listtype method)": [[0, "celpy.celtypes.ListType.__repr__", false]], "__repr__() (celpy.celtypes.maptype method)": [[0, "celpy.celtypes.MapType.__repr__", false]], "__repr__() (celpy.celtypes.stringtype method)": [[0, "celpy.celtypes.StringType.__repr__", false]], "__repr__() (celpy.celtypes.timestamptype method)": [[0, "celpy.celtypes.TimestampType.__repr__", false]], "__repr__() (celpy.celtypes.uinttype method)": [[0, "celpy.celtypes.UintType.__repr__", false]], "__repr__() (celpy.evaluation.activation method)": [[0, "celpy.evaluation.Activation.__repr__", false]], "__repr__() (celpy.evaluation.celevalerror method)": [[0, "celpy.evaluation.CELEvalError.__repr__", false]], "__repr__() (celpy.evaluation.namecontainer method)": [[0, "celpy.evaluation.NameContainer.__repr__", false]], "__repr__() (celpy.evaluation.referent method)": [[0, "celpy.evaluation.Referent.__repr__", false]], "__rfloordiv__() (celpy.celtypes.inttype method)": [[0, "celpy.celtypes.IntType.__rfloordiv__", false]], "__rfloordiv__() (celpy.celtypes.uinttype method)": [[0, "celpy.celtypes.UintType.__rfloordiv__", false]], "__rfloordiv__() (celpy.evaluation.celevalerror method)": [[0, "celpy.evaluation.CELEvalError.__rfloordiv__", false]], "__rmod__() (celpy.celtypes.doubletype method)": [[0, "celpy.celtypes.DoubleType.__rmod__", false]], "__rmod__() (celpy.celtypes.inttype method)": [[0, "celpy.celtypes.IntType.__rmod__", false]], "__rmod__() (celpy.celtypes.uinttype method)": [[0, "celpy.celtypes.UintType.__rmod__", false]], "__rmod__() (celpy.evaluation.celevalerror method)": [[0, "celpy.evaluation.CELEvalError.__rmod__", false]], "__rmul__() (celpy.celtypes.inttype method)": [[0, "celpy.celtypes.IntType.__rmul__", false]], "__rmul__() (celpy.celtypes.uinttype method)": [[0, "celpy.celtypes.UintType.__rmul__", false]], "__rmul__() (celpy.evaluation.celevalerror method)": [[0, "celpy.evaluation.CELEvalError.__rmul__", false]], "__rpow__() (celpy.evaluation.celevalerror method)": [[0, "celpy.evaluation.CELEvalError.__rpow__", false]], "__rsub__() (celpy.celtypes.inttype method)": [[0, "celpy.celtypes.IntType.__rsub__", false]], "__rsub__() (celpy.celtypes.uinttype method)": [[0, "celpy.celtypes.UintType.__rsub__", false]], "__rsub__() (celpy.evaluation.celevalerror method)": [[0, "celpy.evaluation.CELEvalError.__rsub__", false]], "__rtruediv__() (celpy.celtypes.doubletype method)": [[0, "celpy.celtypes.DoubleType.__rtruediv__", false]], "__rtruediv__() (celpy.celtypes.inttype method)": [[0, "celpy.celtypes.IntType.__rtruediv__", false]], "__rtruediv__() (celpy.celtypes.uinttype method)": [[0, "celpy.celtypes.UintType.__rtruediv__", false]], "__rtruediv__() (celpy.evaluation.celevalerror method)": [[0, "celpy.evaluation.CELEvalError.__rtruediv__", false]], "__str__() (celpy.celtypes.booltype method)": [[0, "celpy.celtypes.BoolType.__str__", false]], "__str__() (celpy.celtypes.doubletype method)": [[0, "celpy.celtypes.DoubleType.__str__", false]], "__str__() (celpy.celtypes.durationtype method)": [[0, "celpy.celtypes.DurationType.__str__", false]], "__str__() (celpy.celtypes.inttype method)": [[0, "celpy.celtypes.IntType.__str__", false]], "__str__() (celpy.celtypes.timestamptype method)": [[0, "celpy.celtypes.TimestampType.__str__", false]], "__str__() (celpy.celtypes.uinttype method)": [[0, "celpy.celtypes.UintType.__str__", false]], "__sub__() (celpy.celtypes.inttype method)": [[0, "celpy.celtypes.IntType.__sub__", false]], "__sub__() (celpy.celtypes.timestamptype method)": [[0, "celpy.celtypes.TimestampType.__sub__", false]], "__sub__() (celpy.celtypes.uinttype method)": [[0, "celpy.celtypes.UintType.__sub__", false]], "__sub__() (celpy.evaluation.celevalerror method)": [[0, "celpy.evaluation.CELEvalError.__sub__", false]], "__truediv__() (celpy.celtypes.doubletype method)": [[0, "celpy.celtypes.DoubleType.__truediv__", false]], "__truediv__() (celpy.celtypes.inttype method)": [[0, "celpy.celtypes.IntType.__truediv__", false]], "__truediv__() (celpy.celtypes.uinttype method)": [[0, "celpy.celtypes.UintType.__truediv__", false]], "__truediv__() (celpy.evaluation.celevalerror method)": [[0, "celpy.evaluation.CELEvalError.__truediv__", false]], "absent() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.absent", false]], "activation (class in celpy.evaluation)": [[0, "celpy.evaluation.Activation", false]], "addition() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.addition", false]], "addition() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.addition", false]], "addition() (celpy.evaluation.phase1transpiler method)": [[0, "celpy.evaluation.Phase1Transpiler.addition", false]], "addition_add() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.addition_add", false]], "addition_sub() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.addition_sub", false]], "all_dbsubenet_groups() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.all_dbsubenet_groups", false]], "all_images() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.all_images", false]], "all_instance_profiles() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.all_instance_profiles", false]], "all_launch_configuration_names() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.all_launch_configuration_names", false]], "all_scan_groups() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.all_scan_groups", false]], "all_service_roles() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.all_service_roles", false]], "all_snapshots() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.all_snapshots", false]], "ambiguous_literals() (celpy.celparser.celparser static method)": [[0, "celpy.celparser.CELParser.ambiguous_literals", false]], "arg_type_value() (in module celpy.__main__)": [[0, "celpy.__main__.arg_type_value", false]], "arn_split() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.arn_split", false]], "bool_eq() (in module celpy.evaluation)": [[0, "celpy.evaluation.bool_eq", false]], "bool_ge() (in module celpy.evaluation)": [[0, "celpy.evaluation.bool_ge", false]], "bool_gt() (in module celpy.evaluation)": [[0, "celpy.evaluation.bool_gt", false]], "bool_le() (in module celpy.evaluation)": [[0, "celpy.evaluation.bool_le", false]], "bool_lt() (in module celpy.evaluation)": [[0, "celpy.evaluation.bool_lt", false]], "bool_ne() (in module celpy.evaluation)": [[0, "celpy.evaluation.bool_ne", false]], "boolean() (in module celpy.evaluation)": [[0, "celpy.evaluation.boolean", false]], "booltype (class in celpy.celtypes)": [[0, "celpy.celtypes.BoolType", false]], "build_macro_eval() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.build_macro_eval", false]], "build_reduce_macro_eval() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.build_reduce_macro_eval", false]], "build_ss_macro_eval() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.build_ss_macro_eval", false]], "bytestype (class in celpy.celtypes)": [[0, "celpy.celtypes.BytesType", false]], "c7n_interpreted_runner (class in celpy.c7nlib)": [[0, "celpy.c7nlib.C7N_Interpreted_Runner", false]], "c7ncontext (class in celpy.c7nlib)": [[0, "celpy.c7nlib.C7NContext", false]], "cel_eval() (celpy.__main__.cel_repl method)": [[0, "celpy.__main__.CEL_REPL.cel_eval", false]], "cel_parser (celpy.celparser.celparser attribute)": [[0, "celpy.celparser.CELParser.CEL_PARSER", false]], "cel_repl (class in celpy.__main__)": [[0, "celpy.__main__.CEL_REPL", false]], "cel_trace": [[0, "index-0", false], [2, "index-2", false]], "celbytes() (in module celpy.evaluation)": [[0, "celpy.evaluation.celbytes", false]], "celevalerror": [[0, "celpy.evaluation.CELEvalError", false]], "celjsondecoder (class in celpy.adapter)": [[0, "celpy.adapter.CELJSONDecoder", false]], "celjsonencoder (class in celpy.adapter)": [[0, "celpy.adapter.CELJSONEncoder", false]], "celparseerror": [[0, "celpy.celparser.CELParseError", false]], "celparser (class in celpy.celparser)": [[0, "celpy.celparser.CELParser", false]], "celpy command line option": [[2, "cmdoption-celpy-a", false], [2, "cmdoption-celpy-arg-expr", false], [2, "cmdoption-celpy-b", false], [2, "cmdoption-celpy-d", false], [2, "cmdoption-celpy-f", false], [2, "cmdoption-celpy-i", false], [2, "cmdoption-celpy-n", false], [2, "cmdoption-celpy-p", false], [2, "cmdoption-celpy-s", false]], "celpy.__init__": [[0, "module-celpy.__init__", false]], "celpy.__main__": [[0, "module-celpy.__main__", false]], "celpy.adapter": [[0, "module-celpy.adapter", false]], "celpy.c7nlib": [[0, "module-celpy.c7nlib", false]], "celpy.celparser": [[0, "module-celpy.celparser", false]], "celpy.celtypes": [[0, "module-celpy.celtypes", false]], "celpy.evaluation": [[0, "module-celpy.evaluation", false]], "celstr() (in module celpy.evaluation)": [[0, "celpy.evaluation.celstr", false]], "celsyntaxerror": [[0, "celpy.evaluation.CELSyntaxError", false]], "celunsupportederror": [[0, "celpy.evaluation.CELUnsupportedError", false]], "children (celpy.evaluation.transpilertree attribute)": [[0, "celpy.evaluation.TranspilerTree.children", false]], "clone() (celpy.evaluation.activation method)": [[0, "celpy.evaluation.Activation.clone", false]], "clone() (celpy.evaluation.namecontainer method)": [[0, "celpy.evaluation.NameContainer.clone", false]], "clone() (celpy.evaluation.referent method)": [[0, "celpy.evaluation.Referent.clone", false]], "comparableversion (class in celpy.c7nlib)": [[0, "celpy.c7nlib.ComparableVersion", false]], "compile() (celpy.__init__.environment method)": [[0, "celpy.__init__.Environment.compile", false]], "compiledrunner (class in celpy.__init__)": [[0, "celpy.__init__.CompiledRunner", false]], "conditionaland() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.conditionaland", false]], "conditionaland() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.conditionaland", false]], "conditionaland() (celpy.evaluation.phase1transpiler method)": [[0, "celpy.evaluation.Phase1Transpiler.conditionaland", false]], "conditionaland() (celpy.evaluation.phase2transpiler method)": [[0, "celpy.evaluation.Phase2Transpiler.conditionaland", false]], "conditionalor() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.conditionalor", false]], "conditionalor() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.conditionalor", false]], "conditionalor() (celpy.evaluation.phase1transpiler method)": [[0, "celpy.evaluation.Phase1Transpiler.conditionalor", false]], "conditionalor() (celpy.evaluation.phase2transpiler method)": [[0, "celpy.evaluation.Phase2Transpiler.conditionalor", false]], "config (class in gherkinize)": [[4, "gherkinize.Config", false]], "contains() (celpy.c7nlib.ipv4network method)": [[0, "celpy.c7nlib.IPv4Network.contains", false]], "contains() (celpy.celtypes.bytestype method)": [[0, "celpy.celtypes.BytesType.contains", false]], "contains() (celpy.celtypes.listtype method)": [[0, "celpy.celtypes.ListType.contains", false]], "contains() (celpy.celtypes.maptype method)": [[0, "celpy.celtypes.MapType.contains", false]], "contains() (celpy.celtypes.stringtype method)": [[0, "celpy.celtypes.StringType.contains", false]], "credentials() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.credentials", false]], "data (celpy.evaluation.transpilertree attribute)": [[0, "celpy.evaluation.TranspilerTree.data", false]], "decode() (celpy.adapter.celjsondecoder method)": [[0, "celpy.adapter.CELJSONDecoder.decode", false]], "default() (celpy.__main__.cel_repl method)": [[0, "celpy.__main__.CEL_REPL.default", false]], "default() (celpy.adapter.celjsonencoder method)": [[0, "celpy.adapter.CELJSONEncoder.default", false]], "describe_db_snapshot_attributes() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.describe_db_snapshot_attributes", false]], "describe_subscription_filters() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.describe_subscription_filters", false]], "dict_find_name() (celpy.evaluation.namecontainer static method)": [[0, "celpy.evaluation.NameContainer.dict_find_name", false]], "difference() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.difference", false]], "display() (celpy.celparser.dumpast class method)": [[0, "celpy.celparser.DumpAST.display", false]], "do_bye() (celpy.__main__.cel_repl method)": [[0, "celpy.__main__.CEL_REPL.do_bye", false]], "do_eof() (celpy.__main__.cel_repl method)": [[0, "celpy.__main__.CEL_REPL.do_EOF", false]], "do_exit() (celpy.__main__.cel_repl method)": [[0, "celpy.__main__.CEL_REPL.do_exit", false]], "do_quit() (celpy.__main__.cel_repl method)": [[0, "celpy.__main__.CEL_REPL.do_quit", false]], "do_set() (celpy.__main__.cel_repl method)": [[0, "celpy.__main__.CEL_REPL.do_set", false]], "do_show() (celpy.__main__.cel_repl method)": [[0, "celpy.__main__.CEL_REPL.do_show", false]], "dot_ident() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.dot_ident", false]], "dot_ident() (celpy.evaluation.phase1transpiler method)": [[0, "celpy.evaluation.Phase1Transpiler.dot_ident", false]], "dot_ident_arg() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.dot_ident_arg", false]], "dot_ident_arg() (celpy.evaluation.phase1transpiler method)": [[0, "celpy.evaluation.Phase1Transpiler.dot_ident_arg", false]], "doubletype (class in celpy.celtypes)": [[0, "celpy.celtypes.DoubleType", false]], "dumpast (class in celpy.celparser)": [[0, "celpy.celparser.DumpAST", false]], "durationtype (class in celpy.celtypes)": [[0, "celpy.celtypes.DurationType", false]], "encode() (celpy.adapter.celjsonencoder method)": [[0, "celpy.adapter.CELJSONEncoder.encode", false]], "environment (class in celpy.__init__)": [[0, "celpy.__init__.Environment", false]], "environment variable": [[0, "index-0", false], [2, "index-0", false], [2, "index-1", false], [2, "index-2", false]], "error_text() (celpy.celparser.celparser method)": [[0, "celpy.celparser.CELParser.error_text", false]], "eval_error() (in module celpy.evaluation)": [[0, "celpy.evaluation.eval_error", false]], "evaluate() (celpy.__init__.compiledrunner method)": [[0, "celpy.__init__.CompiledRunner.evaluate", false]], "evaluate() (celpy.__init__.interpretedrunner method)": [[0, "celpy.__init__.InterpretedRunner.evaluate", false]], "evaluate() (celpy.__init__.runner method)": [[0, "celpy.__init__.Runner.evaluate", false]], "evaluate() (celpy.c7nlib.c7n_interpreted_runner method)": [[0, "celpy.c7nlib.C7N_Interpreted_Runner.evaluate", false]], "evaluate() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.evaluate", false]], "evaluate() (celpy.evaluation.transpiler method)": [[0, "celpy.evaluation.Transpiler.evaluate", false]], "evaluator (class in celpy.evaluation)": [[0, "celpy.evaluation.Evaluator", false]], "expr": [[2, "cmdoption-celpy-arg-expr", false]], "expr() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.expr", false]], "expr() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.expr", false]], "expr() (celpy.evaluation.phase1transpiler method)": [[0, "celpy.evaluation.Phase1Transpiler.expr", false]], "expr() (celpy.evaluation.phase2transpiler method)": [[0, "celpy.evaluation.Phase2Transpiler.expr", false]], "exprlist() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.exprlist", false]], "exprlist() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.exprlist", false]], "exprlist() (celpy.evaluation.phase1transpiler method)": [[0, "celpy.evaluation.Phase1Transpiler.exprlist", false]], "extended_name_path (celpy.evaluation.namecontainer attribute)": [[0, "celpy.evaluation.NameContainer.extended_name_path", false]], "features.steps.c7n_integration": [[4, "module-features.steps.c7n_integration", false]], "features.steps.cli_binding": [[4, "module-features.steps.cli_binding", false]], "features.steps.integration_binding": [[4, "module-features.steps.integration_binding", false]], "fieldinits() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.fieldinits", false]], "fieldinits() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.fieldinits", false]], "fieldinits() (celpy.evaluation.phase1transpiler method)": [[0, "celpy.evaluation.Phase1Transpiler.fieldinits", false]], "find_name() (celpy.evaluation.namecontainer method)": [[0, "celpy.evaluation.NameContainer.find_name", false]], "flow_logs() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.flow_logs", false]], "func_name() (celpy.evaluation.phase1transpiler method)": [[0, "celpy.evaluation.Phase1Transpiler.func_name", false]], "function_contains() (in module celpy.evaluation)": [[0, "celpy.evaluation.function_contains", false]], "function_endswith() (in module celpy.evaluation)": [[0, "celpy.evaluation.function_endsWith", false]], "function_eval() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.function_eval", false]], "function_getdate() (in module celpy.evaluation)": [[0, "celpy.evaluation.function_getDate", false]], "function_getdayofmonth() (in module celpy.evaluation)": [[0, "celpy.evaluation.function_getDayOfMonth", false]], "function_getdayofweek() (in module celpy.evaluation)": [[0, "celpy.evaluation.function_getDayOfWeek", false]], "function_getdayofyear() (in module celpy.evaluation)": [[0, "celpy.evaluation.function_getDayOfYear", false]], "function_getfullyear() (in module celpy.evaluation)": [[0, "celpy.evaluation.function_getFullYear", false]], "function_gethours() (in module celpy.evaluation)": [[0, "celpy.evaluation.function_getHours", false]], "function_getmilliseconds() (in module celpy.evaluation)": [[0, "celpy.evaluation.function_getMilliseconds", false]], "function_getminutes() (in module celpy.evaluation)": [[0, "celpy.evaluation.function_getMinutes", false]], "function_getmonth() (in module celpy.evaluation)": [[0, "celpy.evaluation.function_getMonth", false]], "function_getseconds() (in module celpy.evaluation)": [[0, "celpy.evaluation.function_getSeconds", false]], "function_matches() (in module celpy.evaluation)": [[0, "celpy.evaluation.function_matches", false]], "function_size() (in module celpy.evaluation)": [[0, "celpy.evaluation.function_size", false]], "function_startswith() (in module celpy.evaluation)": [[0, "celpy.evaluation.function_startsWith", false]], "functiontype (class in celpy.celtypes)": [[0, "celpy.celtypes.FunctionType", false]], "get() (celpy.celtypes.maptype method)": [[0, "celpy.celtypes.MapType.get", false]], "get() (celpy.evaluation.activation method)": [[0, "celpy.evaluation.Activation.get", false]], "get() (celpy.evaluation.namecontainer method)": [[0, "celpy.evaluation.NameContainer.get", false]], "get_access_log() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.get_access_log", false]], "get_accounts() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.get_accounts", false]], "get_endpoints() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.get_endpoints", false]], "get_health_events() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.get_health_events", false]], "get_key_policy() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.get_key_policy", false]], "get_load_balancer() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.get_load_balancer", false]], "get_metrics() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.get_metrics", false]], "get_options() (in module celpy.__main__)": [[0, "celpy.__main__.get_options", false]], "get_orgids() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.get_orgids", false]], "get_protocols() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.get_protocols", false]], "get_raw_health_events() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.get_raw_health_events", false]], "get_raw_metrics() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.get_raw_metrics", false]], "get_related_ids() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.get_related_ids", false]], "get_related_igws() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.get_related_igws", false]], "get_related_kms_keys() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.get_related_kms_keys", false]], "get_related_nat_gateways() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.get_related_nat_gateways", false]], "get_related_security_configs() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.get_related_security_configs", false]], "get_related_sgs() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.get_related_sgs", false]], "get_related_subnets() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.get_related_subnets", false]], "get_related_vpc() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.get_related_vpc", false]], "get_resource_policy() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.get_resource_policy", false]], "get_vpces() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.get_vpces", false]], "get_vpcs() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.get_vpcs", false]], "getdate() (celpy.celtypes.timestamptype method)": [[0, "celpy.celtypes.TimestampType.getDate", false]], "getdayofmonth() (celpy.celtypes.timestamptype method)": [[0, "celpy.celtypes.TimestampType.getDayOfMonth", false]], "getdayofweek() (celpy.celtypes.timestamptype method)": [[0, "celpy.celtypes.TimestampType.getDayOfWeek", false]], "getdayofyear() (celpy.celtypes.timestamptype method)": [[0, "celpy.celtypes.TimestampType.getDayOfYear", false]], "getfullyear() (celpy.celtypes.timestamptype method)": [[0, "celpy.celtypes.TimestampType.getFullYear", false]], "gethours() (celpy.celtypes.durationtype method)": [[0, "celpy.celtypes.DurationType.getHours", false]], "gethours() (celpy.celtypes.timestamptype method)": [[0, "celpy.celtypes.TimestampType.getHours", false]], "getmilliseconds() (celpy.celtypes.durationtype method)": [[0, "celpy.celtypes.DurationType.getMilliseconds", false]], "getmilliseconds() (celpy.celtypes.timestamptype method)": [[0, "celpy.celtypes.TimestampType.getMilliseconds", false]], "getminutes() (celpy.celtypes.durationtype method)": [[0, "celpy.celtypes.DurationType.getMinutes", false]], "getminutes() (celpy.celtypes.timestamptype method)": [[0, "celpy.celtypes.TimestampType.getMinutes", false]], "getmonth() (celpy.celtypes.timestamptype method)": [[0, "celpy.celtypes.TimestampType.getMonth", false]], "getseconds() (celpy.celtypes.durationtype method)": [[0, "celpy.celtypes.DurationType.getSeconds", false]], "getseconds() (celpy.celtypes.timestamptype method)": [[0, "celpy.celtypes.TimestampType.getSeconds", false]], "gherkinize": [[4, "module-gherkinize", false]], "glob() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.glob", false]], "home": [[2, "index-0", false], [2, "index-1", false]], "ident() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.ident", false]], "ident() (celpy.evaluation.phase1transpiler method)": [[0, "celpy.evaluation.Phase1Transpiler.ident", false]], "ident_arg() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.ident_arg", false]], "ident_arg() (celpy.evaluation.phase1transpiler method)": [[0, "celpy.evaluation.Phase1Transpiler.ident_arg", false]], "ident_arg() (celpy.evaluation.phase2transpiler method)": [[0, "celpy.evaluation.Phase2Transpiler.ident_arg", false]], "ident_pat (celpy.evaluation.namecontainer attribute)": [[0, "celpy.evaluation.NameContainer.ident_pat", false]], "ident_value() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.ident_value", false]], "image() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.image", false]], "int32value (class in celpy.__init__)": [[0, "celpy.__init__.Int32Value", false]], "int64() (in module celpy.celtypes)": [[0, "celpy.celtypes.int64", false]], "interpretedrunner (class in celpy.__init__)": [[0, "celpy.__init__.InterpretedRunner", false]], "intersect() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.intersect", false]], "intro (celpy.__main__.cel_repl attribute)": [[0, "celpy.__main__.CEL_REPL.intro", false]], "inttype (class in celpy.celtypes)": [[0, "celpy.celtypes.IntType", false]], "ipv4network (class in celpy.c7nlib)": [[0, "celpy.c7nlib.IPv4Network", false]], "jmes_path() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.jmes_path", false]], "jmes_path_map() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.jmes_path_map", false]], "json_to_cel() (in module celpy.adapter)": [[0, "celpy.adapter.json_to_cel", false]], "key() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.key", false]], "kms_alias() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.kms_alias", false]], "kms_key() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.kms_key", false]], "list_lit() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.list_lit", false]], "list_lit() (celpy.evaluation.phase1transpiler method)": [[0, "celpy.evaluation.Phase1Transpiler.list_lit", false]], "listtype (class in celpy.celtypes)": [[0, "celpy.celtypes.ListType", false]], "literal() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.literal", false]], "literal() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.literal", false]], "literal() (celpy.evaluation.phase1transpiler method)": [[0, "celpy.evaluation.Phase1Transpiler.literal", false]], "load_annotations() (celpy.evaluation.namecontainer method)": [[0, "celpy.evaluation.NameContainer.load_annotations", false]], "load_values() (celpy.evaluation.namecontainer method)": [[0, "celpy.evaluation.NameContainer.load_values", false]], "logger (celpy.__main__.cel_repl attribute)": [[0, "celpy.__main__.CEL_REPL.logger", false]], "logger (celpy.evaluation.evaluator attribute)": [[0, "celpy.evaluation.Evaluator.logger", false]], "logger (celpy.evaluation.namecontainer attribute)": [[0, "celpy.evaluation.NameContainer.logger", false]], "logger (celpy.evaluation.transpiler attribute)": [[0, "celpy.evaluation.Transpiler.logger", false]], "logical_and() (in module celpy.celtypes)": [[0, "celpy.celtypes.logical_and", false]], "logical_condition() (in module celpy.celtypes)": [[0, "celpy.celtypes.logical_condition", false]], "logical_not() (in module celpy.celtypes)": [[0, "celpy.celtypes.logical_not", false]], "logical_or() (in module celpy.celtypes)": [[0, "celpy.celtypes.logical_or", false]], "macro_all() (in module celpy.evaluation)": [[0, "celpy.evaluation.macro_all", false]], "macro_exists() (in module celpy.evaluation)": [[0, "celpy.evaluation.macro_exists", false]], "macro_exists_one() (in module celpy.evaluation)": [[0, "celpy.evaluation.macro_exists_one", false]], "macro_filter() (in module celpy.evaluation)": [[0, "celpy.evaluation.macro_filter", false]], "macro_has_eval() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.macro_has_eval", false]], "macro_map() (in module celpy.evaluation)": [[0, "celpy.evaluation.macro_map", false]], "main() (in module celpy.__main__)": [[0, "celpy.__main__.main", false]], "map_lit() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.map_lit", false]], "map_lit() (celpy.evaluation.phase1transpiler method)": [[0, "celpy.evaluation.Phase1Transpiler.map_lit", false]], "mapinits() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.mapinits", false]], "mapinits() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.mapinits", false]], "mapinits() (celpy.evaluation.phase1transpiler method)": [[0, "celpy.evaluation.Phase1Transpiler.mapinits", false]], "maptype (class in celpy.celtypes)": [[0, "celpy.celtypes.MapType", false]], "marked_key() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.marked_key", false]], "maxseconds (celpy.celtypes.durationtype attribute)": [[0, "celpy.celtypes.DurationType.MaxSeconds", false]], "member() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.member", false]], "member() (celpy.evaluation.phase1transpiler method)": [[0, "celpy.evaluation.Phase1Transpiler.member", false]], "member_dot() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.member_dot", false]], "member_dot() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.member_dot", false]], "member_dot() (celpy.evaluation.phase1transpiler method)": [[0, "celpy.evaluation.Phase1Transpiler.member_dot", false]], "member_dot_arg() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.member_dot_arg", false]], "member_dot_arg() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.member_dot_arg", false]], "member_dot_arg() (celpy.evaluation.phase1transpiler method)": [[0, "celpy.evaluation.Phase1Transpiler.member_dot_arg", false]], "member_dot_arg() (celpy.evaluation.phase2transpiler method)": [[0, "celpy.evaluation.Phase2Transpiler.member_dot_arg", false]], "member_index() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.member_index", false]], "member_index() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.member_index", false]], "member_index() (celpy.evaluation.phase1transpiler method)": [[0, "celpy.evaluation.Phase1Transpiler.member_index", false]], "member_object() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.member_object", false]], "member_object() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.member_object", false]], "member_object() (celpy.evaluation.phase1transpiler method)": [[0, "celpy.evaluation.Phase1Transpiler.member_object", false]], "messagetype (class in celpy.celtypes)": [[0, "celpy.celtypes.MessageType", false]], "method_eval() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.method_eval", false]], "minseconds (celpy.celtypes.durationtype attribute)": [[0, "celpy.celtypes.DurationType.MinSeconds", false]], "module": [[0, "module-celpy.__init__", false], [0, "module-celpy.__main__", false], [0, "module-celpy.adapter", false], [0, "module-celpy.c7nlib", false], [0, "module-celpy.celparser", false], [0, "module-celpy.celtypes", false], [0, "module-celpy.evaluation", false], [4, "module-features.steps.c7n_integration", false], [4, "module-features.steps.cli_binding", false], [4, "module-features.steps.integration_binding", false], [4, "module-gherkinize", false]], "multiplication() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.multiplication", false]], "multiplication() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.multiplication", false]], "multiplication() (celpy.evaluation.phase1transpiler method)": [[0, "celpy.evaluation.Phase1Transpiler.multiplication", false]], "multiplication_div() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.multiplication_div", false]], "multiplication_mod() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.multiplication_mod", false]], "multiplication_mul() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.multiplication_mul", false]], "namecontainer (class in celpy.evaluation)": [[0, "celpy.evaluation.NameContainer", false]], "namecontainer.notfound": [[0, "celpy.evaluation.NameContainer.NotFound", false]], "nanosecondspersecond (celpy.celtypes.durationtype attribute)": [[0, "celpy.celtypes.DurationType.NanosecondsPerSecond", false]], "nested_activation() (celpy.evaluation.activation method)": [[0, "celpy.evaluation.Activation.nested_activation", false]], "new_activation() (celpy.__init__.runner method)": [[0, "celpy.__init__.Runner.new_activation", false]], "normalize() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.normalize", false]], "nulltype (class in celpy.celtypes)": [[0, "celpy.celtypes.NullType", false]], "operator_in() (in module celpy.evaluation)": [[0, "celpy.evaluation.operator_in", false]], "packagetype (class in celpy.celtypes)": [[0, "celpy.celtypes.PackageType", false]], "paren_expr() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.paren_expr", false]], "paren_expr() (celpy.evaluation.phase1transpiler method)": [[0, "celpy.evaluation.Phase1Transpiler.paren_expr", false]], "parent_iter() (celpy.evaluation.namecontainer method)": [[0, "celpy.evaluation.NameContainer.parent_iter", false]], "parse() (celpy.celparser.celparser method)": [[0, "celpy.celparser.CELParser.parse", false]], "parse_cidr() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.parse_cidr", false]], "parse_text() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.parse_text", false]], "phase1transpiler (class in celpy.evaluation)": [[0, "celpy.evaluation.Phase1Transpiler", false]], "phase2transpiler (class in celpy.evaluation)": [[0, "celpy.evaluation.Phase2Transpiler", false]], "preloop() (celpy.__main__.cel_repl method)": [[0, "celpy.__main__.CEL_REPL.preloop", false]], "present() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.present", false]], "primary() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.primary", false]], "primary() (celpy.evaluation.phase1transpiler method)": [[0, "celpy.evaluation.Phase1Transpiler.primary", false]], "process_json_doc() (in module celpy.__main__)": [[0, "celpy.__main__.process_json_doc", false]], "program() (celpy.__init__.environment method)": [[0, "celpy.__init__.Environment.program", false]], "prompt (celpy.__main__.cel_repl attribute)": [[0, "celpy.__main__.CEL_REPL.prompt", false]], "python-tools/gherkinize.py-[-o-output]-[-sv]-source command line option": [[4, "cmdoption-python-tools-gherkinize.py-o-output-sv-source-arg-source", false], [4, "cmdoption-python-tools-gherkinize.py-o-output-sv-source-o", false], [4, "cmdoption-python-tools-gherkinize.py-o-output-sv-source-s", false], [4, "cmdoption-python-tools-gherkinize.py-o-output-sv-source-v", false]], "referent (class in celpy.evaluation)": [[0, "celpy.evaluation.Referent", false]], "relation() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.relation", false]], "relation() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.relation", false]], "relation() (celpy.evaluation.phase1transpiler method)": [[0, "celpy.evaluation.Phase1Transpiler.relation", false]], "relation_eq() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.relation_eq", false]], "relation_ge() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.relation_ge", false]], "relation_gt() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.relation_gt", false]], "relation_in() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.relation_in", false]], "relation_le() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.relation_le", false]], "relation_lt() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.relation_lt", false]], "relation_ne() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.relation_ne", false]], "resolve_function() (celpy.evaluation.activation method)": [[0, "celpy.evaluation.Activation.resolve_function", false]], "resolve_name() (celpy.evaluation.namecontainer method)": [[0, "celpy.evaluation.NameContainer.resolve_name", false]], "resolve_variable() (celpy.evaluation.activation method)": [[0, "celpy.evaluation.Activation.resolve_variable", false]], "resource_schedule() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.resource_schedule", false]], "result() (in module celpy.evaluation)": [[0, "celpy.evaluation.result", false]], "runner (class in celpy.__init__)": [[0, "celpy.__init__.Runner", false]], "scale (celpy.celtypes.durationtype attribute)": [[0, "celpy.celtypes.DurationType.scale", false]], "security_group() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.security_group", false]], "set_activation() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.set_activation", false]], "shield_protection() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.shield_protection", false]], "shield_subscription() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.shield_subscription", false]], "size_parse_cidr() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.size_parse_cidr", false]], "source": [[4, "cmdoption-python-tools-gherkinize.py-o-output-sv-source-arg-source", false]], "stat() (in module celpy.__main__)": [[0, "celpy.__main__.stat", false]], "statements() (celpy.evaluation.phase2transpiler method)": [[0, "celpy.evaluation.Phase2Transpiler.statements", false]], "stringtype (class in celpy.celtypes)": [[0, "celpy.celtypes.StringType", false]], "sub_evaluator() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.sub_evaluator", false]], "subnet() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.subnet", false]], "subst() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.subst", false]], "tags_for() (gherkinize.config method)": [[4, "gherkinize.Config.tags_for", false]], "text_from() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.text_from", false]], "the_activation (in module celpy.evaluation)": [[0, "celpy.evaluation.the_activation", false]], "timestamptype (class in celpy.celtypes)": [[0, "celpy.celtypes.TimestampType", false]], "to_python() (celpy.adapter.celjsonencoder static method)": [[0, "celpy.adapter.CELJSONEncoder.to_python", false]], "trace() (in module celpy.evaluation)": [[0, "celpy.evaluation.trace", false]], "transpile() (celpy.evaluation.transpiler method)": [[0, "celpy.evaluation.Transpiler.transpile", false]], "transpiler (class in celpy.evaluation)": [[0, "celpy.evaluation.Transpiler", false]], "transpilertree (class in celpy.evaluation)": [[0, "celpy.evaluation.TranspilerTree", false]], "tree_dump() (in module celpy.celparser)": [[0, "celpy.celparser.tree_dump", false]], "tree_node_class (celpy.__init__.compiledrunner attribute)": [[0, "celpy.__init__.CompiledRunner.tree_node_class", false]], "tree_node_class (celpy.__init__.runner attribute)": [[0, "celpy.__init__.Runner.tree_node_class", false]], "type_matched() (in module celpy.celtypes)": [[0, "celpy.celtypes.type_matched", false]], "typetype (class in celpy.celtypes)": [[0, "celpy.celtypes.TypeType", false]], "tz_aliases (celpy.celtypes.timestamptype attribute)": [[0, "celpy.celtypes.TimestampType.TZ_ALIASES", false]], "tz_name_lookup() (celpy.celtypes.timestamptype class method)": [[0, "celpy.celtypes.TimestampType.tz_name_lookup", false]], "tz_offset_parse() (celpy.celtypes.timestamptype class method)": [[0, "celpy.celtypes.TimestampType.tz_offset_parse", false]], "tz_parse() (celpy.celtypes.timestamptype static method)": [[0, "celpy.celtypes.TimestampType.tz_parse", false]], "uint64() (in module celpy.celtypes)": [[0, "celpy.celtypes.uint64", false]], "uinttype (class in celpy.celtypes)": [[0, "celpy.celtypes.UintType", false]], "unary() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.unary", false]], "unary() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.unary", false]], "unary() (celpy.evaluation.phase1transpiler method)": [[0, "celpy.evaluation.Phase1Transpiler.unary", false]], "unary_neg() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.unary_neg", false]], "unary_not() (celpy.celparser.dumpast method)": [[0, "celpy.celparser.DumpAST.unary_not", false]], "unique_size() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.unique_size", false]], "valid_key_type() (celpy.celtypes.maptype static method)": [[0, "celpy.celtypes.MapType.valid_key_type", false]], "value (celpy.evaluation.referent property)": [[0, "celpy.evaluation.Referent.value", false]], "value_from() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.value_from", false]], "version() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.version", false]], "visit() (celpy.evaluation.phase1transpiler method)": [[0, "celpy.evaluation.Phase1Transpiler.visit", false]], "visit_children() (celpy.evaluation.evaluator method)": [[0, "celpy.evaluation.Evaluator.visit_children", false]], "vpc() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.vpc", false]], "web_acls() (in module celpy.c7nlib)": [[0, "celpy.c7nlib.web_acls", false]], "with_traceback() (celpy.evaluation.celevalerror method)": [[0, "celpy.evaluation.CELEvalError.with_traceback", false]]}, "objects": {"": [[4, 0, 0, "-", "gherkinize"]], "celpy": [[0, 0, 0, "-", "__init__"], [0, 0, 0, "-", "__main__"], [0, 0, 0, "-", "adapter"], [0, 0, 0, "-", "c7nlib"], [0, 0, 0, "-", "celparser"], [0, 0, 0, "-", "celtypes"], [0, 0, 0, "-", "evaluation"], [2, 8, 1, "cmdoption-celpy-a", "--arg"], [2, 8, 1, "cmdoption-celpy-b", "--boolean"], [2, 8, 1, "cmdoption-celpy-f", "--format"], [2, 8, 1, "cmdoption-celpy-i", "--interactive"], [2, 8, 1, "cmdoption-celpy-d", "--json-document"], [2, 8, 1, "cmdoption-celpy-p", "--json-package"], [2, 8, 1, "cmdoption-celpy-n", "--null-input"], [2, 8, 1, "cmdoption-celpy-s", "--slurp"], [2, 8, 1, "cmdoption-celpy-a", "-a"], [2, 8, 1, "cmdoption-celpy-b", "-b"], [2, 8, 1, "cmdoption-celpy-d", "-d"], [2, 8, 1, "cmdoption-celpy-f", "-f"], [2, 8, 1, "cmdoption-celpy-i", "-i"], [2, 8, 1, "cmdoption-celpy-n", "-n"], [2, 8, 1, "cmdoption-celpy-p", "-p"], [2, 8, 1, "cmdoption-celpy-s", "-s"], [2, 8, 1, "cmdoption-celpy-arg-expr", "expr"]], "celpy.__init__": [[0, 1, 1, "", "CompiledRunner"], [0, 1, 1, "", "Environment"], [0, 1, 1, "", "Int32Value"], [0, 1, 1, "", "InterpretedRunner"], [0, 1, 1, "", "Runner"]], "celpy.__init__.CompiledRunner": [[0, 2, 1, "", "__abstractmethods__"], [0, 3, 1, "", "__init__"], [0, 3, 1, "", "evaluate"], [0, 2, 1, "", "tree_node_class"]], "celpy.__init__.Environment": [[0, 3, 1, "", "__init__"], [0, 3, 1, "", "__repr__"], [0, 3, 1, "", "compile"], [0, 3, 1, "", "program"]], "celpy.__init__.Int32Value": [[0, 3, 1, "", "__new__"]], "celpy.__init__.InterpretedRunner": [[0, 2, 1, "", "__abstractmethods__"], [0, 3, 1, "", "evaluate"]], "celpy.__init__.Runner": [[0, 2, 1, "", "__abstractmethods__"], [0, 3, 1, "", "__init__"], [0, 3, 1, "", "__repr__"], [0, 3, 1, "", "evaluate"], [0, 3, 1, "", "new_activation"], [0, 2, 1, "", "tree_node_class"]], "celpy.__main__": [[0, 1, 1, "", "CEL_REPL"], [0, 4, 1, "", "arg_type_value"], [0, 4, 1, "", "get_options"], [0, 4, 1, "", "main"], [0, 4, 1, "", "process_json_doc"], [0, 4, 1, "", "stat"]], "celpy.__main__.CEL_REPL": [[0, 3, 1, "", "cel_eval"], [0, 3, 1, "", "default"], [0, 3, 1, "", "do_EOF"], [0, 3, 1, "", "do_bye"], [0, 3, 1, "", "do_exit"], [0, 3, 1, "", "do_quit"], [0, 3, 1, "", "do_set"], [0, 3, 1, "", "do_show"], [0, 2, 1, "", "intro"], [0, 2, 1, "", "logger"], [0, 3, 1, "", "preloop"], [0, 2, 1, "", "prompt"]], "celpy.adapter": [[0, 1, 1, "", "CELJSONDecoder"], [0, 1, 1, "", "CELJSONEncoder"], [0, 4, 1, "", "json_to_cel"]], "celpy.adapter.CELJSONDecoder": [[0, 3, 1, "", "decode"]], "celpy.adapter.CELJSONEncoder": [[0, 3, 1, "", "default"], [0, 3, 1, "", "encode"], [0, 3, 1, "", "to_python"]], "celpy.c7nlib": [[0, 1, 1, "", "C7NContext"], [0, 1, 1, "", "C7N_Interpreted_Runner"], [0, 1, 1, "", "ComparableVersion"], [0, 1, 1, "", "IPv4Network"], [0, 4, 1, "", "absent"], [0, 4, 1, "", "all_dbsubenet_groups"], [0, 4, 1, "", "all_images"], [0, 4, 1, "", "all_instance_profiles"], [0, 4, 1, "", "all_launch_configuration_names"], [0, 4, 1, "", "all_scan_groups"], [0, 4, 1, "", "all_service_roles"], [0, 4, 1, "", "all_snapshots"], [0, 4, 1, "", "arn_split"], [0, 4, 1, "", "credentials"], [0, 4, 1, "", "describe_db_snapshot_attributes"], [0, 4, 1, "", "describe_subscription_filters"], [0, 4, 1, "", "difference"], [0, 4, 1, "", "flow_logs"], [0, 4, 1, "", "get_access_log"], [0, 4, 1, "", "get_accounts"], [0, 4, 1, "", "get_endpoints"], [0, 4, 1, "", "get_health_events"], [0, 4, 1, "", "get_key_policy"], [0, 4, 1, "", "get_load_balancer"], [0, 4, 1, "", "get_metrics"], [0, 4, 1, "", "get_orgids"], [0, 4, 1, "", "get_protocols"], [0, 4, 1, "", "get_raw_health_events"], [0, 4, 1, "", "get_raw_metrics"], [0, 4, 1, "", "get_related_ids"], [0, 4, 1, "", "get_related_igws"], [0, 4, 1, "", "get_related_kms_keys"], [0, 4, 1, "", "get_related_nat_gateways"], [0, 4, 1, "", "get_related_security_configs"], [0, 4, 1, "", "get_related_sgs"], [0, 4, 1, "", "get_related_subnets"], [0, 4, 1, "", "get_related_vpc"], [0, 4, 1, "", "get_resource_policy"], [0, 4, 1, "", "get_vpces"], [0, 4, 1, "", "get_vpcs"], [0, 4, 1, "", "glob"], [0, 4, 1, "", "image"], [0, 4, 1, "", "intersect"], [0, 4, 1, "", "jmes_path"], [0, 4, 1, "", "jmes_path_map"], [0, 4, 1, "", "key"], [0, 4, 1, "", "kms_alias"], [0, 4, 1, "", "kms_key"], [0, 4, 1, "", "marked_key"], [0, 4, 1, "", "normalize"], [0, 4, 1, "", "parse_cidr"], [0, 4, 1, "", "parse_text"], [0, 4, 1, "", "present"], [0, 4, 1, "", "resource_schedule"], [0, 4, 1, "", "security_group"], [0, 4, 1, "", "shield_protection"], [0, 4, 1, "", "shield_subscription"], [0, 4, 1, "", "size_parse_cidr"], [0, 4, 1, "", "subnet"], [0, 4, 1, "", "subst"], [0, 4, 1, "", "text_from"], [0, 4, 1, "", "unique_size"], [0, 4, 1, "", "value_from"], [0, 4, 1, "", "version"], [0, 4, 1, "", "vpc"], [0, 4, 1, "", "web_acls"]], "celpy.c7nlib.C7NContext": [[0, 3, 1, "", "__enter__"], [0, 3, 1, "", "__exit__"], [0, 3, 1, "", "__init__"], [0, 3, 1, "", "__repr__"]], "celpy.c7nlib.C7N_Interpreted_Runner": [[0, 2, 1, "", "__abstractmethods__"], [0, 3, 1, "", "evaluate"]], "celpy.c7nlib.ComparableVersion": [[0, 3, 1, "", "__eq__"], [0, 2, 1, "", "__hash__"]], "celpy.c7nlib.IPv4Network": [[0, 3, 1, "", "__contains__"], [0, 3, 1, "", "contains"]], "celpy.celparser": [[0, 5, 1, "", "CELParseError"], [0, 1, 1, "", "CELParser"], [0, 1, 1, "", "DumpAST"], [0, 4, 1, "", "tree_dump"]], "celpy.celparser.CELParseError": [[0, 3, 1, "", "__init__"]], "celpy.celparser.CELParser": [[0, 2, 1, "", "CEL_PARSER"], [0, 3, 1, "", "__init__"], [0, 3, 1, "", "ambiguous_literals"], [0, 3, 1, "", "error_text"], [0, 3, 1, "", "parse"]], "celpy.celparser.DumpAST": [[0, 3, 1, "", "__init__"], [0, 2, 1, "", "__parameters__"], [0, 3, 1, "", "addition"], [0, 3, 1, "", "addition_add"], [0, 3, 1, "", "addition_sub"], [0, 3, 1, "", "conditionaland"], [0, 3, 1, "", "conditionalor"], [0, 3, 1, "", "display"], [0, 3, 1, "", "dot_ident"], [0, 3, 1, "", "dot_ident_arg"], [0, 3, 1, "", "expr"], [0, 3, 1, "", "exprlist"], [0, 3, 1, "", "fieldinits"], [0, 3, 1, "", "ident"], [0, 3, 1, "", "ident_arg"], [0, 3, 1, "", "list_lit"], [0, 3, 1, "", "literal"], [0, 3, 1, "", "map_lit"], [0, 3, 1, "", "mapinits"], [0, 3, 1, "", "member_dot"], [0, 3, 1, "", "member_dot_arg"], [0, 3, 1, "", "member_index"], [0, 3, 1, "", "member_object"], [0, 3, 1, "", "multiplication"], [0, 3, 1, "", "multiplication_div"], [0, 3, 1, "", "multiplication_mod"], [0, 3, 1, "", "multiplication_mul"], [0, 3, 1, "", "paren_expr"], [0, 3, 1, "", "relation"], [0, 3, 1, "", "relation_eq"], [0, 3, 1, "", "relation_ge"], [0, 3, 1, "", "relation_gt"], [0, 3, 1, "", "relation_in"], [0, 3, 1, "", "relation_le"], [0, 3, 1, "", "relation_lt"], [0, 3, 1, "", "relation_ne"], [0, 3, 1, "", "unary"], [0, 3, 1, "", "unary_neg"], [0, 3, 1, "", "unary_not"]], "celpy.celtypes": [[0, 1, 1, "", "BoolType"], [0, 1, 1, "", "BytesType"], [0, 1, 1, "", "DoubleType"], [0, 1, 1, "", "DurationType"], [0, 1, 1, "", "FunctionType"], [0, 1, 1, "", "IntType"], [0, 1, 1, "", "ListType"], [0, 1, 1, "", "MapType"], [0, 1, 1, "", "MessageType"], [0, 1, 1, "", "NullType"], [0, 1, 1, "", "PackageType"], [0, 1, 1, "", "StringType"], [0, 1, 1, "", "TimestampType"], [0, 1, 1, "", "TypeType"], [0, 1, 1, "", "UintType"], [0, 4, 1, "", "int64"], [0, 4, 1, "", "logical_and"], [0, 4, 1, "", "logical_condition"], [0, 4, 1, "", "logical_not"], [0, 4, 1, "", "logical_or"], [0, 4, 1, "", "type_matched"], [0, 4, 1, "", "uint64"]], "celpy.celtypes.BoolType": [[0, 3, 1, "", "__hash__"], [0, 3, 1, "", "__neg__"], [0, 3, 1, "", "__new__"], [0, 3, 1, "", "__repr__"], [0, 3, 1, "", "__str__"]], "celpy.celtypes.BytesType": [[0, 3, 1, "", "__new__"], [0, 3, 1, "", "__repr__"], [0, 3, 1, "", "contains"]], "celpy.celtypes.DoubleType": [[0, 3, 1, "", "__eq__"], [0, 3, 1, "", "__hash__"], [0, 3, 1, "", "__mod__"], [0, 3, 1, "", "__ne__"], [0, 3, 1, "", "__neg__"], [0, 3, 1, "", "__new__"], [0, 3, 1, "", "__repr__"], [0, 3, 1, "", "__rmod__"], [0, 3, 1, "", "__rtruediv__"], [0, 3, 1, "", "__str__"], [0, 3, 1, "", "__truediv__"]], "celpy.celtypes.DurationType": [[0, 2, 1, "", "MaxSeconds"], [0, 2, 1, "", "MinSeconds"], [0, 2, 1, "", "NanosecondsPerSecond"], [0, 3, 1, "", "__add__"], [0, 3, 1, "", "__new__"], [0, 3, 1, "", "__radd__"], [0, 3, 1, "", "__repr__"], [0, 3, 1, "", "__str__"], [0, 3, 1, "", "getHours"], [0, 3, 1, "", "getMilliseconds"], [0, 3, 1, "", "getMinutes"], [0, 3, 1, "", "getSeconds"], [0, 2, 1, "", "scale"]], "celpy.celtypes.FunctionType": [[0, 3, 1, "", "__call__"]], "celpy.celtypes.IntType": [[0, 3, 1, "", "__add__"], [0, 3, 1, "", "__eq__"], [0, 3, 1, "", "__floordiv__"], [0, 3, 1, "", "__ge__"], [0, 3, 1, "", "__gt__"], [0, 3, 1, "", "__hash__"], [0, 3, 1, "", "__le__"], [0, 3, 1, "", "__lt__"], [0, 3, 1, "", "__mod__"], [0, 3, 1, "", "__mul__"], [0, 3, 1, "", "__ne__"], [0, 3, 1, "", "__neg__"], [0, 3, 1, "", "__new__"], [0, 3, 1, "", "__radd__"], [0, 3, 1, "", "__repr__"], [0, 3, 1, "", "__rfloordiv__"], [0, 3, 1, "", "__rmod__"], [0, 3, 1, "", "__rmul__"], [0, 3, 1, "", "__rsub__"], [0, 3, 1, "", "__rtruediv__"], [0, 3, 1, "", "__str__"], [0, 3, 1, "", "__sub__"], [0, 3, 1, "", "__truediv__"]], "celpy.celtypes.ListType": [[0, 3, 1, "", "__eq__"], [0, 3, 1, "", "__ge__"], [0, 3, 1, "", "__gt__"], [0, 2, 1, "", "__hash__"], [0, 3, 1, "", "__le__"], [0, 3, 1, "", "__lt__"], [0, 3, 1, "", "__ne__"], [0, 2, 1, "", "__orig_bases__"], [0, 2, 1, "", "__parameters__"], [0, 3, 1, "", "__repr__"], [0, 3, 1, "", "contains"]], "celpy.celtypes.MapType": [[0, 3, 1, "", "__eq__"], [0, 3, 1, "", "__getitem__"], [0, 2, 1, "", "__hash__"], [0, 3, 1, "", "__init__"], [0, 3, 1, "", "__ne__"], [0, 2, 1, "", "__orig_bases__"], [0, 2, 1, "", "__parameters__"], [0, 3, 1, "", "__repr__"], [0, 3, 1, "", "contains"], [0, 3, 1, "", "get"], [0, 3, 1, "", "valid_key_type"]], "celpy.celtypes.MessageType": [[0, 3, 1, "", "__init__"], [0, 2, 1, "", "__parameters__"]], "celpy.celtypes.NullType": [[0, 3, 1, "", "__eq__"], [0, 2, 1, "", "__hash__"], [0, 3, 1, "", "__ne__"]], "celpy.celtypes.PackageType": [[0, 2, 1, "", "__parameters__"]], "celpy.celtypes.StringType": [[0, 3, 1, "", "__eq__"], [0, 3, 1, "", "__hash__"], [0, 3, 1, "", "__ne__"], [0, 3, 1, "", "__new__"], [0, 3, 1, "", "__repr__"], [0, 3, 1, "", "contains"]], "celpy.celtypes.TimestampType": [[0, 2, 1, "", "TZ_ALIASES"], [0, 3, 1, "", "__add__"], [0, 3, 1, "", "__new__"], [0, 3, 1, "", "__radd__"], [0, 3, 1, "", "__repr__"], [0, 3, 1, "", "__str__"], [0, 3, 1, "", "__sub__"], [0, 3, 1, "", "getDate"], [0, 3, 1, "", "getDayOfMonth"], [0, 3, 1, "", "getDayOfWeek"], [0, 3, 1, "", "getDayOfYear"], [0, 3, 1, "", "getFullYear"], [0, 3, 1, "", "getHours"], [0, 3, 1, "", "getMilliseconds"], [0, 3, 1, "", "getMinutes"], [0, 3, 1, "", "getMonth"], [0, 3, 1, "", "getSeconds"], [0, 3, 1, "", "tz_name_lookup"], [0, 3, 1, "", "tz_offset_parse"], [0, 3, 1, "", "tz_parse"]], "celpy.celtypes.TypeType": [[0, 3, 1, "", "__new__"]], "celpy.celtypes.UintType": [[0, 3, 1, "", "__add__"], [0, 3, 1, "", "__eq__"], [0, 3, 1, "", "__floordiv__"], [0, 3, 1, "", "__hash__"], [0, 3, 1, "", "__mod__"], [0, 3, 1, "", "__mul__"], [0, 3, 1, "", "__ne__"], [0, 3, 1, "", "__neg__"], [0, 3, 1, "", "__new__"], [0, 3, 1, "", "__radd__"], [0, 3, 1, "", "__repr__"], [0, 3, 1, "", "__rfloordiv__"], [0, 3, 1, "", "__rmod__"], [0, 3, 1, "", "__rmul__"], [0, 3, 1, "", "__rsub__"], [0, 3, 1, "", "__rtruediv__"], [0, 3, 1, "", "__str__"], [0, 3, 1, "", "__sub__"], [0, 3, 1, "", "__truediv__"]], "celpy.evaluation": [[0, 1, 1, "", "Activation"], [0, 5, 1, "", "CELEvalError"], [0, 5, 1, "", "CELSyntaxError"], [0, 5, 1, "", "CELUnsupportedError"], [0, 1, 1, "", "Evaluator"], [0, 1, 1, "", "NameContainer"], [0, 1, 1, "", "Phase1Transpiler"], [0, 1, 1, "", "Phase2Transpiler"], [0, 1, 1, "", "Referent"], [0, 1, 1, "", "Transpiler"], [0, 1, 1, "", "TranspilerTree"], [0, 4, 1, "", "bool_eq"], [0, 4, 1, "", "bool_ge"], [0, 4, 1, "", "bool_gt"], [0, 4, 1, "", "bool_le"], [0, 4, 1, "", "bool_lt"], [0, 4, 1, "", "bool_ne"], [0, 4, 1, "", "boolean"], [0, 4, 1, "", "celbytes"], [0, 4, 1, "", "celstr"], [0, 4, 1, "", "eval_error"], [0, 4, 1, "", "function_contains"], [0, 4, 1, "", "function_endsWith"], [0, 4, 1, "", "function_getDate"], [0, 4, 1, "", "function_getDayOfMonth"], [0, 4, 1, "", "function_getDayOfWeek"], [0, 4, 1, "", "function_getDayOfYear"], [0, 4, 1, "", "function_getFullYear"], [0, 4, 1, "", "function_getHours"], [0, 4, 1, "", "function_getMilliseconds"], [0, 4, 1, "", "function_getMinutes"], [0, 4, 1, "", "function_getMonth"], [0, 4, 1, "", "function_getSeconds"], [0, 4, 1, "", "function_matches"], [0, 4, 1, "", "function_size"], [0, 4, 1, "", "function_startsWith"], [0, 4, 1, "", "macro_all"], [0, 4, 1, "", "macro_exists"], [0, 4, 1, "", "macro_exists_one"], [0, 4, 1, "", "macro_filter"], [0, 4, 1, "", "macro_map"], [0, 4, 1, "", "operator_in"], [0, 4, 1, "", "result"], [0, 7, 1, "", "the_activation"], [0, 4, 1, "", "trace"]], "celpy.evaluation.Activation": [[0, 3, 1, "", "__getattr__"], [0, 3, 1, "", "__init__"], [0, 3, 1, "", "__repr__"], [0, 3, 1, "", "clone"], [0, 3, 1, "", "get"], [0, 3, 1, "", "nested_activation"], [0, 3, 1, "", "resolve_function"], [0, 3, 1, "", "resolve_variable"]], "celpy.evaluation.CELEvalError": [[0, 3, 1, "", "__add__"], [0, 3, 1, "", "__call__"], [0, 3, 1, "", "__eq__"], [0, 3, 1, "", "__floordiv__"], [0, 2, 1, "", "__hash__"], [0, 3, 1, "", "__init__"], [0, 3, 1, "", "__mod__"], [0, 3, 1, "", "__mul__"], [0, 3, 1, "", "__neg__"], [0, 3, 1, "", "__pow__"], [0, 3, 1, "", "__radd__"], [0, 3, 1, "", "__repr__"], [0, 3, 1, "", "__rfloordiv__"], [0, 3, 1, "", "__rmod__"], [0, 3, 1, "", "__rmul__"], [0, 3, 1, "", "__rpow__"], [0, 3, 1, "", "__rsub__"], [0, 3, 1, "", "__rtruediv__"], [0, 3, 1, "", "__sub__"], [0, 3, 1, "", "__truediv__"], [0, 3, 1, "", "with_traceback"]], "celpy.evaluation.CELSyntaxError": [[0, 3, 1, "", "__init__"]], "celpy.evaluation.CELUnsupportedError": [[0, 3, 1, "", "__init__"]], "celpy.evaluation.Evaluator": [[0, 2, 1, "", "__abstractmethods__"], [0, 3, 1, "", "__init__"], [0, 2, 1, "", "__parameters__"], [0, 3, 1, "", "addition"], [0, 3, 1, "", "build_macro_eval"], [0, 3, 1, "", "build_reduce_macro_eval"], [0, 3, 1, "", "build_ss_macro_eval"], [0, 3, 1, "", "conditionaland"], [0, 3, 1, "", "conditionalor"], [0, 3, 1, "", "evaluate"], [0, 3, 1, "", "expr"], [0, 3, 1, "", "exprlist"], [0, 3, 1, "", "fieldinits"], [0, 3, 1, "", "function_eval"], [0, 3, 1, "", "ident_value"], [0, 3, 1, "", "literal"], [0, 2, 1, "", "logger"], [0, 3, 1, "", "macro_has_eval"], [0, 3, 1, "", "mapinits"], [0, 3, 1, "", "member"], [0, 3, 1, "", "member_dot"], [0, 3, 1, "", "member_dot_arg"], [0, 3, 1, "", "member_index"], [0, 3, 1, "", "member_object"], [0, 3, 1, "", "method_eval"], [0, 3, 1, "", "multiplication"], [0, 3, 1, "", "primary"], [0, 3, 1, "", "relation"], [0, 3, 1, "", "set_activation"], [0, 3, 1, "", "sub_evaluator"], [0, 3, 1, "", "unary"], [0, 3, 1, "", "visit_children"]], "celpy.evaluation.NameContainer": [[0, 5, 1, "", "NotFound"], [0, 3, 1, "", "__init__"], [0, 2, 1, "", "__orig_bases__"], [0, 2, 1, "", "__parameters__"], [0, 3, 1, "", "__repr__"], [0, 3, 1, "", "clone"], [0, 3, 1, "", "dict_find_name"], [0, 2, 1, "", "extended_name_path"], [0, 3, 1, "", "find_name"], [0, 3, 1, "", "get"], [0, 2, 1, "", "ident_pat"], [0, 3, 1, "", "load_annotations"], [0, 3, 1, "", "load_values"], [0, 2, 1, "", "logger"], [0, 3, 1, "", "parent_iter"], [0, 3, 1, "", "resolve_name"]], "celpy.evaluation.Phase1Transpiler": [[0, 3, 1, "", "__init__"], [0, 2, 1, "", "__parameters__"], [0, 3, 1, "", "addition"], [0, 3, 1, "", "conditionaland"], [0, 3, 1, "", "conditionalor"], [0, 3, 1, "", "dot_ident"], [0, 3, 1, "", "dot_ident_arg"], [0, 3, 1, "", "expr"], [0, 3, 1, "", "exprlist"], [0, 3, 1, "", "fieldinits"], [0, 3, 1, "", "func_name"], [0, 3, 1, "", "ident"], [0, 3, 1, "", "ident_arg"], [0, 3, 1, "", "list_lit"], [0, 3, 1, "", "literal"], [0, 3, 1, "", "map_lit"], [0, 3, 1, "", "mapinits"], [0, 3, 1, "", "member"], [0, 3, 1, "", "member_dot"], [0, 3, 1, "", "member_dot_arg"], [0, 3, 1, "", "member_index"], [0, 3, 1, "", "member_object"], [0, 3, 1, "", "multiplication"], [0, 3, 1, "", "paren_expr"], [0, 3, 1, "", "primary"], [0, 3, 1, "", "relation"], [0, 3, 1, "", "unary"], [0, 3, 1, "", "visit"]], "celpy.evaluation.Phase2Transpiler": [[0, 3, 1, "", "__init__"], [0, 2, 1, "", "__parameters__"], [0, 3, 1, "", "conditionaland"], [0, 3, 1, "", "conditionalor"], [0, 3, 1, "", "expr"], [0, 3, 1, "", "ident_arg"], [0, 3, 1, "", "member_dot_arg"], [0, 3, 1, "", "statements"]], "celpy.evaluation.Referent": [[0, 3, 1, "", "__eq__"], [0, 2, 1, "", "__hash__"], [0, 3, 1, "", "__init__"], [0, 3, 1, "", "__repr__"], [0, 3, 1, "", "clone"], [0, 6, 1, "", "value"]], "celpy.evaluation.Transpiler": [[0, 3, 1, "", "__init__"], [0, 3, 1, "", "evaluate"], [0, 2, 1, "", "logger"], [0, 3, 1, "", "transpile"]], "celpy.evaluation.TranspilerTree": [[0, 3, 1, "", "__init__"], [0, 2, 1, "", "__parameters__"], [0, 2, 1, "", "children"], [0, 2, 1, "", "data"]], "features.steps": [[4, 0, 0, "-", "c7n_integration"], [4, 0, 0, "-", "cli_binding"], [4, 0, 0, "-", "integration_binding"]], "gherkinize": [[4, 1, 1, "", "Config"]], "gherkinize.Config": [[4, 3, 1, "", "__init__"], [4, 3, 1, "", "tags_for"]], "python-tools/gherkinize.py-[-o-output]-[-sv]-source": [[4, 8, 1, "cmdoption-python-tools-gherkinize.py-o-output-sv-source-o", "--output"], [4, 8, 1, "cmdoption-python-tools-gherkinize.py-o-output-sv-source-s", "--silent"], [4, 8, 1, "cmdoption-python-tools-gherkinize.py-o-output-sv-source-v", "--verbose"], [4, 8, 1, "cmdoption-python-tools-gherkinize.py-o-output-sv-source-o", "-o"], [4, 8, 1, "cmdoption-python-tools-gherkinize.py-o-output-sv-source-s", "-s"], [4, 8, 1, "cmdoption-python-tools-gherkinize.py-o-output-sv-source-v", "-v"], [4, 8, 1, "cmdoption-python-tools-gherkinize.py-o-output-sv-source-arg-source", "source"]]}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "class", "Python class"], "2": ["py", "attribute", "Python attribute"], "3": ["py", "method", "Python method"], "4": ["py", "function", "Python function"], "5": ["py", "exception", "Python exception"], "6": ["py", "property", "Python property"], "7": ["py", "data", "Python data"], "8": ["std", "cmdoption", "program option"]}, "objtypes": {"0": "py:module", "1": "py:class", "2": "py:attribute", "3": "py:method", "4": "py:function", "5": "py:exception", "6": "py:property", "7": "py:data", "8": "std:cmdoption"}, "terms": {"": [0, 1, 2, 3, 4, 7, 8], "0": [0, 1, 2, 4, 7], "00": 7, "001": 0, "002": 1, "01": 1, "011": 1, "01ab23cd": 1, "02": [0, 1], "03": 1, "03t16": 7, "03z": [2, 7], "04": [1, 7], "05": 1, "06": 0, "06t05": 7, "06t20": 2, "07": [1, 2, 7], "08": [1, 7], "084": 1, "09": 0, "0u": 4, "1": [0, 1, 2, 3, 4, 7], "10": [0, 1], "100": [1, 2], "1000": 1, "10000": 1, "1000000000": 0, "1004": 1, "101": 1, "1021": 1, "1023": 1, "10240": 1, "1026": 1, "103": 1, "1034": 1, "104": 1, "1041": 1, "1045": 1, "105": 1, "1057": 1, "106": 1, "1066": 1, "108": 1, "1080": 1, "10am": 1, "11": [1, 2], "111": 1, "1124": 1, "113": 2, "1144": 1, "115": 1, "116": 1, "117": 1, "1178": 1, "1180": 1, "1191": 1, "12": [1, 4], "121": 1, "1211": 1, "122": 1, "123": [0, 1, 7], "1232": 1, "1234567890": 0, "123u": 0, "125": 1, "127": [0, 1], "128": 1, "1295": 1, "12ab34cd": 1, "13": [2, 6], "131": 1, "132": 1, "1333": 1, "134": 1, "135": 2, "136": 1, "138": 0, "13t23": 0, "14": [0, 1], "140": 7, "1410": 1, "1415929203539825": 2, "1437": 1, "145": 1, "147": 1, "1474": 1, "149": 0, "1493": 1, "15": [1, 7], "1505": 1, "1513": 1, "154": 1, "1584": 1, "16": 1, "161": 1, "1613": 1, "162": 1, "167": 1, "16777234": 2, "1686": 1, "17": 1, "1704": 1, "171": 1, "1728": 1, "173": 1, "1779": 1, "178": 1, "1787": 1, "179": 1, "1793": 1, "1799": 1, "18": [0, 1], "182": 1, "183": 1, "184": 1, "18446744073709551615": 0, "185": 1, "189": 1, "19": 1, "190": 1, "194": 1, "1954": 1, "196": 1, "197": 1, "198": 1, "1e": 0, "1st": 1, "1u": 0, "2": [0, 1, 2], "20": 1, "2006": 2, "2009": 0, "2012": 1, "2016": 1, "2017": 1, "2018": 7, "2019": 1, "2020": 1, "2021": 1, "2025": 2, "203": 1, "2048": 1, "205": 1, "206": 1, "20z": 2, "21": [0, 1, 7], "212": 1, "21d": 1, "21z": 2, "22": 1, "223": 1, "2242": 1, "228": 1, "2292": 1, "23": [1, 7], "232": 1, "237": 1, "238": 1, "24": 1, "24h": 7, "24x5": 1, "25": 1, "250": 1, "2500000": 1, "256": 0, "257": 1, "26": 1, "262": 1, "268": 1, "27": [1, 2, 7], "273": 1, "277": [0, 1], "2788": 1, "27t18": 2, "28": 1, "285": 0, "29": 1, "293": 1, "299": 1, "2h45m": 0, "3": [0, 1, 2, 4, 6, 7], "30": [0, 1, 2], "300m": 0, "301": 1, "305": 1, "30z": 0, "31": [0, 2], "313": 1, "314": 1, "315576000000": 0, "317": 1, "318": 1, "32": 1, "325": 1, "329": 1, "34": 1, "341": 1, "341035": 2, "345": 1, "348": 1, "35": 1, "355": [0, 2], "35dai": 1, "36": 1, "3600": 0, "364": 1, "37": 1, "372": 1, "373": 1, "390": 1, "3a": 1, "4": [0, 1], "40": [1, 7], "400": 1, "402": 1, "408": 1, "409": 1, "4096": 2, "41": [1, 2], "412": 1, "413": 1, "42": [0, 1, 2, 8], "424": 1, "429": 1, "42u": 0, "43": 1, "431": 1, "4320": 2, "432u": 0, "436": 1, "438": 1, "443": 1, "448": 1, "45": 1, "453": 1, "455": 1, "456": 0, "47": [1, 7], "48": 1, "485": 1, "490": 1, "493": 1, "4d": 0, "5": [0, 1], "50": 1, "500": 7, "5000": 1, "505": 1, "5103": 1, "512": 1, "5120": 1, "514": 1, "516": 1, "52": 1, "54": 1, "548": 1, "549": 1, "55": 1, "556": 1, "562": 1, "563": 1, "567": 1, "569": 1, "57": 1, "575": 1, "5759": 7, "58": 1, "592": 1, "597": 1, "5h": 0, "6": [0, 1, 2], "60": [0, 1], "600": 7, "604": 1, "608": 1, "610": 1, "612000": 1, "615": 1, "619": 1, "622": 1, "628": 1, "63": 0, "64": [1, 7, 8], "643": 1, "644": 1, "65": 1, "656": 1, "659": 1, "66": 1, "662": 1, "666": 1, "667": 1, "676": 1, "69": 1, "692": 1, "6am": 1, "6f": 2, "6hr": 1, "6pm": 1, "7": [0, 1, 2], "70": 0, "711": 1, "720": 1, "729": 1, "739": 1, "74": 1, "744": 1, "748": 1, "758": 1, "767": 1, "78": 1, "786": 1, "791": 1, "7am": 1, "7pm": 1, "8": [1, 7], "80": 1, "806": 1, "8098": 1, "81": 1, "812": 1, "826": 1, "829": 1, "830985915492956": 2, "842": 1, "845": 1, "86": 1, "86400": [0, 1], "87": 1, "88": 1, "8x5": 1, "9": [0, 1], "90": 1, "92": 1, "9223372036854775807": 0, "9223372036854775808": 0, "93": 1, "932": 1, "934": 1, "94": 1, "97": 1, "98": 1, "987": 1, "988": 1, "99": 1, "9pm": 1, "A": [0, 1, 2, 4, 7, 8], "AND": 0, "And": [0, 2], "As": [0, 2, 7, 8], "At": [0, 8], "But": 0, "By": [0, 2], "For": [0, 1, 2, 4, 6, 7, 8], "If": [0, 1, 2, 3, 7, 8], "In": [0, 1, 2, 3, 4, 6, 7, 8], "It": [0, 1, 2, 7, 8], "NOT": [0, 1], "No": [0, 1, 4, 7, 8], "Not": [0, 1], "Of": 1, "On": [1, 7], "One": [0, 1], "Or": 0, "Such": 8, "THe": 2, "That": 0, "The": [1, 2, 3, 5, 6, 7], "Then": [0, 1, 4], "There": [0, 1, 2, 5, 7, 8], "These": [0, 1, 7, 8], "To": [0, 3, 7], "With": [0, 1], "_": [0, 7], "__abstractmethods__": 0, "__add__": 0, "__call__": [0, 7], "__contains__": 0, "__enter__": 0, "__eq__": 0, "__exit__": 0, "__floordiv__": 0, "__ge__": 0, "__getattr__": 0, "__getitem__": 0, "__gt__": 0, "__hash__": 0, "__init__": [0, 1, 4, 7, 8], "__isinstance__": 0, "__le__": 0, "__lt__": 0, "__main__": [5, 8], "__mod__": 0, "__mul__": 0, "__ne__": 0, "__neg__": 0, "__new__": 0, "__orig_bases__": 0, "__parameters__": 0, "__pow__": 0, "__radd__": 0, "__repr__": 0, "__rfloordiv__": 0, "__rmod__": 0, "__rmul__": 0, "__rpow__": 0, "__rsub__": 0, "__rtruediv__": 0, "__str__": 0, "__sub__": 0, "__traceback__": 0, "__truediv__": 0, "_a": 0, "_oper": 0, "_pull_ami_snapshot": [0, 1], "_pull_asg_imag": [0, 1], "_pull_asg_snapshot": [0, 1], "_pull_ec2_imag": [0, 1], "_w": 0, "a4": 4, "ab": 0, "abandond": 1, "abc": [0, 1], "abil": 2, "abl": [0, 1], "about": [1, 5, 7], "abov": [0, 1, 7], "absenc": 1, "absent": [0, 1], "absolut": 0, "abstract": [0, 7], "accept": [0, 1], "access": 0, "access_kei": 1, "accesskeysperuserquota": 1, "accesslog": 1, "account": [0, 7], "account_id": [0, 1], "account_shield_subscript": [0, 1], "accountaccesskeyspres": 1, "accountcredentialreport": 1, "accountmfaen": 1, "accountnumb": 1, "accountpasswordpolici": 1, "accounts_url": 1, "accountsigningcertificatespres": 1, "achiev": 2, "acl": 1, "aclawss3cidr": 1, "aclsubnetfilt": 1, "acm": [1, 7], "acquir": 1, "across": [1, 5], "act": 1, "action": [0, 1, 7], "action_d": [0, 1], "activ": [0, 1, 2, 7, 8], "actual": [0, 7], "ad": [0, 1, 4], "adapt": [5, 7, 8], "add": [0, 1, 3, 6, 8], "addit": [1, 4, 7, 8], "addition": [0, 1, 2, 7, 8], "addition_add": 0, "addition_sub": 0, "additionalproperti": 1, "addr": 1, "address": [0, 1], "adher": 1, "admin": 1, "administratoraccess": 1, "advanc": 1, "advantag": 2, "advisor": 1, "aes128": 1, "aes256": 1, "after": [0, 1], "ag": 7, "again": [0, 7], "against": [0, 1], "agefilt": 1, "agre": 0, "ahom": 2, "akward": 0, "alarm": 1, "alb": 1, "alblog": 1, "alert": 1, "alia": [0, 4], "alias": [0, 1], "aliasnam": 1, "all": [0, 2, 3, 4, 7, 8], "all_dbsubenet_group": [0, 1], "all_imag": [0, 1], "all_instance_profil": [0, 1], "all_launch_configuration_nam": [0, 1], "all_scan_group": [0, 1], "all_service_rol": [0, 1], "all_snapshot": [0, 1], "all_valu": 1, "alloc": 1, "allocatedstorag": 1, "allow": [0, 2, 7, 8], "allow_nan": 0, "allow_websit": 1, "allowalliampolici": 1, "almost": 0, "alon": [1, 8], "along": [0, 1], "alreadi": 0, "also": [0, 1, 2, 7, 8], "altern": [0, 1], "alwai": [0, 1, 8], "amazon": 1, "amazonaw": 1, "amazons3": 1, "ambigu": 0, "ambiguous_liter": 0, "america": 1, "ami": 0, "amicrossaccountfilt": 1, "among": [0, 1], "amort": 8, "an": [0, 1, 2, 4, 5, 7, 8], "analysi": 1, "analyt": 1, "analyz": 0, "ancient": 1, "ani": [0, 1, 2, 3, 4, 7, 8], "annot": [0, 1, 7, 8], "anoth": [0, 1, 2, 5, 7, 8], "anyof": 1, "ap": 1, "api": [1, 5, 8], "apigw": 1, "apikeyrequir": 1, "app": [1, 8], "appear": [0, 1], "appelb": [0, 1], "appelbdefaultvpcfilt": 1, "appelbhealthcheckprotocolmismatchfilt": 1, "appelblistenerfilt": 1, "appelbmetr": 1, "appelbtargetgroup": 1, "appelbtargetgroupdefaultvpcfilt": 1, "appelbtargetgroupfilt": 1, "append": 0, "appid": 1, "appli": [0, 1, 7], "applic": [0, 1, 2, 3, 5, 8], "applicationnam": 1, "approach": [7, 8], "appropri": [0, 7], "approxim": 0, "ar": [0, 1, 2, 4, 5, 7, 8], "arbitrari": 0, "architectur": [5, 6], "aren": [0, 1, 7], "arg": [0, 2, 7], "arg_name_arg": 7, "arg_type_valu": 0, "argument": [0, 7], "argv": 0, "arithmet": 2, "arithmetic_oper": 0, "arm64": 6, "arn": [0, 1], "arn_split": [0, 1], "around": [0, 1], "arrai": [0, 1, 4], "arriv": [1, 7], "ascii_cas": 4, "asg": [0, 1], "asid": 0, "assert": [0, 1, 7], "assign": [0, 1], "assoc": 1, "associ": [0, 1, 2, 7], "associatepublicipaddress": 1, "assum": [0, 1, 8], "assumerolepolicysizequota": 1, "assumpt": 1, "assur": [0, 4], "ast": [0, 2, 7, 8], "ast2": 0, "asv": 1, "asvredact": 1, "atm": 1, "atom": [0, 7], "atot": 2, "attach": [0, 1], "attachedinstancefilt": 1, "attachedpoliciespergroupquota": 1, "attachedpoliciesperrolequota": 1, "attachedpoliciesperuserquota": 1, "attachedvolum": 1, "attachmentcount": 1, "attack": 1, "attempt": [0, 1], "attr": 1, "attribit": 1, "attribut": [0, 2, 7], "attributesfilt": 1, "atyp": 7, "audit": 1, "augment": 1, "aurora": 1, "auth": 7, "author": 7, "auto": 1, "automat": 1, "autosc": 1, "autoscal": 1, "avail": [0, 2, 4], "aval": 1, "averag": [0, 1], "avoid": [0, 1, 2], "aw": [0, 1], "awar": 2, "aws_ebs_degraded_ebs_volume_perform": 1, "aws_ebs_volume_lost": 1, "awsec2": 1, "awslambda": 1, "ax": 2, "az1": 1, "azr": 1, "azur": 1, "b": [0, 2, 7], "ba": 1, "back": [0, 1], "backoff": 1, "backup": 1, "bad1": 7, "bad2": 7, "balanc": [1, 7], "base": [0, 1, 2, 5, 7, 8], "base_activ": 0, "base_funct": 0, "based_on": 0, "baseexcept": 0, "baselin": 1, "bash": 2, "basi": 1, "basic": [1, 4], "batch": 1, "baz": 0, "bc": 2, "beast": 0, "becaus": [0, 1, 2, 5, 7, 8], "becom": [0, 1, 2, 4, 8], "been": [0, 1, 8], "befor": [1, 2], "begin": 4, "behav": [0, 7], "behavior": [0, 1, 2], "being": [0, 1], "below": 0, "benchmark": [0, 4], "best": [0, 4], "better": [0, 1, 7], "between": [0, 1, 2, 7, 8], "binari": [0, 7], "bind": [0, 2, 4, 5, 8], "bind_nest": 4, "bind_vari": 0, "bindings_ext": 4, "bit": [1, 2, 5, 8], "blacklist": 1, "blob": [0, 1, 4, 7], "block": [0, 2], "block_ext": 4, "blockdevicemap": 1, "bn": 2, "bool": [0, 5, 7, 8], "bool_eq": 0, "bool_g": 0, "bool_gt": 0, "bool_l": 0, "bool_lit": 0, "bool_lt": 0, "bool_n": 0, "bool_valu": 0, "boolean": [0, 2, 5, 7], "boolean_liter": 4, "boolean_to_statu": 0, "booleangroupfilt": 7, "booltyp": [0, 7, 8], "boolvalu": 0, "both": [0, 1], "boto3": 1, "bottl": 0, "bottom": [0, 8], "bound": [0, 2, 7], "bracket": 1, "break": 0, "breakdown": 7, "bring": 1, "broken": 1, "broker": 1, "bucket": 0, "bucketencrypt": 1, "bucketnotificationfilt": 1, "buffer": 0, "build": [0, 1, 4, 7, 8], "build_macro_ev": 0, "build_reduce_macro_ev": 0, "build_ss_macro_ev": 0, "buildsecuritygroupfilt": 1, "buildsubnetfilt": 1, "buildvpcfilt": 1, "built": [0, 1, 2, 4, 7, 8], "bulki": 1, "bunch": 1, "burden": 2, "bye": 2, "byol": 1, "byt": 0, "byte": [0, 8], "bytes_lit": 0, "bytes_valu": 0, "bytestyp": [0, 8], "bytesvalu": 0, "c": [0, 2, 7], "c4": 8, "c7n": [5, 8], "c7n_interfac": 4, "c7n_interpreted_runn": [0, 1], "c7n_s3_policy_requir": 1, "c7ncontext": [0, 1], "c7nlib": [1, 3, 5, 7, 8], "cach": [0, 5, 8], "calcul": 2, "call": [0, 1], "callabl": [0, 8], "can": [0, 1, 2, 3, 4, 5, 6, 7, 8], "cannot": [0, 1], "capabl": [0, 1, 2], "capacitydelta": 1, "capitalon": 1, "capon": 1, "captur": 0, "cardda_tagcompli": 1, "cardin": 1, "case": [0, 1, 2, 4, 6, 7, 8], "catalog": 4, "categori": [1, 7], "caught": 0, "caus": 0, "causesresourc": 1, "cbhfqv": 1, "cbr": 1, "cde": 1, "ce": 7, "cel": [0, 1, 4, 6, 7], "cel_activ": [0, 1], "cel_ast": [0, 1], "cel_env": [0, 1], "cel_ev": 0, "cel_expr": 0, "cel_funct": 7, "cel_gen": 0, "cel_object": 0, "cel_pars": 0, "cel_prgm": 0, "cel_program": 7, "cel_repl": 0, "cel_sourc": 7, "cel_test": 7, "cel_trac": [0, 2, 3], "celbyt": 0, "celevalerror": [0, 7, 8], "celfilt": [0, 5, 7], "celfilter_inst": 0, "celfunct": [0, 8], "celjsondecod": 0, "celjsonencod": 0, "celpars": [5, 8], "celparseerror": 0, "celpi": [1, 2, 3, 4, 5, 7, 8], "celstr": 0, "celsyntaxerror": [0, 7], "celtyp": [1, 2, 3, 4, 5, 7, 8], "celunsupportederror": 0, "central": [0, 7], "cert": 1, "certain": [0, 1], "certif": 1, "cet": 0, "cf": 1, "cfn": 1, "chain": [0, 8], "chainmap": [0, 8], "challeng": 4, "chang": [0, 1, 4, 7], "char": 7, "charact": [0, 2], "character": 0, "check": [0, 4, 7], "check_circular": 0, "check_custom_origin": 1, "checked_except": 0, "checker": 7, "child": 0, "childnr": 0, "children": 0, "choic": [0, 8], "choos": 0, "chosen": 0, "chunk": 1, "ci": 1, "cidr": 0, "cidr_contain": 0, "cidr_siz": [0, 1], "cidrblock": 1, "cipher": 1, "circuit": [0, 7], "cl": 0, "claim": 7, "class": [0, 1, 3, 4, 7, 8], "classic": 1, "classmethod": 0, "claus": [1, 4, 7], "clean": [1, 4], "clear": [1, 2], "cli": [0, 5, 8], "client": [0, 1], "clock": 1, "clone": 0, "close": [0, 1, 2, 7], "closur": 0, "cloud": [0, 1, 5, 8], "cloudform": 1, "cloudfront": [0, 1], "cloudhsm": 1, "cloudsearch": 1, "cloudtrailen": 1, "cloudwatch": [0, 1], "cluster": 1, "cm": 1, "cm6aws11": 1, "cmdbenviron": 1, "cmdloop": 0, "cml": 1, "co": 7, "code": [0, 1, 2, 4, 7, 8], "codebuild": 1, "codebuildproject": 1, "codecommit": 1, "codepipelin": 1, "coerc": 0, "coercion": [0, 7], "collabor": 0, "collect": [0, 1, 4, 8], "collis": [0, 1], "color": 1, "column": [0, 1], "com": [0, 1, 2, 4, 7], "combin": [0, 1, 5, 7], "come": [0, 1, 2], "command": [0, 2, 4, 6, 8], "comment": [1, 4], "common": [0, 7, 8], "commonli": 0, "commun": 1, "commut": 0, "compar": [0, 1, 2], "comparablevers": [0, 1], "comparison": [0, 1, 2, 4, 7], "compat": 0, "compil": [0, 1, 4, 6, 7], "compiledrunn": [0, 8], "complement": 1, "complet": [0, 7], "completekei": 0, "complex": [0, 1, 2, 5, 7, 8], "compli": 1, "compliant": [1, 7], "complic": [0, 7], "compon": [1, 3, 5, 7], "compos": [1, 7], "composit": 1, "compromis": 7, "comput": [0, 1, 2, 7, 8], "computeenviron": 1, "computesgfilt": 1, "computesubnetfilt": 1, "conceal": 1, "concept": [0, 7], "conceptu": 8, "concern": [0, 2], "concret": 0, "condit": [0, 1, 8], "conditionaland": 0, "conditionalor": 0, "conf": 4, "config": 4, "configen": 1, "configrul": 1, "configur": [1, 4, 5, 6], "conform": 4, "confus": 0, "connect": 1, "connectionsecuritygroupfilt": 1, "connectionsubnetfilt": 1, "consequ": 8, "consid": [0, 1, 8], "consider": 1, "consist": 0, "consol": [3, 4], "constant": 0, "constraint": 8, "construct": [0, 5, 7], "constructor": 0, "contain": [0, 1, 3, 4, 5, 7], "containerdefinit": 1, "content": [0, 4], "context": [2, 5, 7], "continu": 7, "control": 1, "convers": [0, 2, 4, 7, 8], "convert": [0, 1, 4, 7], "copi": [0, 1, 4], "core": [0, 1], "correct": 1, "correctli": 0, "cost": 8, "could": [0, 2, 7], "count": [0, 7], "countnumb": 1, "cours": 0, "cover": [0, 7], "coverag": 4, "cpp": 0, "cpu": 1, "cpuutil": [0, 1], "crash": 7, "creat": [0, 1, 4, 7, 8], "created": 1, "createdtim": 1, "creation": [0, 1], "creationd": 1, "creationtimestamp": 7, "credenti": 0, "credentialreport": [0, 1], "credentialreportmixin": [0, 1], "crossaccountaccess": 1, "crossaccountaccessfilt": [0, 1], "crossaccountaccessmixin": [0, 1], "crossaccountfilt": 1, "crossaccountp": 1, "crossregiontransf": 1, "crypto": 1, "csv": 1, "csv2dict": 1, "ct": 1, "ctl": 1, "current": [0, 1, 2, 4, 5, 7, 8], "custodian": [1, 5, 8], "custodian_asv": 1, "custodian_cleanup": 1, "custodian_downtim": 1, "custodian_invalid": 1, "custodian_invalid_asg": 1, "custodian_rds_offhours_ct": 1, "custodian_rds_offhours_et": 1, "custodian_rds_offhours_pt": 1, "custodian_res": 1, "custodian_s3_ns_templ": 1, "custodian_snapshot": 1, "custodian_statu": 1, "custodian_stop": 1, "custodian_tag": 1, "custom": 1, "cut": 0, "cw": 1, "d": [0, 1, 2, 3, 7], "dai": [0, 1], "daili": 1, "darwin": 6, "data": [0, 2, 5, 7, 8], "databas": [0, 1], "databaseconnect": 1, "dataev": 1, "datapipelin": 1, "datapoint": 1, "date": [0, 1], "datetim": [0, 1, 7, 8], "dateutil": 0, "dax": 1, "daxsecuritygroupfilt": 1, "daxsubnetfilt": 1, "daylight": 1, "dbclusteridentifi": 1, "dbsubnetgroup": 1, "dbsubnetgroupnam": 1, "dd": 1, "deal": 0, "debug": [0, 3, 4], "decid": 7, "decim": [0, 2], "decis": 1, "decl": [0, 1, 7], "declar": [0, 1, 7], "decod": 0, "decompos": 0, "decomposit": 0, "decor": [0, 3, 7], "deduc": 0, "deep": 0, "deepli": 0, "def": [0, 1, 7], "default": [0, 2, 4, 7, 8], "default_tz": 1, "default_vpc": 1, "defaultvpc": 1, "defer": 0, "defin": [0, 1, 2, 8], "definit": [0, 2, 4, 7, 8], "deleg": 0, "delet": [1, 7, 8], "deleteprotect": 7, "delimit": [1, 2], "deliv": 1, "demand": 1, "deni": 1, "denial": 1, "denot": 8, "depend": [0, 1, 2, 4, 5, 6, 7, 8], "deprec": [1, 4, 8], "deriv": 0, "descend": 0, "describ": [0, 1, 7, 8], "describe_db_snapshot_attribut": [0, 1], "describe_subscription_filt": [0, 1], "descript": [0, 1, 5, 7], "design": [0, 5], "desir": 1, "desk": 2, "destin": 1, "detail": [1, 2, 3, 7, 8], "detect": 1, "determin": [1, 2, 7], "dev": [1, 7], "develop": [0, 5], "devhelp": 4, "dfunction": 0, "dhcpoptionsfilt": 1, "dhe": 1, "dict": [0, 1, 8], "dict_find_nam": 0, "dictionari": [0, 1, 4], "did": 0, "didn": 7, "differ": [0, 1, 2, 5, 7], "difficult": [0, 1], "digest": 1, "digit": 0, "dimens": [0, 1], "direct": 0, "directconnect": 1, "directli": [0, 1, 2], "directori": [1, 2, 3, 5], "directorysecuritygroupfilt": 1, "directorysubnetfilt": 1, "directoryvpcfilt": 1, "dirhtml": 4, "disabl": [0, 1, 7], "disableapitermin": 1, "discard": 0, "discern": 8, "discov": 0, "displai": [0, 4], "displaynam": 1, "distinct": [0, 7, 8], "distinguish": [0, 7], "distribut": [1, 4], "disutil": 0, "diverg": 1, "divid": 0, "dividebyzeroerror": 7, "divis": 0, "dlm": 1, "dm": 1, "dn": 1, "dnshostnam": 1, "dnsname": 1, "dnssupport": 1, "do": [0, 1, 2, 3, 7, 8], "do_by": 0, "do_eof": 0, "do_exit": 0, "do_quit": 0, "do_set": 0, "do_show": 0, "doc": [0, 1, 5], "doctest": 4, "document": [0, 1, 2, 4, 7, 8], "docutil": 4, "doe": [0, 1, 2, 7, 8], "doesn": [0, 1, 4, 7, 8], "doin": 0, "domain": [0, 1, 8], "don": [0, 1, 2, 7], "done": [0, 1, 3, 8], "dot": 5, "dot_id": [0, 8], "dot_ident_arg": [0, 8], "doubl": 2, "double_valu": 0, "doubletyp": [0, 2, 8], "doublevalu": 0, "down": [0, 1], "download": 4, "dpb": 0, "dsl": [1, 2, 5, 7, 8], "duck": 7, "due": 1, "dump": 0, "dumpast": 0, "duplic": 0, "durat": [0, 1, 7], "durationtyp": [0, 1, 8], "dure": [0, 1, 2, 6], "dvipdfmx": 4, "dyn": 0, "dynam": 4, "dynamodb": 1, "dynamodbacceler": 1, "e": [0, 1, 2], "e1": 0, "e2": 0, "each": [0, 1, 2, 4, 7, 8], "easi": 0, "easier": [1, 7], "easili": [0, 5], "east": [0, 1], "east1": 7, "eastern": 1, "eb": 0, "ebnf": 4, "ebsoptim": 1, "ec": 1, "ec2": [0, 1, 7], "ec2_userdata_stop": 1, "ecdh": 1, "ecdsa": 1, "echo": 2, "ecr": 1, "ecrcrossaccountaccessfilt": 1, "ecsclust": 1, "ecsmetr": 1, "ef": 1, "effect": [0, 1, 2], "effort": 4, "egress_viol": 1, "eip": 1, "either": [0, 1], "ek": 1, "ekssgfilt": 1, "ekssubnetfilt": 1, "eksvpcfilt": 1, "elast": 1, "elasticach": 1, "elasticachesnapshot": 1, "elasticachesnapshotag": 1, "elasticbeanstalk": 1, "elasticfilesystem": 0, "elasticfilesystemmounttarget": 1, "elasticmapreduc": 1, "elasticsearch": 1, "elasticsearchdomain": 1, "elb": [0, 1], "elblog": 1, "elbsecuritypolici": 1, "elem": 0, "element": [1, 7], "elif": 0, "els": 0, "email": [1, 7], "email_verifi": 7, "emb": 2, "embed": [4, 5, 7], "emmo": 1, "emphat": 7, "empti": [0, 1, 3], "emr": 1, "emrclust": 1, "emrmetr": 1, "en": [4, 7], "enabl": [0, 3, 4, 5, 7], "enasupport": 1, "encod": 0, "encoders_ext": 4, "encount": 0, "encounterd": 0, "encryptionenabledfilt": 1, "end": [0, 1, 8], "endpoint": 1, "endpointcrossaccountfilt": 1, "endpointsecuritygroupfilt": 1, "endpointsubnetfilt": 1, "endpointvpcfilt": 1, "endtim": 0, "engin": [0, 1], "enhanc": 2, "eni": 1, "ensur": [1, 7], "ensure_ascii": 0, "ent": 1, "enter": [0, 2], "enterpris": 1, "entir": 0, "entri": 8, "enum": [0, 1, 4], "enumtyp": 0, "env": [1, 4, 7], "environ": [0, 1, 3, 4, 5, 6, 7, 8], "eof": 2, "ephemeralinstancefilt": 1, "epub": 4, "eq": [0, 1], "eq_test": 0, "equal": [0, 1], "equival": 0, "err": 7, "erron": 0, "error": [0, 2, 3, 5, 8], "error_text": 0, "escap": 0, "eschew": 1, "essenc": 7, "essenti": [0, 1, 5, 8], "est": 1, "establish": 0, "et": 1, "etc": [0, 1], "eu": 1, "europ": 0, "eustac": 0, "eval": [0, 2, 7, 8], "eval_error": 0, "eval_filt": 1, "evalu": [1, 2, 3, 4, 5, 7], "even": [0, 1], "event": 0, "eventrul": 1, "eventrulemetr": 1, "eventruletarget": 1, "eventstatuscod": 0, "eventu": [0, 7], "ever": 7, "everi": [0, 1], "everydai": 1, "everyone_onli": 1, "everyth": [2, 4], "ex": [0, 7], "ex_": 0, "ex_10": 0, "ex_10_l": 0, "ex_10_x": 0, "exact": 1, "exactli": 7, "examin": [0, 1, 2, 7], "exampl": [0, 5, 8], "exc_class": 0, "exc_typ": 0, "exc_valu": 0, "exceed": 1, "except": [0, 1, 2, 5, 8], "exceptionmanualsnapshot": 1, "exclud": 1, "exclude_imag": 1, "exec": [0, 8], "execut": [0, 1, 2, 4, 7, 8], "exempt": [0, 1], "exist": [0, 1, 3], "exists_on": 0, "exit": 5, "expand": 0, "expans": 0, "expect": [0, 1, 2, 7], "experiment": 8, "expir": 1, "explicit": [0, 1, 8], "explicitli": [0, 1], "explict": 2, "explor": 8, "export": 0, "expos": [0, 1, 7, 8], "expr": [0, 1, 2, 4, 7, 8], "expr_test_bc": 4, "express": [0, 1, 2, 4, 6, 7, 8], "exprlist": 0, "exprpb": 7, "extant": 1, "extend": [0, 1, 2, 7, 8], "extended_name_path": 0, "extens": [0, 1, 7, 8], "extent": [0, 1, 7], "extern": [0, 4, 5], "extra": 1, "extract": [0, 1], "f": [0, 1, 2, 7, 8], "f1": 2, "f2": 2, "facad": [0, 8], "factfind": 1, "factori": 0, "fail": [0, 1], "failur": [0, 1, 2], "fairli": 0, "fall": 0, "fallback": 0, "fals": [0, 1, 2, 7], "far": 0, "fargat": 1, "fatal": 3, "fatalf": 7, "fatalln": 7, "faulttolerantsnapshot": 1, "favor": 0, "featur": [1, 5, 7, 8], "fetch": 1, "few": [0, 1, 7], "ffffffff": 1, "field": [0, 1, 4, 7, 8], "fieldinit": [0, 8], "fifo": 2, "file": [0, 1, 3, 5], "filesystem": 2, "filter": [0, 5, 8], "filter_inst": 7, "filter_registri": 1, "filter_resource_statist": 1, "filterrestintegr": 1, "filterrestmethod": 1, "final": [0, 1, 2, 7, 8], "find": [0, 2], "find_nam": 0, "firehos": 1, "first": [0, 7, 8], "fit": [0, 1, 7], "fiter": 0, "five": 7, "fix": [0, 1, 7], "fixedint": 0, "fixedtz": 0, "fixtur": 0, "fklter": 1, "flag": 1, "flat": 0, "flavor": 0, "fleet": 1, "float": [0, 2, 8], "float_lit": 0, "floatvalu": 0, "flow": 0, "flow_log": [0, 1], "flowlogfilt": 1, "fmt": 7, "fnmatch": [0, 1], "focus": 1, "follow": [0, 1, 2, 3, 4, 7, 8], "foo": 1, "foobar": 1, "forbidden": 1, "form": [0, 1, 4, 7, 8], "formal": [0, 7], "format": [0, 1, 2, 3, 4, 7], "formatt": 3, "formerli": 0, "forwardref": 0, "found": [0, 1, 8], "foundat": 0, "four": [0, 1, 7, 8], "fp_math": 4, "fraction": 0, "fragment": 0, "frame": 0, "framework": [7, 8], "fri": 1, "friendli": [0, 2], "from": [0, 1, 2, 4, 5, 8], "fromport": 1, "front": 0, "frozenset": 0, "fs_analytical_dev": 1, "fs_analytical_qa": 1, "fs_core_cas_qa": 1, "fs_custodian_tag": 1, "fs_manual_ebs_snapshot_expir": 1, "fs_manual_rds_snapshot_expir": 1, "fsx": 1, "fulfil": 0, "full": [0, 4], "full_control": 1, "fulli": 0, "func": [0, 7], "func_nam": 0, "function": [2, 5, 8], "function_contain": 0, "function_endswith": 0, "function_ev": 0, "function_getd": 0, "function_getdayofmonth": 0, "function_getdayofweek": 0, "function_getdayofyear": 0, "function_getfullyear": 0, "function_gethour": 0, "function_getmillisecond": 0, "function_getminut": 0, "function_getmonth": 0, "function_getsecond": 0, "function_match": 0, "function_s": 0, "function_startswith": 0, "functiontyp": [0, 7], "functool": 7, "fundament": 8, "further": 0, "futur": [0, 4], "g": [0, 1, 2], "g4": 0, "gamelift": 1, "gatewai": 1, "gather": [1, 7], "gb": 1, "gc": 1, "gcm": 1, "ge": [0, 1], "gen": 0, "gener": [0, 1, 4, 7, 8], "geograph": 1, "get": [0, 1, 2, 4, 8], "get_access_log": [0, 1], "get_account": [0, 1], "get_credential_report": [0, 1], "get_dbsubnet_group_us": [0, 1], "get_endpoint": [0, 1], "get_flow_log": 1, "get_health_ev": [0, 1], "get_instance_imag": [0, 1], "get_key_polici": [0, 1], "get_launch_configuration_nam": [0, 1], "get_load_balanc": [0, 1], "get_matching_alias": [0, 1], "get_metr": [0, 1], "get_metric_statist": 1, "get_model": 1, "get_nam": 0, "get_opt": 0, "get_orgid": [0, 1], "get_protocol": [0, 1], "get_raw_health_ev": [0, 1], "get_raw_metr": [0, 1], "get_rel": [0, 1], "get_related_id": [0, 1], "get_related_igw": 0, "get_related_kms_kei": 0, "get_related_nat_gatewai": 0, "get_related_security_config": 0, "get_related_sg": 0, "get_related_subnet": 0, "get_related_vpc": 0, "get_resource_polici": [0, 1], "get_resource_statist": [0, 1], "get_resource_valu": 1, "get_type_protect": [0, 1], "get_valu": [0, 8], "get_vpc": [0, 1], "getdat": [0, 1], "getdayofmonth": 0, "getdayofweek": [0, 1], "getdayofyear": 0, "getfullyear": 0, "gethour": [0, 1], "getmillisecond": 0, "getminut": 0, "getmonth": 0, "getsecond": 0, "gettext": 4, "gettz": 0, "gherkin": 5, "gib": 1, "git": 4, "github": [0, 1, 2, 4, 7], "give": 7, "given": [0, 1, 2, 4, 7, 8], "gl": 1, "glacier": 1, "glaciercrossaccountaccessfilt": 1, "glob": [0, 1], "global": 0, "globalgrantsfilt": 1, "glue": 1, "glueconnect": 1, "go": [0, 1, 5], "go_mod": 0, "goal": 0, "golang": 0, "goo": 1, "good": [1, 7], "googl": [0, 1, 2, 4, 7], "gracefulli": 0, "grai": 1, "grammar": [0, 4], "grantcount": 1, "greater": 1, "greet": 7, "greetfunc": 7, "group": [0, 7], "group_access": 2, "groupid": 1, "groupmembership": 1, "groupnam": 1, "grouppolicysizequota": 1, "groupset": 1, "groupsperuserquota": 1, "groupsquota": 1, "gt": [0, 1], "gte": 1, "h": [0, 1, 2], "ha": [0, 2, 4, 5, 7, 8], "had": 1, "hand": 7, "handl": [0, 1, 2, 7, 8], "handler": 3, "hapg": 1, "happen": 0, "hard": 0, "hash": 0, "hashabl": 0, "hasn": 8, "hasstatementfilt": 1, "hasvirtualmfa": 1, "have": [0, 1, 2, 3, 4, 5, 7, 8], "haven": 1, "head": [0, 1, 4], "header": 1, "healtch": 1, "health": 0, "health_ev": 1, "healthcheckprotocolmismatch": 1, "healthev": 1, "healtheventfilt": 1, "healthfilt": 1, "heavi": 1, "hello": [0, 7], "help": [0, 1, 2, 4, 7, 8], "here": [0, 1, 2, 7, 8], "heredoc": 2, "hh": 0, "hidden": 0, "higher": 1, "highli": 1, "hint": [0, 4, 8], "hit": 1, "holidai": 1, "home": [1, 2, 3], "hook": 0, "host": [0, 1], "hostedzon": 1, "hostnam": 1, "hour": [0, 1], "hourli": 1, "housekeep_unused_sg": 1, "how": [0, 1, 7], "howev": [0, 1, 7, 8], "hsm": 1, "html": [0, 1, 4, 7], "htmlhelp": 4, "http": [0, 1, 2, 4, 5, 7], "hybrid": 0, "i": [0, 2, 4, 5, 6, 7, 8], "iam": 0, "iamaccessfilt": [0, 1], "iamgroupinlinepolici": 1, "iamgroupus": 1, "iaminstanceprofil": [0, 1], "iamroleinlinepolici": 1, "iamroleusag": [0, 1], "iamroleusagemixin": [0, 1], "iamsummari": 1, "iamuserinlinepolici": 1, "iana": [0, 1], "id": 0, "idea": [0, 7], "ideal": 0, "ident": [0, 1, 8], "ident_arg": [0, 8], "ident_pat": 0, "ident_valu": 0, "identifi": [0, 1, 8], "ie": 1, "ietf": 0, "ifi": 2, "ignor": [0, 1, 2, 4, 7], "ii": 0, "imag": 0, "imageag": 1, "imageagefilt": 1, "imagefilt": 1, "imageid": [0, 1], "imagenam": 1, "imagesunusedmixin": [0, 1], "imageunusedfilt": [0, 1], "immedi": 1, "implement": [0, 2, 4, 5, 8], "implent": 1, "impli": [0, 1], "implicit": 1, "implicitli": 1, "import": [0, 1, 2, 5, 7, 8], "improt": 8, "includ": [0, 1, 3, 5, 7, 8], "incomplet": 0, "incorrect": 1, "incorrectlambda": 1, "increas": 0, "indent": 0, "independ": 0, "index": [0, 4, 5], "indexerror": 0, "indic": [0, 2], "individu": [0, 1], "infer": 1, "infin": 0, "info": [1, 3, 4], "inform": [0, 1, 4, 7, 8], "infrastructur": 5, "init": 0, "initi": 0, "inject": 0, "input": [0, 2, 7, 8], "insid": [0, 8], "instal": 5, "instanc": [0, 7, 8], "instance_profile_usag": [0, 1], "instanceagefilt": 1, "instanceattribut": 1, "instancecreatetim": 1, "instanceid": 0, "instanceimag": 1, "instanceimagebas": [0, 1], "instanceimagemixin": [0, 1], "instanceinitiatedshutdownbehavior": 1, "instanceoffhour": 1, "instanceonhour": 1, "instanceprofil": 1, "instanceprofilenam": 1, "instanceprofilesquota": 1, "instances": 7, "instancestorag": 1, "instancetyp": 1, "instead": [0, 1, 2, 7], "insufficient_data": 1, "int": [0, 1, 2, 8], "int32": 0, "int32valu": 0, "int64": 0, "int64_overflow_neg": 0, "int64_overflow_posit": 0, "int64_valu": [0, 4], "int64valu": 0, "int_lit": 0, "intact": 0, "integ": [0, 1, 2], "integer_math": [0, 4], "integr": [0, 2, 3, 4, 8], "intend": 0, "intent": [1, 2, 5], "interact": [0, 2, 8], "interect": 0, "interest": [5, 7, 8], "interfac": [0, 1, 7, 8], "interfacesecuritygroupfilt": 1, "interfacesubnetfilt": 1, "interfacevpcfilt": 1, "intermedi": [0, 7], "intern": [0, 1, 7, 8], "internet": 1, "interoper": 5, "interpret": 0, "interpretedrunn": [0, 8], "interrog": 0, "intersect": [0, 1], "intoper": 0, "intro": 0, "introduc": [0, 7, 8], "inttyp": [0, 2, 4, 8], "invalid": 2, "invalidconfigfilt": 1, "invers": 1, "invis": 1, "involv": [0, 2, 5, 8], "io": [0, 7], "iop": 1, "iot": 1, "ip": 1, "ipaddress": 0, "ippermiss": 1, "ippermissionegress": 1, "ipv4address": 0, "ipv4network": 0, "ish": 4, "islog": 1, "isloggingfilt": [0, 1], "isn": [0, 1, 8], "isnotloggingfilt": [0, 1], "isqueryloggingen": 1, "isrm": 1, "iss": 7, "isshadow": 1, "isshieldprotect": [0, 1], "isshieldprotectedmixin": [0, 1], "issslfilt": 1, "issu": [0, 1, 7, 8], "iswafen": [0, 1], "item": [0, 1, 2, 4, 7], "iter": [0, 1], "its": [0, 1, 7], "itself": 0, "iunjpz": 1, "jme": 0, "jmes_path": [0, 1], "jmes_path_map": [0, 1], "jmespath": [0, 1], "job": [0, 1], "joda": 0, "jq": [0, 2, 8], "json": [0, 1, 2, 4, 7, 8], "json_queri": 4, "json_to_cel": [0, 1, 7], "jsonencod": 0, "jsonl": 0, "jsonlin": 2, "just": 1, "kai": 0, "keep": [0, 1], "kei": [0, 4, 5, 7, 8], "kernel": 1, "key_id": 0, "key_valu": 1, "keyalia": 1, "keyerror": 0, "keyid": 1, "keynam": 1, "keyrotationen": 1, "keyrotationstatu": 1, "kind": [0, 1, 2, 7, 8], "kinesi": 1, "kit": 4, "km": 0, "kms_alia": [0, 1], "kms_kei": [0, 1], "kmsfilter": 1, "kmskeyalia": 1, "know": 4, "known": [0, 2, 7], "kwarg": 0, "l": 2, "label": 0, "lambda": [0, 1], "lambdacrossaccountaccessfilt": 1, "lambdaeventsourc": 1, "lambdalayervers": 1, "langdef": [0, 1, 4], "languag": [0, 1, 2, 4, 7, 8], "larg": [1, 4, 7], "large_instance_typ": 1, "lark": [0, 4, 7, 8], "last": 0, "last_rot": 1, "last_used_d": 1, "last_used_region": 1, "last_used_servic": 1, "lastrot": 1, "lastupdatedtim": 1, "lastwritedai": 1, "later": [0, 1], "latest": [0, 7], "latestsnapshot": 1, "latex": 4, "latexpdf": 4, "latexpdfja": 4, "launchconfig": 1, "launchconfigag": 1, "launchconfigfilt": 1, "launchconfigurationnam": 1, "launchtyp": 1, "layer": [0, 1, 8], "layercrossaccount": 1, "lc_userdata": 1, "le": [0, 1], "lead": [0, 1], "least": [0, 1], "leav": 1, "left": [0, 1], "legaci": [0, 1], "len": [0, 1], "length": 0, "less": [0, 1, 7], "let": 0, "letter": [2, 4], "level": [0, 1, 3, 4, 8], "levelnam": 3, "leverag": [0, 8], "lexic": 0, "lh": 7, "librari": [0, 1, 7, 8], "licens": 1, "life": [0, 1], "lifecyclerul": 1, "like": [0, 1, 2, 3, 4, 7], "likewis": 1, "limit": 0, "line": [0, 1, 2, 8], "lineno": 3, "link": [2, 4], "linkag": 1, "linkcheck": 4, "lint": 4, "linux": 2, "list": [0, 1, 4, 7, 8], "list_lit": [0, 8], "listtyp": [0, 8], "listvalu": 0, "liter": [0, 1, 2, 8], "littl": [0, 2], "ll": [0, 7, 8], "load": [0, 1], "load_annot": 0, "load_valu": 0, "local": [0, 1, 3, 4, 8], "localized_ev": 0, "locat": 0, "log": [0, 2, 3, 7], "logcrossaccountfilt": 1, "logg": 1, "logger": [0, 3], "loggroup": 1, "logic": [0, 2, 4, 7], "logical_and": 0, "logical_condit": 0, "logical_not": 0, "logical_or": 0, "logtarget": 1, "long": [0, 1], "longer": [1, 2], "longest": 0, "longtz": 0, "look": [0, 1, 4, 7], "lookup": 0, "loosevers": 0, "los_angel": 1, "loss": 1, "lower": [0, 1], "lowerascii_unicod": 4, "lowercas": 0, "lt": [0, 1], "lte": 1, "m": [0, 1, 2, 6, 7], "m1": 7, "m3": 1, "machin": 1, "macro": [0, 1, 4, 8], "macro_": 0, "macro_al": 0, "macro_exist": [0, 4], "macro_exists_on": 0, "macro_filt": 0, "macro_has_ev": 0, "macro_map": 0, "macros2": 4, "made": [0, 1], "magnet": 1, "magnitud": 0, "mai": [0, 1, 4, 6, 7, 8], "maid": 1, "maid_offhour": [0, 1], "maid_statu": 1, "main": [0, 8], "major": 1, "make": [0, 1, 2, 4, 7, 8], "makefil": 5, "makeinfo": 4, "man": 4, "manag": 0, "mani": [0, 1, 2], "manual": [1, 4], "map": [0, 1, 2, 7, 8], "map_lit": [0, 8], "mapinit": 0, "mapkeytyp": 8, "mappubliciponlaunch": 1, "maptyp": [0, 1, 7, 8], "march": 0, "marked_kei": [0, 1], "markedforop": 1, "marker": 0, "mask": [0, 7], "master": [0, 1, 4, 7], "match": [0, 1, 4, 6, 7, 8], "matchabl": 1, "materi": 0, "math": [0, 2], "math_ext": 4, "matter": 0, "max": 1, "maximum": 1, "maxproperti": 1, "maxsecond": 0, "mayb": 0, "mccarthi": 0, "md": [0, 1, 4, 7], "me": 7, "mean": [0, 1, 2, 7, 8], "meaning": 0, "medium": 1, "meet": 7, "member": [0, 1, 5], "member_dot": [0, 8], "member_dot_arg": [0, 8], "member_index": 0, "member_item": [0, 8], "member_object": [0, 8], "mental": 2, "mere": 0, "messag": [0, 1, 3, 4, 7], "message_liter": 0, "messagebrok": 1, "messagetyp": [0, 8], "meta": 0, "meth": 0, "method": [0, 3, 7, 8], "method_ev": 0, "method_id": 0, "metric": 0, "metricnam": 0, "metricsaccess": 0, "metricsfilt": 1, "mfa_act": 1, "mfadevic": 1, "mfadevicesinus": 1, "mi": 1, "middl": 0, "might": [0, 7], "mimic": 2, "min": 1, "mini": 2, "minim": [0, 3, 5], "minimum": [0, 1], "minimumpasswordlength": 1, "minproperti": 1, "minsecond": 0, "minut": [0, 1], "mismatch": 0, "mismatchs3origin": 1, "miss": [0, 5], "missingrout": 1, "mistak": 1, "mix": 0, "mixin": [0, 1], "ml": 1, "mlstring_lit": 0, "mm": [0, 1], "mock": [0, 1], "mod": [0, 1], "mode": [0, 2], "model": [0, 1, 7], "modern": 1, "modif": [1, 2], "modifi": [0, 1], "modifyablevolum": 1, "modul": [0, 1, 3, 4, 5, 7, 8], "modulo": 0, "modulu": 0, "moment": 1, "mon": 1, "monad": 0, "monitor": 1, "monthli": 1, "more": [0, 1, 2, 3, 4, 5, 8], "morn": 1, "most": [0, 1, 2, 7, 8], "mount": 1, "mq": 1, "mqmetric": 1, "mqsgfilter": 1, "mqsubnetfilt": 1, "mssage": 1, "much": [0, 2], "mul": 0, "multi": 1, "multilin": 2, "multipl": [0, 1, 2, 7, 8], "multipli": 1, "multiplication_div": 0, "multiplication_mod": 0, "multiplication_mul": 0, "must": [0, 1, 2, 3, 4, 7, 8], "my": 1, "my_extens": 7, "mydata": 1, "n": [0, 2, 7], "nacl": 1, "name": [1, 2, 3, 4, 5, 7], "name1": 0, "name2": 0, "name_arg": 7, "name_token": 0, "namecontain": [0, 3, 8], "nameerror": [0, 8], "namespac": [0, 1, 4], "nano": 0, "nanosecondspersecond": 0, "narrowli": 1, "nat": 1, "nativ": [0, 1, 4, 7], "navig": 0, "nc": [0, 1], "nc1": 0, "nc2": 0, "ndjson": [0, 2], "ne": [0, 1], "necessari": 0, "necessarili": 0, "need": [0, 1, 3, 5, 7, 8], "needless": 0, "neg": 0, "neither": [4, 8], "nest": [0, 7, 8], "nested_activ": 0, "net": [0, 1], "networkacl": 1, "networkin": 1, "networkinterfac": 1, "networkloc": 1, "networkout": 1, "new": [0, 1, 7], "new_activ": 0, "new_text": 0, "newenv": 7, "newer": 7, "newfunct": 7, "newinstanceoverload": 7, "newli": 1, "newlin": 2, "newvar": 7, "next": [0, 1, 8], "ni": 1, "nice": [0, 7], "nightli": 1, "nil": 7, "nljson": [0, 2], "no_such_field": 0, "node": 0, "nodesnaphot": 1, "nomin": 0, "non": [0, 3, 5, 7], "non_compli": 1, "none": [0, 1, 4, 7], "nonetyp": 0, "nonpubl": 1, "nor": 8, "noreturn": 0, "normal": [0, 1, 2], "nospecificiamrolemanagedpolici": 1, "not_": 0, "not_applic": 1, "not_nul": 1, "notabl": 2, "notact": 1, "note": [0, 1, 2, 7, 8], "notebook": 1, "notebookinst": 1, "notebooksecuritygroupfilt": 1, "notebooksubnetfilt": 1, "notencryptedfilt": 1, "notfound": 0, "noth": [0, 1], "notifi": 1, "notimplementederror": 7, "notion": 0, "notprincip": 1, "notresourc": 1, "notsetsentinel": 0, "nov": 1, "now": [0, 1, 7], "nsj7vg": 1, "ntp": 1, "nuanc": [0, 8], "null": [0, 1, 2], "null_lit": 0, "null_valu": 0, "nulltyp": [0, 8], "nullvalu": 0, "number": [0, 1, 2, 4, 7, 8], "number_valu": 0, "numer": 7, "o": [0, 1, 4], "obect": 0, "object": [2, 5, 7, 8], "object_hook": 0, "object_pairs_hook": 0, "objecthook": 0, "obscur": [0, 1], "obsolet": 0, "obvers": 1, "obviou": 7, "occur": [1, 7], "octal": 0, "odd": 0, "off": [0, 1], "offer": [0, 1, 8], "offhour": 0, "offhours_except": 1, "offset": [0, 1], "often": [0, 4, 5, 7], "ok": 1, "old": [0, 1], "older": 1, "omit": [1, 2, 7], "onc": [0, 1], "one": [0, 1, 2, 4, 5, 7, 8], "oneof": [0, 1], "onli": [0, 1, 2, 3, 7], "onlin": 1, "onlyport": 1, "onto": 0, "oop": [0, 7], "op": [0, 7], "op_name_map": 0, "opa": 1, "opaqu": 0, "open": [0, 1], "openpolicyag": [0, 1], "opensourc": 5, "oper": [0, 1, 2, 7, 8], "operand": [0, 1], "operator_in": 0, "opswork": 1, "opt": 1, "optim": [0, 1, 7], "option": [0, 2, 3, 4, 6], "order": [0, 1], "ordinari": 0, "oreo": 1, "org": [0, 1, 2, 4], "organ": [1, 5], "organi": 8, "organiz": 1, "orgid": 0, "origin": [0, 7], "other": [0, 1, 2, 3, 4, 6, 7, 8], "otherwis": 0, "out": [0, 1, 7], "outlin": [1, 7], "output": [0, 2, 3, 4, 7], "outsid": [0, 1, 7, 8], "over": [0, 1, 2, 7, 8], "overal": [0, 7, 8], "overdraftlimit": 7, "overdraftprotect": 7, "overflow": 0, "overhead": [0, 8], "overlap": 0, "overload": [0, 7, 8], "overloadd": 0, "overrid": [0, 1, 8], "overridden": 0, "overview": 4, "overwhelm": 1, "own": [0, 1, 7], "owner": [1, 7], "ownercontact": 1, "ownereid": 1, "p": [0, 2], "pacif": 1, "packag": [0, 2, 3, 5, 6, 7, 8], "packagetyp": 0, "page": [4, 5], "pair": [0, 1], "paper": 4, "paragraph": 3, "parallel": [0, 2, 4], "paramet": [0, 3, 7], "parameterfilt": 1, "paren_expr": [0, 8], "parent": [0, 1], "parent_it": 0, "pari": 0, "pars": [0, 1, 4, 8], "parse_cidr": [0, 1], "parse_const": 0, "parse_d": 1, "parse_float": 0, "parse_int": 0, "parse_text": [0, 1], "parser": [0, 1, 2, 7, 8], "part": [0, 1, 4, 5, 7, 8], "partial": [0, 7], "particular": [0, 1, 2], "particularli": 1, "partit": 0, "partivular": 0, "pass": [0, 1, 4, 7], "password_en": 1, "password_last_chang": 1, "password_last_us": 1, "password_next_rot": 1, "passwordpolicyconfigur": 1, "past": 1, "patch": 1, "path": [0, 1, 4], "path_sourc": 0, "pattern": [0, 1, 2], "payload": 0, "pdf": 4, "pdflatex": 4, "peer": 1, "peeringconnect": 1, "pend": 0, "pendulum": [0, 1], "per": 1, "percent": 1, "perfectli": 1, "perform": [0, 1, 4, 8], "perhap": 0, "period": [0, 1], "permiss": [1, 2], "permissionsboundaryusagecount": 1, "permit": [0, 1, 3, 7, 8], "persist": 0, "person": 8, "perspect": 7, "pg": 1, "pgm": [0, 1], "phase": 0, "phase1transpil": 0, "phase2transpil": 0, "phd": 1, "phoni": 4, "pick": 2, "pickl": 4, "piec": [1, 2], "pingstatu": 1, "pip": 6, "pipe": 2, "place": [0, 1, 2], "plan": [0, 1], "platex": 4, "platform": [1, 5, 6], "platformnam": 1, "platformvers": 1, "pleas": [1, 4], "pleasant": 0, "plu": [0, 1], "pluck": 0, "plumb": 4, "pm": 1, "po": 4, "poetri": 6, "point": [0, 1, 2, 7, 8], "polici": [0, 5, 7], "policiesquota": 1, "policyassign": 1, "policynam": 1, "policysizequota": 1, "policyversionsinus": 1, "policyversionsinusequota": 1, "polit": 0, "pollut": 3, "pool": [0, 1], "poorli": 0, "pop": 0, "popul": 0, "popular": 1, "port": 1, "posit": [0, 7], "possibl": [0, 1, 2, 8], "possibli": [0, 1], "post": 1, "power": 2, "pprint": 0, "practic": 4, "pragmat": [0, 7], "prcess": 1, "precis": 4, "predefin": 8, "prefer": 0, "prefetch_instance_imag": 0, "prefix": [0, 1, 4], "prefixlen": [0, 1], "preloop": 0, "prepar": [0, 1, 8], "prepare_queri": [0, 1], "presenc": [0, 1, 7], "present": [0, 1, 4], "preserv": 1, "presum": 2, "pretti": 0, "prevent": [0, 1, 7], "previou": [0, 1, 7], "previous": 1, "prg": 7, "prgm": [0, 7], "primari": [0, 2, 8], "primarili": 0, "primit": [1, 2], "princip": 1, "principl": [0, 5], "print": 0, "println": 7, "prior": [0, 7], "probabl": 1, "problem": [0, 1, 4, 8], "process": [0, 1, 2, 7], "process_json_doc": 0, "process_resource_set": 1, "process_value_typ": 1, "prod": 7, "prodlog": 1, "produc": [0, 4, 7], "product": [0, 5], "productcod": 1, "profil": 1, "program": [0, 1, 2, 5, 7, 8], "programopt": 7, "progress": [0, 4], "project": [0, 1, 5, 7], "promot": 1, "prompt": [0, 2], "propag": [0, 1], "proper": [0, 1], "properli": 6, "properti": [0, 1, 7], "propog": 0, "propos": 1, "proto": [0, 7], "proto2": 4, "proto2_ext": 4, "proto3": 4, "proto3pb": 0, "protobuf": [0, 1, 2, 4, 7], "protobuf_messag": 8, "protobuf_typ": 0, "protobyf": 0, "protocol": [0, 5], "provid": [1, 2, 3, 4, 7, 8], "provis": [0, 1], "proxi": 1, "pseudoxml": 4, "pst": 1, "pt": [0, 1], "pubfac": 1, "public": 0, "pull": 1, "purchas": 1, "pure": 0, "purpos": [1, 4], "push": 0, "put": 1, "py": [0, 1, 5], "py310": 4, "py311": 4, "py312": 4, "py313": 4, "py39": 4, "pypi": 0, "python": [0, 1, 4, 6, 7, 8], "pythontranspil": 0, "qa": 1, "qthelp": 4, "qualifi": 0, "qualified_identifier_resolution_uncheck": 0, "queri": 0, "question": 0, "queue": 1, "quick": 4, "quickli": 5, "quietli": 0, "quit": [0, 2, 7, 8], "quot": 2, "quota": 1, "quux": 0, "r": [0, 2, 7], "r53domain": 1, "radisti": 1, "raft": 1, "rais": [0, 2, 3, 7, 8], "ramdisk": 1, "rang": [0, 8], "rank": 1, "rare": [0, 1], "rather": 7, "raw": [0, 1], "rd": [0, 1], "rdscluster": 1, "rdsclustersnapshot": 1, "rdsoffhour": 1, "rdsonhour": 1, "rdssnapshot": 1, "rdssnapshotag": 1, "rdssnapshotonhour": 1, "rdssubnetgroup": 1, "rdt": 1, "re": [0, 1], "re2": [0, 6], "reach": [0, 1], "read": [0, 1, 2, 4, 7], "read_acp": 1, "readi": [0, 7], "readm": [0, 7], "readonli": 1, "readonlyrootfilesystem": 1, "readreplicadbinstanceidentifi": 1, "readreplicasourcedbinstanceidentifi": 1, "readthedoc": 7, "real": 0, "realli": [0, 2], "reason": [1, 5], "receiv": 7, "recent": [0, 1], "recogn": 0, "recommend": 1, "recov": 1, "recurs": 0, "redact": 1, "redshift": 1, "redshiftsnapshot": 1, "redshiftsnapshotag": 1, "redshiftsnapshotcrossaccount": 1, "reduc": [0, 1], "reduct": 0, "ref": [0, 1, 7], "ref_to": 0, "refactirubg": 1, "refactor": [0, 1], "refer": [1, 2, 5, 7, 8], "referenc": 1, "reflect": [0, 4, 7], "refresh_period": 1, "refus": 0, "regex": [0, 1], "region": [0, 1], "regist": [0, 1], "registri": [0, 1], "regular": [1, 2, 6], "rehydr": [0, 1], "reject": 1, "rel": 0, "relat": [0, 1, 7, 8], "relatedresourcefilt": [0, 1], "relatedresourcemixin": [0, 1], "relation_eq": 0, "relation_g": 0, "relation_gt": 0, "relation_in": 0, "relation_l": 0, "relation_lt": 0, "relation_n": 0, "relationshiup": 1, "releas": 1, "reli": [0, 1, 2, 7], "remain": 1, "remaind": 0, "remot": 0, "remov": [0, 1, 4, 7], "renam": [0, 1, 8], "reorder": 1, "repeat": 0, "repeatedli": [0, 1], "repl": [0, 2, 3], "replac": [0, 1, 7, 8], "replicationinst": 1, "report": [1, 4], "report_delai": 1, "report_gener": 1, "report_max_ag": 1, "repositori": 4, "repr": 0, "repres": [0, 1], "represent": [0, 1], "request": [0, 1, 7], "requir": [0, 2, 5, 7, 8], "require_ssl": 1, "requiredencryptedputobject": 1, "requireencryptedputobject": 1, "requirelowercasecharact": 1, "requirenumb": 1, "requiresslaccessrdt": 1, "requiresymbol": 1, "requireuppercasecharact": 1, "rerefer": 0, "reservedconcurr": 1, "resili": 1, "resiz": 1, "resize_config": 1, "resolut": [7, 8], "resolv": [0, 7], "resolve_funct": 0, "resolve_nam": [0, 8], "resolve_vari": 0, "resourc": [0, 1], "resource_count": [0, 1], "resource_list": 7, "resource_schedul": [0, 1], "resource_typ": [1, 7], "resourcekmskeyalia": [0, 1], "resourcekmskeyaliasmixin": [0, 1], "respect": 0, "rest": 2, "restapi": 1, "restapicrossaccount": 1, "restor": [0, 1], "restresourc": 1, "restrict": 1, "result": [0, 1, 2, 7, 8], "result_funct": 0, "result_valu": 0, "resum": 1, "retriev": 2, "return": [0, 1, 2, 7, 8], "reus": [0, 1], "revers": [0, 1], "review": 7, "revis": [1, 4], "rework": 1, "rewrit": 7, "rewritten": 0, "rfc": 0, "rfc3339": 0, "rh": 7, "rhymjmbbe2": 1, "rich": 0, "right": [0, 8], "role": [0, 1], "rolecrossaccountaccess": 1, "rolenam": 1, "rolepolicysizequota": 1, "rolesquota": 1, "root": [0, 1, 3], "root_scop": 0, "rootdevicenam": 1, "route53": 1, "routet": 1, "rrset": 1, "rsa": 1, "rule": [0, 7], "rulestatu": 1, "run": [0, 1, 4, 5, 7, 8], "runnabl": 0, "runner": [0, 3, 4, 7, 8], "runner_class": [0, 1], "runtim": 0, "s3": 0, "s3bucketnam": 1, "s3crossaccountfilt": 1, "s3metric": 1, "s3publicblock": 1, "sagemak": 1, "sai": [0, 1], "said": 0, "same": [0, 1, 2, 4, 7, 8], "samplecount": 1, "save": [0, 1, 2], "sc": 1, "scale": [0, 1], "scan": 1, "scan_group": [0, 1], "scatter": 1, "scenario": [0, 4], "schedul": 1, "schedulepars": [0, 1], "schema": [1, 7], "scope": 0, "script": 8, "se": 1, "search": [0, 1, 5], "searchabl": 0, "second": [0, 1], "secondari": 1, "secondarili": 0, "secret": [1, 7], "secretsmanag": [0, 1], "section": [1, 4, 8], "secur": [0, 2, 5], "securetransport": 1, "security_group": [0, 1], "security_group_id": 0, "securitygroup": 1, "securitygroupdifffilt": 1, "securitygroupfilt": 1, "securitygrouplockedfilt": 1, "see": [0, 1, 2, 3, 4, 7, 8], "seed": 0, "seem": [0, 1, 8], "select": [0, 1], "selector": 1, "selector_valu": 1, "self": [0, 1, 4, 7], "self_eval_int_zero": 4, "self_eval_uint_zero": 4, "self_eval_zeroish": 4, "selfrefer": 1, "semant": [0, 1, 2, 5, 8], "semicolon": 1, "send": 1, "sens": 8, "sensibl": [0, 1], "sentinel": [0, 1], "separ": [0, 1, 2, 7, 8], "seper": 1, "sequenc": [0, 1, 7, 8], "serial": [2, 8], "serializ": 0, "seriou": 0, "serv": 0, "server": [0, 1], "servercertif": 1, "servercertificatesquota": 1, "servic": [0, 8], "service_role_usag": [0, 1], "servicelimit": 1, "servicemetr": 1, "servicetaskdefinitionfilt": 1, "sessioncontext": 1, "sessionissu": 1, "set": [0, 1, 2, 3, 4], "set_activ": 0, "set_annot": 1, "setgid": 2, "setuid": 2, "setup": 1, "sever": [0, 1, 2, 4, 8], "sg": 1, "sg_unus": 1, "sgdefaultvpc": 1, "sgusag": [0, 1], "sgusagemixin": [0, 1], "sha256": 1, "sha384": 1, "shadow": 0, "shake": 7, "shake_hand": 7, "share": 1, "shell": [2, 8], "shield": 0, "shield_protect": [0, 1], "shield_subscript": [0, 1], "shielden": [0, 1], "shieldenabledmixin": [0, 1], "shop": 1, "short": [0, 7], "shorthand": [0, 1], "should": [0, 1, 4, 8], "show": [0, 2, 3, 7], "shown": 0, "shrink": 1, "si": 1, "sid": 1, "sign": [0, 8], "signatur": 7, "signifi": 1, "significantli": 6, "signingcertificatesperuserquota": 1, "silenc": [0, 1], "silent": [0, 4, 7], "similar": [0, 1, 2, 7], "similarli": [0, 1], "simpl": [0, 4, 8], "simpledb": 1, "simpler": [0, 1], "simpli": [0, 7], "simplifi": 0, "sinc": [0, 1, 2], "singl": [0, 1, 2, 4, 7], "single_bool": 0, "single_byt": 0, "single_doubl": 0, "single_dur": 0, "single_fixed32": 0, "single_fixed64": 0, "single_float": 0, "single_int32": 0, "single_int64": 0, "single_sfixed32": 0, "single_sfixed64": 0, "single_sint32": 0, "single_sint64": 0, "single_str": 0, "single_timestamp": 0, "single_uint32": 0, "single_uint32_wrapp": 0, "single_uint64": 0, "singledispatch": 7, "singlehtml": 4, "singleton": [0, 5, 7], "singletonfilt": 1, "singular": 0, "situat": 1, "size": [0, 1, 7], "size_parse_cidr": [0, 1], "skew": 1, "skew_hour": 1, "skier": 1, "skip": 0, "skipkei": 0, "slight": [1, 7], "slightli": [0, 1, 7, 8], "slighyli": 7, "slower": 1, "slowli": 4, "slurp": [0, 2], "sm": 1, "small": 7, "smaller": 0, "smarter": 8, "smi": 1, "sn": [0, 1], "snapshot": 0, "snapshotag": 1, "snapshotcreatetim": 1, "snapshotcrossaccountaccess": 1, "snapshotid": 1, "snapshotskipamisnapshot": 1, "snapshottyp": 1, "snapshotunusedfilt": [0, 1], "snapshotunusedmixin": [0, 1], "snowbal": 1, "snscrossaccount": [0, 1], "snscrossaccountmixin": [0, 1], "so": [0, 7], "socket": 2, "some": [0, 1, 2, 3, 7, 8], "some_activ": 0, "some_dict": 0, "some_str": 0, "someparam": 1, "someth": [0, 1], "sometim": [0, 7], "somev": 1, "somewhat": [0, 7, 8], "sophist": [0, 7], "sort": 7, "sort_kei": 0, "sourc": [0, 4, 7], "source_data": 0, "source_text": 0, "sourcedestcheck": 1, "sourceforg": 0, "span": 1, "sparingli": 1, "spawn": 1, "spec": [0, 1, 2, 4], "special": [0, 1, 7], "specif": [0, 3, 4, 5, 7, 8], "specifi": 1, "specificaiton": 4, "specificiamrolemanagedpolici": 1, "speed": 6, "spell": 1, "sphinx": 4, "spin": 1, "spite": 7, "spread": [0, 2], "sprintf": 7, "sq": 1, "sql": 1, "sqlserveraudit": 1, "sqscrossaccount": 1, "squar": 1, "src": 4, "sriovnetsupport": 1, "ssd": 1, "ssh": 1, "sslnegot": 1, "sslpolici": 1, "sslpolicyfilt": 1, "sslv2": 1, "sslv3": 1, "ssmstatu": 1, "st": 1, "st_atim": 2, "st_birthtim": 2, "st_blksize": 2, "st_block": 2, "st_ctime": 2, "st_dev": 2, "st_flag": 2, "st_gen": 2, "st_ino": 2, "st_mtime": 2, "st_nlink": 2, "st_rdev": 2, "st_size": 2, "stack": [0, 1], "stage": 1, "stand": [0, 1, 8], "standalon": 4, "standard": [0, 1, 2, 7], "start": [0, 1, 3, 4, 7, 8], "startswith": 7, "starttim": [0, 1], "stat": [0, 2], "state": [0, 7], "statement": [0, 7, 8], "statement_id": 1, "statetransitionag": 1, "stati": 2, "static": 0, "statist": [0, 1], "statu": [0, 5], "status": [0, 1], "stdin": [0, 2], "stdout": 0, "stem": 4, "step": [0, 1, 5, 7], "sticki": 2, "still": [0, 2], "stop": 1, "storag": 1, "store": 1, "str": [0, 1, 4, 8], "stream": [0, 1], "streamhandl": 3, "strict": 0, "strictli": 0, "string": [0, 1, 2, 4, 7], "string_ext": 4, "string_greet_str": 7, "string_lit": 0, "string_valu": 0, "stringtyp": [0, 7, 8], "stringvalu": 0, "strip": 1, "strong": 1, "strongli": 1, "struct": 0, "structpb": 0, "structur": [0, 1, 7, 8], "studi": 1, "stuff": 7, "sub": [0, 1, 7], "sub_activ": 0, "sub_ev": 0, "sub_eval_parti": 0, "sub_evalu": 0, "subclass": [0, 1, 7, 8], "subclss": 0, "sublanguag": 1, "subnet": 0, "subnet_id": 0, "subnetfilt": 1, "subnetid": 1, "subnetrout": 1, "subscript": 1, "subsequ": [0, 1], "subset": [0, 8], "subsidiari": 0, "subst": [0, 1], "substanti": 7, "substitut": 0, "subtl": 0, "succesfulli": 1, "success": [0, 1, 7], "successfulli": 0, "suffic": 1, "suffix": [0, 1], "sugar": 0, "suggest": 1, "suit": [1, 4], "suitabl": 1, "sum": 1, "summari": 5, "sun": 1, "super": [0, 1], "superclass": [0, 1], "supertyp": 8, "supplement": 0, "suppli": [0, 2], "support": [0, 1, 2, 4, 8], "sure": 1, "survei": 1, "suspend": 1, "suspendedprocess": 1, "swallow": 0, "swap": 1, "symbol": 2, "synopsi": 5, "syntact": 0, "syntax": [0, 1, 2, 7, 8], "system": [0, 5], "t": [0, 1, 2, 4, 7, 8], "tab": 0, "tabl": 1, "tag": [0, 4, 7], "tag_polici": 7, "tag_policy_filt": 7, "tag_valu": 0, "tags_for": 4, "tagstatu": 1, "tailor": 0, "take": [0, 1], "take_act": 7, "taken": [1, 7], "tangl": 8, "target": [0, 4], "target_engin": 1, "targetfunc": 0, "targetgroup": 1, "tasktaskdefinitionfilt": 1, "tb": 0, "tbd": 0, "team_nam": 1, "tech": 1, "temp": 1, "templat": [0, 1], "temporari": [0, 8], "ten": 8, "tend": 0, "ters": 1, "tertiari": 0, "test": [0, 1, 2, 4, 7, 8], "test_all_typ": 0, "test_c7nlib": 0, "testabl": 1, "testalltyp": 0, "testdata": 4, "texinfo": 4, "text": [0, 1, 2, 4, 8], "text2": 0, "text_from": [0, 1], "textproto": 4, "than": [0, 1, 2, 5, 7], "the_activ": 0, "the_filt": [0, 1], "thei": [0, 1, 7, 8], "them": [0, 1, 2, 4], "thi": [0, 1, 2, 3, 4, 5, 6, 7, 8], "thing": [0, 1, 8], "think": 0, "thirti": 1, "those": [0, 1, 3, 7], "three": [0, 1, 5, 7, 8], "threshold": 1, "through": [0, 1, 4], "tidi": 8, "tidyup": 1, "time": [0, 1, 2, 7], "timedelta": [0, 1, 8], "timestamp": [0, 1, 4, 7], "timestamptyp": [0, 1, 7, 8], "timezon": [0, 1, 7], "tini": 2, "titl": 1, "titlecas": 0, "tl": 1, "tlq9fr": 1, "tls12": 1, "tlsv1": 1, "to_python": 0, "todo": 1, "token": 0, "toler": 0, "toml": [2, 3], "too": [0, 8], "tool": [5, 6], "top": [0, 1, 4, 8], "topic": [1, 2, 5], "tot": 2, "total": [1, 2], "toward": 0, "tox": 4, "tp": 0, "tp1": 0, "tp2": 0, "tpb": 0, "trace": [0, 2, 3], "traceback": [0, 7], "tracebacktyp": 0, "track": [0, 7], "tradit": [0, 2], "traffic": 1, "trail": 1, "transact": 7, "transform": [0, 1, 4, 7], "transient": [0, 8], "transit": 1, "translat": [0, 1], "transpar": 0, "transpil": [0, 3, 5], "transpilertre": 0, "travers": 1, "treat": [0, 2], "tree": [0, 4, 7, 8], "tree_class": 0, "tree_dump": 0, "tree_for_express": 0, "tree_for_vari": 0, "tree_node_class": 0, "tri": 1, "trigger": 1, "trim": [0, 1], "tripl": 0, "trivial": [0, 1], "troublingli": 1, "true": [0, 1, 2, 3, 7], "truncat": 0, "trust": 1, "truthi": 0, "try": [0, 7], "tupl": 0, "turn": [0, 1], "tweet": 7, "two": [0, 1, 2, 7, 8], "txt": [0, 1], "typ": 0, "type": [1, 4, 5], "type_deduct": 4, "type_match": 0, "type_nam": 0, "type_schema": 1, "typeerror": 0, "typetyp": [0, 8], "tz": [0, 1, 7], "tz_alias": [0, 1], "tz_name": 0, "tz_name_lookup": 0, "tz_offset_pars": 0, "tz_pars": 0, "tzinfo": [0, 1], "tzutc": 1, "u": [0, 1, 7], "u0001f431": 0, "u270c": 0, "ubuntu": 1, "uint": 0, "uint32": 0, "uint32valu": 0, "uint64": 0, "uint64_overflow_neg": 0, "uint64_overflow_posit": 0, "uint64_valu": [0, 4], "uint64valu": 0, "uint_lit": 0, "uinttyp": [0, 4, 7, 8], "uk": 1, "unari": 0, "unary_minus_no_overload": 0, "unary_neg": 0, "unary_not": 0, "unchosen": 0, "uncomput": 7, "undecid": 0, "undeclar": 0, "under": 1, "underli": 8, "understand": 8, "underutil": 1, "unencrypt": 1, "unifi": [0, 1], "uniform": 2, "union": [0, 1, 8], "uniqu": [0, 1, 8], "unique_s": [0, 1], "unit": 0, "unittest": 0, "unknown": 4, "unless": 1, "unlik": 0, "unmark": 1, "unmodifi": 1, "unoptim": 1, "unsign": [0, 8], "unsupport": 0, "untag": 1, "until": 0, "unus": 0, "unusediampolici": 1, "unusediamrol": [0, 1], "unusedinstanceprofil": [0, 1], "unusedlaunchconfig": [0, 1], "unusedrdssubnetgroup": [0, 1], "unusedsecuritygroup": [0, 1], "unusu": 1, "unwieldi": 1, "up": [0, 1, 6], "upcom": [0, 1], "updat": [0, 1, 4], "upgradeavail": 1, "upper": 0, "uptimefilt": 1, "uri": 0, "url": [0, 1, 4], "us": [0, 3, 4, 5, 6, 8], "usabl": [0, 8], "usag": [1, 2], "usediampolici": 1, "usediamrol": 1, "usedinstanceprofil": 1, "usedsecuritygroup": 1, "user": 3, "user_access": 2, "user_creation_tim": 1, "useraccesskei": 1, "userag": 1, "usercredentialreport": 1, "userdata": 1, "userdatafilt": 1, "userguid": 1, "userid": 2, "userident": 1, "usermfadevic": 1, "usernam": 1, "userpolici": 1, "userpolicysizequota": 1, "usersquota": 1, "usual": 0, "utc": [0, 7], "utcnow": [0, 1], "util": 1, "uv": [4, 6], "v": [0, 2, 4], "v8": 4, "val": 7, "valid": [0, 4], "valid_key_typ": 0, "validconfigfilt": 1, "valu": [2, 3, 4, 7, 8], "value_typ": 0, "valueerror": 0, "valuefilt": 1, "valuekv": 1, "values_from": 1, "valuesfrom": 0, "var": [0, 7], "vari": 1, "variabl": [0, 1, 3, 5, 7, 8], "variant": [0, 1, 7], "variat": 1, "varieti": [0, 8], "variou": [0, 1, 2, 8], "vault": 1, "ve": [2, 7], "verbos": 4, "veri": [0, 1, 3, 4, 8], "verifi": 1, "version": [0, 1, 3, 4, 7], "versionsperpolicyquota": 1, "via": [0, 1, 7, 8], "viabl": 0, "view": 8, "virtual": 6, "visibl": 0, "visit": [0, 8], "visit_children": 0, "visitor": 0, "visual": 7, "vm": 1, "vol": 1, "volum": 1, "volumeid": 1, "volumin": 2, "vpc": 0, "vpc_id": 0, "vpcconfig": 1, "vpce": 0, "vpcendpoint": 1, "vpcfilter": [0, 1], "vpcid": 1, "vpcidfilt": 1, "vpclink": 1, "vpcsecuritygroupfilt": [0, 1], "vpcsubnetfilt": 0, "vpn": 1, "w": [1, 2], "wa": [0, 1, 7], "wafen": 1, "wai": [0, 1, 2, 7], "wait": 1, "walk": [0, 8], "want": [0, 1, 2, 7], "warn": [0, 1, 3], "watch": 1, "we": [0, 1, 2, 7, 8], "web": 1, "web_acl": [0, 1], "webacl": 1, "week": 1, "weekdai": 1, "weekend": 1, "weekli": 1, "well": [0, 1, 2, 7, 8], "west": 1, "what": [0, 2, 7], "when": [0, 1, 2, 4, 6, 7, 8], "where": [0, 1, 2, 4, 6, 8], "wherea": 8, "whether": [0, 1, 7], "which": [0, 1, 4, 7, 8], "while": [0, 1, 2, 7, 8], "whitelist": 1, "whitelist_condit": 1, "whitelist_endpoint": 1, "whitelist_endpoints_from": 1, "whitelist_from": 1, "whitelist_orgid": 1, "whitelist_orgids_from": 1, "whitelist_protocol": 1, "whitelist_protocols_from": 1, "whitelist_vpc": 1, "whitelist_vpc_from": 1, "whitelist_vpce_from": 1, "who": 1, "whole": [5, 7, 8], "whose": 1, "why": [0, 2], "wide": [1, 8], "width": 0, "win": 1, "window": [1, 7], "wip": 4, "wire": 1, "with_traceback": 0, "withdraw": 7, "within": [0, 1, 4, 7], "without": [0, 1, 2, 3, 7, 8], "won": 0, "work": [0, 1, 4, 7, 8], "workabl": 1, "worker": 1, "workflow": 1, "world": [0, 7], "woth": 8, "would": [0, 1, 7], "wrap": [0, 7, 8], "wrapper": [0, 4], "wrapperspb": 0, "wrire": 0, "write": [2, 4], "write_acp": 1, "writen": 1, "written": 4, "wrt": 1, "www": [0, 1, 4], "x": [0, 1, 2], "x_sign": 0, "xml": 4, "xrayencrypt": 1, "xyz": 1, "y": [0, 1, 4], "yaml": 7, "ye": [1, 2], "yeah": 0, "yet": 8, "yield": [0, 1], "you": [0, 1, 2, 4, 7], "your": [1, 7], "yyyi": 1, "z": [0, 1], "z0": 0, "za": [0, 1], "zero": [0, 2, 4], "zerodivisionerror": 0, "zone": [0, 1, 7], "\u00b5": 0}, "titles": ["API Reference", "C7N Functions Required", "CLI Use of CEL-Python", "Configuration", "Development Tools", "Pure Python Google Common Expression Language (CEL)", "Installation", "Application Integration", "Architecture and Design"], "titleterms": {"The": [0, 4, 8], "__main__": 0, "access": 1, "account": 1, "adapt": 0, "addit": 0, "ag": 1, "alia": 1, "all": 1, "allow": 1, "ami": 1, "api": [0, 7], "applic": 7, "architectur": 8, "argument": 2, "attribut": 1, "avail": 1, "baselin": 7, "bind": 7, "block": 1, "bool": 1, "boolean": 1, "bucket": 1, "builtin": 7, "bulk": 7, "c7n": [0, 1, 7], "c7nlib": 0, "cach": 1, "capac": 1, "cel": [2, 5, 8], "celfilt": 1, "celpars": 0, "celpi": 0, "celtyp": 0, "check": 1, "cidr": 1, "cli": 2, "cloud": 7, "cloudtrail": 1, "common": [1, 5], "compil": 8, "complianc": 1, "compon": 8, "concurr": 1, "config": 1, "configur": [2, 3], "construct": 1, "contain": 8, "content": [1, 5], "context": [0, 1, 8], "convers": 1, "count": 1, "credenti": 1, "cross": 1, "custodian": 7, "custom": 7, "data": 1, "db": 1, "default": 1, "defin": 7, "definit": 1, "delta": 1, "descript": [2, 4], "design": [1, 8], "detail": 0, "develop": 4, "devic": 1, "dhcp": 1, "diff": 1, "directori": 4, "doc": 4, "document": 5, "dot": 8, "eb": 1, "egress": 1, "enabl": 1, "encrypt": 1, "environ": 2, "ephemer": 1, "error": 7, "essenti": 7, "evalu": [0, 8], "event": 1, "exampl": [1, 2, 4, 7], "except": 7, "exit": 2, "express": 5, "extern": [1, 7], "fault": 1, "featur": [0, 4], "file": [2, 4], "filter": [1, 7], "find": 1, "flow": 1, "from": 7, "function": [0, 1, 7], "gherkin": 4, "global": [1, 7], "go": 7, "googl": 5, "grant": 1, "group": 1, "ha": 1, "health": 1, "healthcheck": 1, "i": 1, "iam": 1, "id": 1, "imag": 1, "implement": [1, 7], "indic": 5, "ingress": 1, "inlin": 1, "instal": 6, "instanc": 1, "integr": [1, 5, 7], "invalid": 1, "inventori": 1, "kei": 1, "km": 1, "languag": 5, "last": 1, "latest": 1, "launch": 1, "lifecycl": 1, "limit": 1, "listen": 1, "locat": 1, "lock": 1, "log": 1, "makefil": 4, "manag": 1, "mark": 1, "member": 8, "method": 1, "metric": 1, "mfa": 1, "mismatch": 1, "miss": [1, 8], "modify": 1, "more": 7, "name": [0, 8], "namespac": 2, "network": 1, "non": 1, "notif": 1, "numer": 0, "object": [0, 1], "offhour": 1, "onhour": 1, "op": 1, "option": 1, "origin": 1, "overview": 5, "param": 1, "paramet": 1, "password": 1, "polici": 1, "principl": 1, "product": 8, "progag": 1, "project": 4, "protect": 1, "protocol": 1, "provid": 0, "public": 1, "pure": 5, "py": 4, "python": [2, 5], "queri": 1, "refer": 0, "requir": 1, "reserv": 1, "resolut": 0, "resourc": 7, "rest": 1, "rotat": 1, "rout": 1, "rule": 1, "s3": 1, "secur": 1, "servic": 1, "shadow": 1, "shield": 1, "simpl": 7, "singleton": 1, "skip": 1, "snapshot": 1, "sourc": 1, "specif": 1, "ssl": 1, "ssm": 1, "stale": 1, "state": 1, "statement": 1, "statu": [1, 2], "step": 4, "subnet": 1, "summari": 1, "synopsi": [2, 4], "tabl": 5, "tag": 1, "target": 1, "task": 1, "termin": 1, "time": 8, "timzon": 0, "todo": 0, "toler": 1, "tool": 4, "transpil": 8, "type": [0, 2, 7, 8], "unus": 1, "upgrad": 1, "uptim": 1, "us": [1, 2, 7], "user": 1, "valid": 1, "valu": [0, 1], "value_from": [0, 1], "value_typ": 1, "variabl": 2, "virtual": 1, "vpc": 1, "waf": 1, "write": 1, "xrai": 1}}) \ No newline at end of file diff --git a/docs/build/html/structure.html b/docs/build/html/structure.html index 58b3843..dab80bb 100644 --- a/docs/build/html/structure.html +++ b/docs/build/html/structure.html @@ -7,7 +7,7 @@ Architecture and Design — CEL in Python documentation - + @@ -499,7 +499,7 @@

        Related Topics

        ©2020, CapitalOne. | - Powered by Sphinx 8.2.3 + Powered by Sphinx 8.1.3 & Alabaster 1.0.0 | diff --git a/docs/source/conf.py b/docs/source/conf.py index 7009f0b..1a4b981 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -11,12 +11,10 @@ # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -# -# import os -# import sys -# sys.path.insert(0, os.path.abspath('.')) +# documentation root, use pathlib.Path.absolute() to make it absolute. +import sys from pathlib import Path +sys.path.insert(0, str(Path('../../tools').absolute())) # -- Project information ----------------------------------------------------- @@ -35,6 +33,7 @@ 'sphinx.ext.viewcode', 'sphinx.ext.todo', 'sphinxcontrib.plantuml', + 'sphinxcontrib.programoutput' ] # Add any paths that contain templates here, relative to this directory. @@ -43,7 +42,7 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. -exclude_patterns = [] +exclude_patterns: list[str] = [] # -- Options for HTML output ------------------------------------------------- @@ -56,7 +55,7 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path: list[str] = [] # -- Options for Autodoc ----------------------------------------------------- diff --git a/docs/source/development.rst b/docs/source/development.rst index 02a00f3..a4c89fd 100644 --- a/docs/source/development.rst +++ b/docs/source/development.rst @@ -19,141 +19,18 @@ Any changes must be reflected (manually) by revising the lark version of the EBN The test cases present a more challenging problem. -A tool, ``pb2g.py``, converts the test cases from Protobuf messages to Gherkin scenarios. +A tool, ``gherkinize.py``, converts the test cases from Protobuf messages to Gherkin scenarios. -.. uml:: +The ``gherkinize.py`` Tool +========================== - @startuml +.. automodule:: gherkinize + :no-members: + :members: Config - file source as "source protobuf test cases" - file features as "Gherkin feature files" - source --> [pb2g.py] - [pb2g.py] --> [Docker] : "Uses" - [Docker] ..> [mkgherkin.go] : "Runs" - [pb2g.py] --> features - @enduml - - -The pb2g Tool -============== - -The ``pb2g.py`` Python application converts a protobuf test case collection into a Gherkin Feature file. -These can be used to update the ``features`` directory. - -SYNOPSIS ---------- - -.. program:: python tools/pb2g.py [-g docker|local] [-o output] [-sv] source - -.. option:: -g , --gherkinizer , --output - - Where to write the feature file. - Generally, it's helpful to have the ``.textproto`` and ``.feature`` stems match. - The ``Makefile`` assures this. - -.. option:: -s, --silent - - No console output is produced - -.. option:: -v, --verbose - - Verbose debugging output on the console. - -.. option:: source - - A source ``.textproto`` file. - This is often the path to a file in a local download of https://github.com/google/cel-spec/tree/master/tests/simple/testdata. - - A URL for the source is **not** supported. - - -DESCRIPTION ------------ - -Convert one ``.textproto`` file to a Gherkin ``.feature`` file. -There are two steps to the conversion: - -1. Rewrite the ``.textproto`` into JSON. - This relies on common Go libraries, and is little more than a syntactic conversion. - -2. Rewrite the JSON copy of the ``.textproto`` into Gherkin. - This a little more fraught with special cases and exceptions. - The ``.textproto`` semantics can be confusing. - -FILES ------ - -:source: - A ``.textproto`` test case file from the CEL-spec repository. - -:output: - A ``.feature`` file with the same stem as the source file is written to the output directory. - ``basic.textproto`` will create ``basic.feature``. - -:interim: - An interim JSON-format file is created and deleted. - These are only visible in the event of a fatal error creating the Gherkin output. - -EXAMPLES --------- - -The ``basic.textproto`` starts like this: - -.. code-block:: protobuf - - name: "basic" - description: "Basic conformance tests that all implementations should pass." - section { - name: "self_eval_zeroish" - description: "Simple self-evaluating forms to zero-ish values." - test { - name: "self_eval_int_zero" - expr: "0" - value: { int64_value: 0 } - } - test { - name: "self_eval_uint_zero" - expr: "0u" - value: { uint64_value: 0 } - } - -The Feature file created looks like this: - -.. code-block:: gherkin - - Feature: basic - Basic conformance tests that all implementations should pass. - - # self_eval_zeroish -- Simple self-evaluating forms to zero-ish values. - - Scenario: self_eval_int_zero - - When CEL expression "0" is evaluated - # int64_value:0 - Then value is IntType(source=0) - - - Scenario: self_eval_uint_zero - - When CEL expression "0u" is evaluated - # uint64_value:0 - Then value is UintType(source=0) - -The source files have a "section" heading which doesn't have a precise parallel in the Gherkin language. -The sections become comments in the Feature file. +The ``features/steps`` Directory +================================ The ``features/steps`` directory has step definition modules that implement the ``Given``, ``When``, and ``Then`` clauses. @@ -168,62 +45,18 @@ The ``features/steps`` directory has step definition modules that implement the .. py:module:: features.steps.integration_binding - Provides step definitions for the features generated by the ``pb2g.py`` tool. + Provides step definitions for the features generated by the ``gherkinize.py`` tool. The ``features/Makefile`` ========================= This Makefile has the following targets: -:%.textproto: - This copies textproto files from the source directory - to the ``features`` directory. - The source is defined by the :envvar:`CEL_SIMPLE_TESTDATA` environment variable. - This will overwrite out-of-date files in the ``features`` directory. - - It's important to use **git** wisely and start with a clean branch of the project so changes can be rolled back. - -:%.feature: - This creates the ``.feature`` file from the ``.textproto`` file. - -:scan: - This phony target reads **all** of the ``.textproto`` files to be sure they can be converted to Gherkin. - If it concludes with the output ``"All files scanned successfully"``, then there are no surprising or unexpected features in the ``.textproto`` files. - -:clean-broken: - This phony target removes empty ``.feature`` files that may be left over when the conversion process crashes with a fatal error. - -:clean-features: - This phony target removes all of the ``.textproto``\ -based ``.feature`` files. - Manually created ``.feature`` files are left intact. - -:clean: - This phony target removes all ``.textproto`` and ``.feature`` files that are built from the CEL specification. - Manually created ``.feature`` files are left intact. +.. program-output:: make -C ../../features help Currently, the following feature files are built from the CEL specification. -.. code-block:: bash - - basic.feature - comparisons.feature - conversions.feature - dynamic.feature - enums.feature - fields.feature - fp_math.feature - integer_math.feature - lists.feature - logic.feature - macros.feature - namespace.feature - parse.feature - plumbing.feature - proto2.feature - proto3.feature - string.feature - timestamps.feature - unknowns.feature +.. program-output:: make -C ../../features conformance-feature-list The ``docs/Makefile`` ===================== @@ -231,58 +64,11 @@ The ``docs/Makefile`` This is a Sphinx ``Makefile`` to build documentation. For more information, see https://www.sphinx-doc.org/en/master/index.html +.. program-output:: make -C ../ help + The Project ``Makefile`` -========================= +======================== A top-level Makefile has a number of phony targets: -:build: - Runs ``uv build`` to create a distribution kit. - -:install-tools: - Pulls a ``golang`` Docker image and builds the ``mkgherkin`` image. - -:test: - Runs the Python 3.12 test environment to execute a quick test. - -:test-all: - Update the ``features`` files and run the full test suite. - -:test-wip: - Update the ``features`` files and run the WIP test environment -- these are tests flagged with @WIP markers. - -:test-tools: - Run a test of only the tools, then scan the ``features`` files to be sure they're still valid after the tool change. - -:docs: - Build the HTML documentation. - -:lint: - Runs the ``lint`` test environment to get code coverage, type hint checking, and other lint checks. - -:coverage: - Reproduce the most recent coverage report. - -:clean: - Remove a number of directories and their files: - - - ``.tox`` - - - ``.Python`` - - - ``bin`` - - - ``include`` - - - ``lib`` - - - ``pip-selfcheck`` - - - ``.json`` - -:benchmarks: - Run the applications in the ``benches`` directory to gather performance benchmark data. - - - ``large_resource_set.py`` - - - ``complex_expression.py`` +.. program-output:: make -C ../../ help diff --git a/features/Makefile b/features/Makefile index 379e941..e30b308 100644 --- a/features/Makefile +++ b/features/Makefile @@ -17,18 +17,28 @@ # Either have https://github.com/google/cel-spec checked out adjacent to cel-python # OR set CEL_SPEC_PATH to be location of the cel-spec project. +HELP_TEXT := "" +HELP_TEXT += "Available commands:\n" + +.PHONY: help +help: + @echo $(HELP_TEXT) + HERE := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) TOOLS = $(HERE)../tools -CEL_SPEC_PATH ?= $(HERE)../../cel-spec +CEL_SPEC_PATH ?= $(HERE)../../../google/cel-spec CEL_SIMPLE_TESTDATA ?= $(CEL_SPEC_PATH)/tests/simple/testdata # This is most -- but not all -- the feature files. # Some are built manually. These are built from textproto files. FEATURES = \ basic.feature \ + bindings_ext.feature \ + block_ext.feature \ comparisons.feature \ conversions.feature \ dynamic.feature \ + encoders_ext.feature \ enums.feature \ fields.feature \ fp_math.feature \ @@ -36,14 +46,21 @@ FEATURES = \ lists.feature \ logic.feature \ macros.feature \ + macros2.feature \ + math_ext.feature \ namespace.feature \ + optionals.feature \ parse.feature \ plumbing.feature \ proto2.feature \ + proto2_ext.feature \ proto3.feature \ string.feature \ + string_ext.feature \ timestamps.feature \ - unknowns.feature + type_deduction.feature \ + unknowns.feature \ + wrappers.feature SOURCES := $(patsubst %.feature,%.textproto,$(FEATURES)) @@ -54,36 +71,25 @@ SOURCES := $(patsubst %.feature,%.textproto,$(FEATURES)) all : $(FEATURES) -# Copy the textproto from the cel-spec directory to keep our reference copy. +HELP_TEXT += " %.textproto copies the .textproto from the cel-spec directory\n" %.textproto : $(CEL_SIMPLE_TESTDATA)/%.textproto cp $(CEL_SIMPLE_TESTDATA)/$@ $@ -# Create Gherkin from the textproto serialization. +HELP_TEXT += " %.feature generates Gherkin feature from %.textproto source\n" %.feature : %.textproto - python $(TOOLS)/pb2g.py $^ -o $@ - -# Run the lark scanner to be sure the grammar works for *all* of the textproto files. -# This is necessary because we don't have a full textproto implementation. -scan : $(SOURCES) - @python $(TOOLS)/pb2g.py - @for name in $(SOURCES); do \ - python $(TOOLS)/pb2g.py $$name >/dev/null; \ - done - @echo "\nAll files scanned successfully" - -# When the grammar was incomplete, we sometimes had empty .feature files. -# It helps to remove them before rerunning. -clean-broken: - @for name in $(FEATURES); do \ - if [ -f $$name -a ! -s $$name ]; then \ - echo empty $$name; \ - rm $$name; \ - fi; \ - done + uv run $(TOOLS)/gherkinize.py -v $^ -o $@ +HELP_TEXT += " clean cleans generated feature files\n" +.PHONY: clean-features clean-features: rm $(FEATURES) +HELP_TEXT += " clean cleans generated feature files and textproto sources\n" +.PHONY: clean clean: rm $(FEATURES) rm $(SOURCES) + +.PHONY: conformance-feature-list +conformance-feature-list: + @$(foreach file, $(FEATURES), echo $(file);) diff --git a/features/README.rst b/features/README.rst index 90ee2e8..57015a8 100644 --- a/features/README.rst +++ b/features/README.rst @@ -5,10 +5,10 @@ Acceptance Test Suite We start with https://github.com/google/cel-spec/tree/master/tests/simple/testdata as the acceptance test suite. -These files are captured as of commit 7e251cc. -This is from Nov 18, 2020, version 0.5.0. +These files are captured as of commit 9f069b3e. +This is from May 5, 2025, version 0.24.0. -We parse the Text serialization of protobuf files to create Gherkin test specifications +We parse the text serialization of protobuf files to create Gherkin test scenarios. See https://github.com/google/cel-go/blob/master/test/proto3pb/test_all_types.proto for the ``TestAllTypes`` protobuf definition that some tests expect to be present. @@ -21,16 +21,16 @@ Run behave. :: - PYTHONPATH=src behave features + PYTHONPATH=src uv run behave features To run a subset, pick a feature file. :: - PYTHONPATH=src behave features/basic.feature + PYTHONPATH=src uv run behave features/basic.feature Building the Conformance Test Features ====================================== -The ``tools`` directory has a ``pb2g.py`` application that builds the test suite. +The ``tools`` directory has a ``gherkinize.py`` application that builds the test suite. See the ``tools/README.rst`` for more information. diff --git a/features/basic.feature b/features/basic.feature index d3f40ac..a5d913e 100644 --- a/features/basic.feature +++ b/features/basic.feature @@ -1,324 +1,249 @@ - +@conformance Feature: basic Basic conformance tests that all implementations should pass. -# self_eval_zeroish -- Simple self-evaluating forms to zero-ish values. - -Scenario: self_eval_int_zero - When CEL expression "0" is evaluated - # int64_value:0 - Then value is IntType(source=0) +# self_eval_zeroish -- Simple self-evaluating forms to zero-ish values. +Scenario: self_eval_zeroish/self_eval_int_zero -Scenario: self_eval_uint_zero + When CEL expression '0' is evaluated + Then value is celpy.celtypes.IntType(source=0) - When CEL expression "0u" is evaluated - # uint64_value:0 - Then value is UintType(source=0) +Scenario: self_eval_zeroish/self_eval_uint_zero + When CEL expression '0u' is evaluated + Then value is celpy.celtypes.UintType(source=0) -Scenario: self_eval_float_zero +Scenario: self_eval_zeroish/self_eval_uint_alias_zero - When CEL expression "0.0" is evaluated - # double_value:0 - Then value is DoubleType(source=0) + When CEL expression '0U' is evaluated + Then value is celpy.celtypes.UintType(source=0) +Scenario: self_eval_zeroish/self_eval_float_zero -Scenario: self_eval_float_zerowithexp + When CEL expression '0.0' is evaluated + Then value is celpy.celtypes.DoubleType(source=0.0) - When CEL expression "0e+0" is evaluated - # double_value:0 - Then value is DoubleType(source=0) +Scenario: self_eval_zeroish/self_eval_float_zerowithexp + When CEL expression '0e+0' is evaluated + Then value is celpy.celtypes.DoubleType(source=0.0) -Scenario: self_eval_string_empty +Scenario: self_eval_zeroish/self_eval_string_empty When CEL expression "''" is evaluated - # string_value:"" - Then value is StringType(source='') - + Then value is celpy.celtypes.StringType(source='') -Scenario: self_eval_string_empty_quotes +Scenario: self_eval_zeroish/self_eval_string_empty_quotes When CEL expression '""' is evaluated - # string_value:"" - Then value is StringType(source='') - + Then value is celpy.celtypes.StringType(source='') -Scenario: self_eval_string_raw_prefix +Scenario: self_eval_zeroish/self_eval_string_raw_prefix When CEL expression 'r""' is evaluated - # string_value:"" - Then value is StringType(source='') + Then value is celpy.celtypes.StringType(source='') - -Scenario: self_eval_bytes_empty +Scenario: self_eval_zeroish/self_eval_bytes_empty When CEL expression 'b""' is evaluated - # bytes_value:"" - Then value is BytesType(source=b'') - - -Scenario: self_eval_bool_false + Then value is celpy.celtypes.BytesType(source=b'') - When CEL expression "false" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: self_eval_zeroish/self_eval_bool_false + When CEL expression 'false' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: self_eval_null +Scenario: self_eval_zeroish/self_eval_null - When CEL expression "null" is evaluated - # null_value:NULL_VALUE + When CEL expression 'null' is evaluated Then value is None +Scenario: self_eval_zeroish/self_eval_empty_list -Scenario: self_eval_empty_list - - When CEL expression "[]" is evaluated - # list_value:{} + When CEL expression '[]' is evaluated Then value is [] +Scenario: self_eval_zeroish/self_eval_empty_map -Scenario: self_eval_empty_map - - When CEL expression "{}" is evaluated - # map_value:{} - Then value is MapType({}) + When CEL expression '{}' is evaluated + Then value is celpy.celtypes.MapType({}) - -Scenario: self_eval_string_raw_prefix_triple_double +Scenario: self_eval_zeroish/self_eval_string_raw_prefix_triple_double When CEL expression 'r""""""' is evaluated - # string_value:"" - Then value is StringType(source='') - + Then value is celpy.celtypes.StringType(source='') -Scenario: self_eval_string_raw_prefix_triple_single +Scenario: self_eval_zeroish/self_eval_string_raw_prefix_triple_single When CEL expression "r''''''" is evaluated - # string_value:"" - Then value is StringType(source='') - + Then value is celpy.celtypes.StringType(source='') # self_eval_nonzeroish -- Simple self-evaluating forms to non-zero-ish values. -Scenario: self_eval_int_nonzero - - When CEL expression "42" is evaluated - # int64_value:42 - Then value is IntType(source=42) - +Scenario: self_eval_nonzeroish/self_eval_int_nonzero -Scenario: self_eval_uint_nonzero + When CEL expression '42' is evaluated + Then value is celpy.celtypes.IntType(source=42) - When CEL expression "123456789u" is evaluated - # uint64_value:123456789 - Then value is UintType(source=123456789) +Scenario: self_eval_nonzeroish/self_eval_uint_nonzero + When CEL expression '123456789u' is evaluated + Then value is celpy.celtypes.UintType(source=123456789) -Scenario: self_eval_int_negative_min +Scenario: self_eval_nonzeroish/self_eval_uint_alias_nonzero - When CEL expression "-9223372036854775808" is evaluated - # int64_value:-9223372036854775808 - Then value is IntType(source=-9223372036854775808) + When CEL expression '123456789U' is evaluated + Then value is celpy.celtypes.UintType(source=123456789) +Scenario: self_eval_nonzeroish/self_eval_int_negative_min -Scenario: self_eval_float_negative_exp + When CEL expression '-9223372036854775808' is evaluated + Then value is celpy.celtypes.IntType(source=-9223372036854775808) - When CEL expression "-2.3e+1" is evaluated - # double_value:-23 - Then value is DoubleType(source=-23) +Scenario: self_eval_nonzeroish/self_eval_float_negative_exp + When CEL expression '-2.3e+1' is evaluated + Then value is celpy.celtypes.DoubleType(source=-23.0) -Scenario: self_eval_string_excl +Scenario: self_eval_nonzeroish/self_eval_string_excl When CEL expression '"!"' is evaluated - # string_value:"!" - Then value is StringType(source='!') + Then value is celpy.celtypes.StringType(source='!') +Scenario: self_eval_nonzeroish/self_eval_string_escape -Scenario: self_eval_string_escape + When CEL expression "'\\''" is evaluated + Then value is celpy.celtypes.StringType(source="'") - When CEL expression "'\''" is evaluated - # string_value:"'" - Then value is StringType(source="'") - - -Scenario: self_eval_bytes_escape +Scenario: self_eval_nonzeroish/self_eval_bytes_escape When CEL expression "b'ÿ'" is evaluated - # bytes_value:"ÿ" - Then value is BytesType(source=b'\xc3\xbf') - - -Scenario: self_eval_bytes_invalid_utf8 - - When CEL expression "b'\000\xff'" is evaluated - # bytes_value:"\x00\xff" - Then value is BytesType(source=b'\x00\xff') + Then value is celpy.celtypes.BytesType(source=b'\xc3\xbf') +Scenario: self_eval_nonzeroish/self_eval_bytes_invalid_utf8 -Scenario: self_eval_list_singleitem + When CEL expression "b'\\000\\xff'" is evaluated + Then value is celpy.celtypes.BytesType(source=b'\x00\xff') - When CEL expression "[-1]" is evaluated - # list_value:{values:{int64_value:-1}} - Then value is [IntType(source=-1)] +Scenario: self_eval_nonzeroish/self_eval_list_singleitem + When CEL expression '[-1]' is evaluated + Then value is [celpy.celtypes.IntType(source=-1)] -Scenario: self_eval_map_singleitem +Scenario: self_eval_nonzeroish/self_eval_map_singleitem When CEL expression '{"k":"v"}' is evaluated - # map_value:{entries:{key:{string_value:"k"} value:{string_value:"v"}}} - Then value is MapType({StringType(source='k'): StringType(source='v')}) + Then value is celpy.celtypes.MapType({'k': celpy.celtypes.StringType(source='v')}) +Scenario: self_eval_nonzeroish/self_eval_bool_true -Scenario: self_eval_bool_true + When CEL expression 'true' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "true" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: self_eval_nonzeroish/self_eval_int_hex + When CEL expression '0x55555555' is evaluated + Then value is celpy.celtypes.IntType(source=1431655765) -Scenario: self_eval_int_hex +Scenario: self_eval_nonzeroish/self_eval_int_hex_negative - When CEL expression "0x55555555" is evaluated - # int64_value:1431655765 - Then value is IntType(source=1431655765) + When CEL expression '-0x55555555' is evaluated + Then value is celpy.celtypes.IntType(source=-1431655765) +Scenario: self_eval_nonzeroish/self_eval_uint_hex -Scenario: self_eval_int_hex_negative + When CEL expression '0x55555555u' is evaluated + Then value is celpy.celtypes.UintType(source=1431655765) - When CEL expression "-0x55555555" is evaluated - # int64_value:-1431655765 - Then value is IntType(source=-1431655765) +Scenario: self_eval_nonzeroish/self_eval_uint_alias_hex + When CEL expression '0x55555555U' is evaluated + Then value is celpy.celtypes.UintType(source=1431655765) -Scenario: self_eval_uint_hex +Scenario: self_eval_nonzeroish/self_eval_unicode_escape_four - When CEL expression "0x55555555u" is evaluated - # uint64_value:1431655765 - Then value is UintType(source=1431655765) + When CEL expression '"\\u270c"' is evaluated + Then value is celpy.celtypes.StringType(source='✌') +Scenario: self_eval_nonzeroish/self_eval_unicode_escape_eight -Scenario: self_eval_unicode_escape_four + When CEL expression '"\\U0001f431"' is evaluated + Then value is celpy.celtypes.StringType(source='🐱') - When CEL expression '"\u270c"' is evaluated - # string_value:"✌" - Then value is StringType(source='✌') - - -Scenario: self_eval_unicode_escape_eight - - When CEL expression '"\U0001f431"' is evaluated - # string_value:"🐱" - Then value is StringType(source='🐱') - - -Scenario: self_eval_ascii_escape_seq - - When CEL expression '"\a\b\f\n\r\t\v\"\'\\"' is evaluated - # string_value:"\x07\x08\x0c\n\r\t\x0b\"'\\" - Then value is StringType(source='\x07\x08\x0c\n\r\t\x0b"\'\\') +Scenario: self_eval_nonzeroish/self_eval_ascii_escape_seq + When CEL expression '"\\a\\b\\f\\n\\r\\t\\v\\"\\\'\\\\"' is evaluated + Then value is celpy.celtypes.StringType(source='\x07\x08\x0c\n\r\t\x0b"\'\\') # variables -- Variable lookups. -Scenario: self_eval_bound_lookup +Scenario: variables/self_eval_bound_lookup - # type:{primitive:INT64} - # Given type_env parameter "x" is TypeType(value='INT64') - Given type_env parameter "x" is INT64 + Given type_env parameter "x" is celpy.celtypes.IntType + and bindings parameter "x" is celpy.celtypes.IntType(source=123) + When CEL expression 'x' is evaluated + Then value is celpy.celtypes.IntType(source=123) - # int64_value:123 - Given bindings parameter "x" is IntType(source=123) +Scenario: variables/self_eval_unbound_lookup + An unbound variable should be marked as an error during execution. See + google/cel-go#154 - When CEL expression "x" is evaluated - # int64_value:123 - Then value is IntType(source=123) - - -Scenario: self_eval_unbound_lookup - An unbound variable should be marked as an error during execution. See google/cel-go#154 - When CEL expression "x" is evaluated - # errors:{message:"undeclared reference to 'x' (in container '')"} + Given disable_check parameter is True + When CEL expression 'x' is evaluated Then eval_error is "undeclared reference to 'x' (in container '')" - -Scenario: unbound_is_runtime_error +Scenario: variables/unbound_is_runtime_error Make sure we can short-circuit around an unbound variable. - When CEL expression "x || true" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Given disable_check parameter is True + When CEL expression 'x || true' is evaluated + Then value is celpy.celtypes.BoolType(source=True) # functions -- Basic mechanisms for function calls. -Scenario: binop +Scenario: functions/binop - When CEL expression "1 + 1" is evaluated - # int64_value:2 - Then value is IntType(source=2) + When CEL expression '1 + 1' is evaluated + Then value is celpy.celtypes.IntType(source=2) +Scenario: functions/unbound -Scenario: unbound - - When CEL expression "f_unknown(17)" is evaluated - # errors:{message:"unbound function"} + Given disable_check parameter is True + When CEL expression 'f_unknown(17)' is evaluated Then eval_error is 'unbound function' +Scenario: functions/unbound_is_runtime_error -Scenario: unbound_is_runtime_error - - When CEL expression "f_unknown(17) || true" is evaluated - # bool_value:true - Then value is BoolType(source=True) - + Given disable_check parameter is True + When CEL expression 'f_unknown(17) || true' is evaluated + Then value is celpy.celtypes.BoolType(source=True) # reserved_const -- Named constants should never be shadowed by identifiers. -Scenario: false - - # type:{primitive:BOOL} - # Given type_env parameter "false" is TypeType(value='BOOL') - Given type_env parameter "false" is BOOL - - # bool_value:true - Given bindings parameter "false" is BoolType(source=True) - - When CEL expression "false" is evaluated - # bool_value:false - Then value is BoolType(source=False) - +Scenario: reserved_const/false -Scenario: true + Given type_env parameter "false" is celpy.celtypes.BoolType + and bindings parameter "false" is celpy.celtypes.BoolType(source=True) + When CEL expression 'false' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - # type:{primitive:BOOL} - # Given type_env parameter "true" is TypeType(value='BOOL') - Given type_env parameter "true" is BOOL +Scenario: reserved_const/true - # bool_value:false - Given bindings parameter "true" is BoolType(source=False) + Given type_env parameter "true" is celpy.celtypes.BoolType + and bindings parameter "true" is celpy.celtypes.BoolType(source=False) + When CEL expression 'true' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "true" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: reserved_const/null - -Scenario: null - - # type:{primitive:BOOL} - # Given type_env parameter "null" is TypeType(value='BOOL') - Given type_env parameter "null" is BOOL - - # bool_value:true - Given bindings parameter "null" is BoolType(source=True) - - When CEL expression "null" is evaluated - # null_value:NULL_VALUE + Given type_env parameter "null" is celpy.celtypes.BoolType + and bindings parameter "null" is celpy.celtypes.BoolType(source=True) + When CEL expression 'null' is evaluated Then value is None + diff --git a/features/basic.textproto b/features/basic.textproto index 81fd98d..e52604c 100644 --- a/features/basic.textproto +++ b/features/basic.textproto @@ -1,3 +1,6 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: cel.expr.conformance.test.SimpleTestFile + name: "basic" description: "Basic conformance tests that all implementations should pass." section { @@ -13,6 +16,11 @@ section { expr: "0u" value: { uint64_value: 0 } } + test { + name: "self_eval_uint_alias_zero" + expr: "0U" + value: { uint64_value: 0 } + } test { name: "self_eval_float_zero" expr: "0.0" @@ -87,6 +95,11 @@ section { expr: "123456789u" value: { uint64_value: 123456789 } } + test { + name: "self_eval_uint_alias_nonzero" + expr: "123456789U" + value: { uint64_value: 123456789 } + } test { name: "self_eval_int_negative_min" expr: "-9223372036854775808" @@ -158,6 +171,11 @@ section { expr: "0x55555555u" value: { uint64_value: 1431655765 } } + test { + name: "self_eval_uint_alias_hex" + expr: "0x55555555U" + value: { uint64_value: 1431655765 } + } test { name: "self_eval_unicode_escape_four" expr: '"\\u270c"' diff --git a/features/bindings_ext.feature b/features/bindings_ext.feature new file mode 100644 index 0000000..5c7b178 --- /dev/null +++ b/features/bindings_ext.feature @@ -0,0 +1,37 @@ +@conformance +Feature: bindings_ext + Tests for the bindings extension library. + + +# bind -- + +@wip +Scenario: bind/boolean_literal + + When CEL expression 'cel.bind(t, true, t)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: bind/string_concat + + When CEL expression 'cel.bind(msg, "hello", msg + msg + msg)' is evaluated + Then value is celpy.celtypes.StringType(source='hellohellohello') + +@wip +Scenario: bind/bind_nested + + When CEL expression 'cel.bind(t1, true, cel.bind(t2, true, t1 && t2))' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: bind/macro_exists + + When CEL expression 'cel.bind(valid_elems, [1, 2, 3], [3, 4, 5].exists(e, e in valid_elems))' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: bind/macro_not_exists + + When CEL expression 'cel.bind(valid_elems, [1, 2, 3], ![4, 5].exists(e, e in valid_elems))' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + diff --git a/features/bindings_ext.textproto b/features/bindings_ext.textproto new file mode 100644 index 0000000..3a3d93f --- /dev/null +++ b/features/bindings_ext.textproto @@ -0,0 +1,43 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: cel.expr.conformance.test.SimpleTestFile + +name: "bindings_ext" +description: "Tests for the bindings extension library." +section: { + name: "bind" + test: { + name: "boolean_literal" + expr: "cel.bind(t, true, t)" + value: { + bool_value: true + } + } + test: { + name: "string_concat" + expr: "cel.bind(msg, \"hello\", msg + msg + msg)" + value: { + string_value: "hellohellohello" + } + } + test: { + name: "bind_nested" + expr: "cel.bind(t1, true, cel.bind(t2, true, t1 && t2))" + value: { + bool_value: true + } + } + test: { + name: "macro_exists" + expr: "cel.bind(valid_elems, [1, 2, 3], [3, 4, 5].exists(e, e in valid_elems))" + value: { + bool_value: true + } + } + test: { + name: "macro_not_exists" + expr: "cel.bind(valid_elems, [1, 2, 3], ![4, 5].exists(e, e in valid_elems))" + value: { + bool_value: true + } + } +} diff --git a/features/block_ext.feature b/features/block_ext.feature new file mode 100644 index 0000000..1fbbca9 --- /dev/null +++ b/features/block_ext.feature @@ -0,0 +1,258 @@ +@conformance +Feature: block_ext + Tests for cel.block. + + +# basic -- + +@wip +Scenario: basic/int_add + + When CEL expression 'cel.block([1, cel.index(0) + 1, cel.index(1) + 1, cel.index(2) + 1], cel.index(3))' is evaluated + Then value is celpy.celtypes.IntType(source=4) + +@wip +Scenario: basic/size_1 + + When CEL expression 'cel.block([[1, 2], size(cel.index(0)), cel.index(1) + cel.index(1), cel.index(2) + 1], cel.index(3))' is evaluated + Then value is celpy.celtypes.IntType(source=5) + +@wip +Scenario: basic/size_2 + + When CEL expression 'cel.block([[1, 2], size(cel.index(0)), 2 + cel.index(1), cel.index(2) + cel.index(1), cel.index(3) + 1], cel.index(4))' is evaluated + Then value is celpy.celtypes.IntType(source=7) + +@wip +Scenario: basic/size_3 + + When CEL expression 'cel.block([[0], size(cel.index(0)), [1, 2], size(cel.index(2)), cel.index(1) + cel.index(1), cel.index(4) + cel.index(3), cel.index(5) + cel.index(3)], cel.index(6))' is evaluated + Then value is celpy.celtypes.IntType(source=6) + +@wip +Scenario: basic/size_4 + + When CEL expression 'cel.block([[0], size(cel.index(0)), [1, 2], size(cel.index(2)), [1, 2, 3], size(cel.index(4)), 5 + cel.index(1), cel.index(6) + cel.index(1), cel.index(7) + cel.index(3), cel.index(8) + cel.index(3), cel.index(9) + cel.index(5), cel.index(10) + cel.index(5)], cel.index(11))' is evaluated + Then value is celpy.celtypes.IntType(source=17) + +@wip +Scenario: basic/timestamp + + When CEL expression 'cel.block([timestamp(1000000000), int(cel.index(0)), timestamp(cel.index(1)), cel.index(2).getFullYear(), timestamp(50), int(cel.index(4)), timestamp(cel.index(5)), timestamp(200), int(cel.index(7)), timestamp(cel.index(8)), cel.index(9).getFullYear(), timestamp(75), int(cel.index(11)), timestamp(cel.index(12)), cel.index(13).getFullYear(), cel.index(3) + cel.index(14), cel.index(6).getFullYear(), cel.index(15) + cel.index(16), cel.index(17) + cel.index(3), cel.index(6).getSeconds(), cel.index(18) + cel.index(19), cel.index(20) + cel.index(10), cel.index(21) + cel.index(10), cel.index(13).getMinutes(), cel.index(22) + cel.index(23), cel.index(24) + cel.index(3)], cel.index(25))' is evaluated + Then value is celpy.celtypes.IntType(source=13934) + +@wip +Scenario: basic/map_index + + When CEL expression 'cel.block([{"a": 2}, cel.index(0)["a"], cel.index(1) * cel.index(1), cel.index(1) + cel.index(2)], cel.index(3))' is evaluated + Then value is celpy.celtypes.IntType(source=6) + +@wip +Scenario: basic/nested_map_construction + + When CEL expression 'cel.block([{"b": 1}, {"e": cel.index(0)}], {"a": cel.index(0), "c": cel.index(0), "d": cel.index(1), "e": cel.index(1)})' is evaluated + Then value is celpy.celtypes.MapType({'a': celpy.celtypes.MapType({'b': celpy.celtypes.IntType(source=1)}), 'c': celpy.celtypes.MapType({'b': celpy.celtypes.IntType(source=1)}), 'd': celpy.celtypes.MapType({'e': celpy.celtypes.MapType({'b': celpy.celtypes.IntType(source=1)})}), 'e': celpy.celtypes.MapType({'e': celpy.celtypes.MapType({'b': celpy.celtypes.IntType(source=1)})})}) + +@wip +Scenario: basic/nested_list_construction + + When CEL expression 'cel.block([[1, 2, 3, 4], [1, 2], [cel.index(1), cel.index(0)]], [1, cel.index(0), 2, cel.index(0), 5, cel.index(0), 7, cel.index(2), cel.index(1)])' is evaluated + Then value is [celpy.celtypes.IntType(source=1), [celpy.celtypes.IntType(source=1), celpy.celtypes.IntType(source=2), celpy.celtypes.IntType(source=3), celpy.celtypes.IntType(source=4)], celpy.celtypes.IntType(source=2), [celpy.celtypes.IntType(source=1), celpy.celtypes.IntType(source=2), celpy.celtypes.IntType(source=3), celpy.celtypes.IntType(source=4)], celpy.celtypes.IntType(source=5), [celpy.celtypes.IntType(source=1), celpy.celtypes.IntType(source=2), celpy.celtypes.IntType(source=3), celpy.celtypes.IntType(source=4)], celpy.celtypes.IntType(source=7), [[celpy.celtypes.IntType(source=1), celpy.celtypes.IntType(source=2)], [celpy.celtypes.IntType(source=1), celpy.celtypes.IntType(source=2), celpy.celtypes.IntType(source=3), celpy.celtypes.IntType(source=4)]], [celpy.celtypes.IntType(source=1), celpy.celtypes.IntType(source=2)]] + +@wip +Scenario: basic/select + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(single_int32=5, single_int64=3, oneof_type=NestedTestAllTypes(payload=TestAllTypes(single_int32=8, single_int64=10, map_string_string=['key'], map_int32_int64=[0, 1, 2]))) + When CEL expression 'cel.block([msg.single_int64, cel.index(0) + cel.index(0)], cel.index(1))' is evaluated + Then value is celpy.celtypes.IntType(source=6) + +@wip +Scenario: basic/select_nested_1 + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(single_int32=5, single_int64=3, oneof_type=NestedTestAllTypes(payload=TestAllTypes(single_int32=8, single_int64=10, map_string_string=['key'], map_int32_int64=[0, 1, 2]))) + When CEL expression 'cel.block([msg.oneof_type, cel.index(0).payload, cel.index(1).single_int64, cel.index(1).single_int32, cel.index(2) + cel.index(3), cel.index(4) + cel.index(2), msg.single_int64, cel.index(5) + cel.index(6), cel.index(1).oneof_type, cel.index(8).payload, cel.index(9).single_int64, cel.index(7) + cel.index(10)], cel.index(11))' is evaluated + Then value is celpy.celtypes.IntType(source=31) + +@wip +Scenario: basic/select_nested_2 + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(single_int32=5, single_int64=3, oneof_type=NestedTestAllTypes(payload=TestAllTypes(single_int32=8, single_int64=10, map_string_string=['key'], map_int32_int64=[0, 1, 2]))) + When CEL expression 'cel.block([msg.oneof_type, cel.index(0).payload, cel.index(1).oneof_type, cel.index(2).payload, cel.index(3).oneof_type, cel.index(4).payload, cel.index(5).oneof_type, cel.index(6).payload, cel.index(7).single_bool, true || cel.index(8), cel.index(4).child, cel.index(10).child, cel.index(11).payload, cel.index(12).single_bool], cel.index(9) || cel.index(13))' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: basic/select_nested_message_map_index_1 + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(single_int32=5, single_int64=3, oneof_type=NestedTestAllTypes(payload=TestAllTypes(single_int32=8, single_int64=10, map_string_string=['key'], map_int32_int64=[0, 1, 2]))) + When CEL expression 'cel.block([msg.oneof_type, cel.index(0).payload, cel.index(1).map_int32_int64, cel.index(2)[1], cel.index(3) + cel.index(3), cel.index(4) + cel.index(3)], cel.index(5))' is evaluated + Then value is celpy.celtypes.IntType(source=15) + +@wip +Scenario: basic/select_nested_message_map_index_2 + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(single_int32=5, single_int64=3, oneof_type=NestedTestAllTypes(payload=TestAllTypes(single_int32=8, single_int64=10, map_string_string=['key'], map_int32_int64=[0, 1, 2]))) + When CEL expression 'cel.block([msg.oneof_type, cel.index(0).payload, cel.index(1).map_int32_int64, cel.index(2)[0], cel.index(2)[1], cel.index(3) + cel.index(4), cel.index(2)[2], cel.index(5) + cel.index(6)], cel.index(7))' is evaluated + Then value is celpy.celtypes.IntType(source=8) + +@wip +Scenario: basic/ternary + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(single_int32=5, single_int64=3, oneof_type=NestedTestAllTypes(payload=TestAllTypes(single_int32=8, single_int64=10, map_string_string=['key'], map_int32_int64=[0, 1, 2]))) + When CEL expression 'cel.block([msg.single_int64, cel.index(0) > 0, cel.index(1) ? cel.index(0) : 0], cel.index(2))' is evaluated + Then value is celpy.celtypes.IntType(source=3) + +@wip +Scenario: basic/nested_ternary + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(single_int32=5, single_int64=3, oneof_type=NestedTestAllTypes(payload=TestAllTypes(single_int32=8, single_int64=10, map_string_string=['key'], map_int32_int64=[0, 1, 2]))) + When CEL expression 'cel.block([msg.single_int64, msg.single_int32, cel.index(0) > 0, cel.index(1) > 0, cel.index(0) + cel.index(1), cel.index(3) ? cel.index(4) : 0, cel.index(2) ? cel.index(5) : 0], cel.index(6))' is evaluated + Then value is celpy.celtypes.IntType(source=8) + +@wip +Scenario: basic/multiple_macros_1 + + When CEL expression 'cel.block([[1].exists(cel.iterVar(0, 0), cel.iterVar(0, 0) > 0), size([cel.index(0)]), [2].exists(cel.iterVar(0, 0), cel.iterVar(0, 0) > 1), size([cel.index(2)])], cel.index(1) + cel.index(1) + cel.index(3) + cel.index(3))' is evaluated + Then value is celpy.celtypes.IntType(source=4) + +@wip +Scenario: basic/multiple_macros_2 + + When CEL expression "cel.block([[1].exists(cel.iterVar(0, 0), cel.iterVar(0, 0) > 0), [cel.index(0)], ['a'].exists(cel.iterVar(0, 1), cel.iterVar(0, 1) == 'a'), [cel.index(2)]], cel.index(1) + cel.index(1) + cel.index(3) + cel.index(3))" is evaluated + Then value is [celpy.celtypes.BoolType(source=True), celpy.celtypes.BoolType(source=True), celpy.celtypes.BoolType(source=True), celpy.celtypes.BoolType(source=True)] + +@wip +Scenario: basic/multiple_macros_3 + + When CEL expression 'cel.block([[1].exists(cel.iterVar(0, 0), cel.iterVar(0, 0) > 0)], cel.index(0) && cel.index(0) && [1].exists(cel.iterVar(0, 0), cel.iterVar(0, 0) > 1) && [2].exists(cel.iterVar(0, 0), cel.iterVar(0, 0) > 1))' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: basic/nested_macros_1 + + When CEL expression 'cel.block([[1, 2, 3]], cel.index(0).map(cel.iterVar(0, 0), cel.index(0).map(cel.iterVar(1, 0), cel.iterVar(1, 0) + 1)))' is evaluated + Then value is [[celpy.celtypes.IntType(source=2), celpy.celtypes.IntType(source=3), celpy.celtypes.IntType(source=4)], [celpy.celtypes.IntType(source=2), celpy.celtypes.IntType(source=3), celpy.celtypes.IntType(source=4)], [celpy.celtypes.IntType(source=2), celpy.celtypes.IntType(source=3), celpy.celtypes.IntType(source=4)]] + +@wip +Scenario: basic/nested_macros_2 + + When CEL expression '[1, 2].map(cel.iterVar(0, 0), [1, 2, 3].filter(cel.iterVar(1, 0), cel.iterVar(1, 0) == cel.iterVar(0, 0)))' is evaluated + Then value is [[celpy.celtypes.IntType(source=1)], [celpy.celtypes.IntType(source=2)]] + +@wip +Scenario: basic/adjacent_macros + + When CEL expression 'cel.block([[1, 2, 3], cel.index(0).map(cel.iterVar(0, 0), cel.index(0).map(cel.iterVar(1, 0), cel.iterVar(1, 0) + 1))], cel.index(1) == cel.index(1))' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: basic/macro_shadowed_variable_1 + + Given type_env parameter "x" is celpy.celtypes.IntType + and bindings parameter "x" is celpy.celtypes.IntType(source=5) + When CEL expression 'cel.block([x - 1, cel.index(0) > 3], [cel.index(1) ? cel.index(0) : 5].exists(cel.iterVar(0, 0), cel.iterVar(0, 0) - 1 > 3) || cel.index(1))' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: basic/macro_shadowed_variable_2 + + Given type_env parameter "x" is celpy.celtypes.IntType + and bindings parameter "x" is celpy.celtypes.IntType(source=5) + When CEL expression "['foo', 'bar'].map(cel.iterVar(1, 0), [cel.iterVar(1, 0) + cel.iterVar(1, 0), cel.iterVar(1, 0) + cel.iterVar(1, 0)]).map(cel.iterVar(0, 0), [cel.iterVar(0, 0) + cel.iterVar(0, 0), cel.iterVar(0, 0) + cel.iterVar(0, 0)])" is evaluated + Then value is [[[celpy.celtypes.StringType(source='foofoo'), celpy.celtypes.StringType(source='foofoo'), celpy.celtypes.StringType(source='foofoo'), celpy.celtypes.StringType(source='foofoo')], [celpy.celtypes.StringType(source='foofoo'), celpy.celtypes.StringType(source='foofoo'), celpy.celtypes.StringType(source='foofoo'), celpy.celtypes.StringType(source='foofoo')]], [[celpy.celtypes.StringType(source='barbar'), celpy.celtypes.StringType(source='barbar'), celpy.celtypes.StringType(source='barbar'), celpy.celtypes.StringType(source='barbar')], [celpy.celtypes.StringType(source='barbar'), celpy.celtypes.StringType(source='barbar'), celpy.celtypes.StringType(source='barbar'), celpy.celtypes.StringType(source='barbar')]]] + +@wip +Scenario: basic/inclusion_list + + When CEL expression 'cel.block([[1, 2, 3], 1 in cel.index(0), 2 in cel.index(0), cel.index(1) && cel.index(2), [3, cel.index(0)], 3 in cel.index(4), cel.index(5) && cel.index(1)], cel.index(3) && cel.index(6))' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: basic/inclusion_map + + When CEL expression 'cel.block([{true: false}, {"a": 1, 2: cel.index(0), 3: cel.index(0)}], 2 in cel.index(1))' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: basic/presence_test + + When CEL expression 'cel.block([{"a": true}, has(cel.index(0).a), cel.index(0)["a"]], cel.index(1) && cel.index(2))' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: basic/presence_test_2 + + When CEL expression 'cel.block([{"a": true}, has(cel.index(0).a)], cel.index(1) && cel.index(1))' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: basic/presence_test_with_ternary + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(single_int32=5, single_int64=3, oneof_type=NestedTestAllTypes(payload=TestAllTypes(single_int32=8, single_int64=10, map_string_string=['key'], map_int32_int64=[0, 1, 2]))) + When CEL expression 'cel.block([msg.oneof_type, has(cel.index(0).payload), cel.index(0).payload, cel.index(2).single_int64, cel.index(1) ? cel.index(3) : 0], cel.index(4))' is evaluated + Then value is celpy.celtypes.IntType(source=10) + +@wip +Scenario: basic/presence_test_with_ternary_2 + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(single_int32=5, single_int64=3, oneof_type=NestedTestAllTypes(payload=TestAllTypes(single_int32=8, single_int64=10, map_string_string=['key'], map_int32_int64=[0, 1, 2]))) + When CEL expression 'cel.block([msg.oneof_type, cel.index(0).payload, cel.index(1).single_int64, has(cel.index(0).payload), cel.index(2) * 0, cel.index(3) ? cel.index(2) : cel.index(4)], cel.index(5))' is evaluated + Then value is celpy.celtypes.IntType(source=10) + +@wip +Scenario: basic/presence_test_with_ternary_3 + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(single_int32=5, single_int64=3, oneof_type=NestedTestAllTypes(payload=TestAllTypes(single_int32=8, single_int64=10, map_string_string=['key'], map_int32_int64=[0, 1, 2]))) + When CEL expression 'cel.block([msg.oneof_type, cel.index(0).payload, cel.index(1).single_int64, has(cel.index(1).single_int64), cel.index(2) * 0, cel.index(3) ? cel.index(2) : cel.index(4)], cel.index(5))' is evaluated + Then value is celpy.celtypes.IntType(source=10) + +@wip +Scenario: basic/presence_test_with_ternary_nested + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(single_int32=5, single_int64=3, oneof_type=NestedTestAllTypes(payload=TestAllTypes(single_int32=8, single_int64=10, map_string_string=['key'], map_int32_int64=[0, 1, 2]))) + When CEL expression 'cel.block([msg.oneof_type, cel.index(0).payload, cel.index(1).map_string_string, has(msg.oneof_type), has(cel.index(0).payload), cel.index(3) && cel.index(4), has(cel.index(1).single_int64), cel.index(5) && cel.index(6), has(cel.index(1).map_string_string), has(cel.index(2).key), cel.index(8) && cel.index(9), cel.index(2).key, cel.index(11) == "A", cel.index(10) ? cel.index(12) : false], cel.index(7) ? cel.index(13) : false)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: basic/optional_list + + Given type_env parameter "opt_x" is celpy.celtypes.IntType + and bindings parameter "opt_x" is celpy.celtypes.IntType(source=5) + When CEL expression 'cel.block([optional.none(), [?cel.index(0), ?optional.of(opt_x)], [5], [10, ?cel.index(0), cel.index(1), cel.index(1)], [10, cel.index(2), cel.index(2)]], cel.index(3) == cel.index(4))' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: basic/optional_map + + When CEL expression 'cel.block([optional.of("hello"), {?"hello": cel.index(0)}, cel.index(1)["hello"], cel.index(2) + cel.index(2)], cel.index(3) == "hellohello")' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: basic/optional_map_chained + + When CEL expression 'cel.block([{"key": "test"}, optional.of("test"), {?"key": cel.index(1)}, cel.index(2)[?"bogus"], cel.index(0)[?"bogus"], cel.index(3).or(cel.index(4)), cel.index(0)["key"], cel.index(5).orValue(cel.index(6))], cel.index(7))' is evaluated + Then value is celpy.celtypes.StringType(source='test') + +@wip +Scenario: basic/optional_message + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'cel.block([optional.ofNonZeroValue(1), optional.of(4), TestAllTypes{?single_int64: cel.index(0), ?single_int32: cel.index(1)}, cel.index(2).single_int32, cel.index(2).single_int64, cel.index(3) + cel.index(4)], cel.index(5))' is evaluated + Then value is celpy.celtypes.IntType(source=5) + +@wip +Scenario: basic/call + + When CEL expression 'cel.block(["h" + "e", cel.index(0) + "l", cel.index(1) + "l", cel.index(2) + "o", cel.index(3) + " world"], cel.index(4).matches(cel.index(3)))' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + diff --git a/features/block_ext.textproto b/features/block_ext.textproto new file mode 100644 index 0000000..ebdf76f --- /dev/null +++ b/features/block_ext.textproto @@ -0,0 +1,1070 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: cel.expr.conformance.test.SimpleTestFile + +# This conformance test relies on the test-only macros cel.block, cel.index, +# cel.iterVar, and cel.accuVar. These test-only macros allow exercising +# cel.block without the optimizers being present. +# `cel.block(l, e)` must rewrite itself to be `cel.block(l, e)` +# `cel.index(N)` must rewrite itself to `@indexN` +# `cel.iterVar(N, M)` must rewrite itself to `@it:N:M` +# `cel.accuVar(N, M)` must rewrite itself to `@ac:N:M` + +name: "block_ext" +description: "Tests for cel.block." +section: { + name: "basic" + test: { + name: "int_add" + expr: "cel.block([1, cel.index(0) + 1, cel.index(1) + 1, cel.index(2) + 1], cel.index(3))" + value: { + int64_value: 4 + } + } + test: { + name: "size_1" + expr: "cel.block([[1, 2], size(cel.index(0)), cel.index(1) + cel.index(1), cel.index(2) + 1], cel.index(3))" + value: { + int64_value: 5 + } + } + test: { + name: "size_2" + expr: "cel.block([[1, 2], size(cel.index(0)), 2 + cel.index(1), cel.index(2) + cel.index(1), cel.index(3) + 1], cel.index(4))" + value: { + int64_value: 7 + } + } + test: { + name: "size_3" + expr: "cel.block([[0], size(cel.index(0)), [1, 2], size(cel.index(2)), cel.index(1) + cel.index(1), cel.index(4) + cel.index(3), cel.index(5) + cel.index(3)], cel.index(6))" + value: { + int64_value: 6 + } + } + test: { + name: "size_4" + expr: "cel.block([[0], size(cel.index(0)), [1, 2], size(cel.index(2)), [1, 2, 3], size(cel.index(4)), 5 + cel.index(1), cel.index(6) + cel.index(1), cel.index(7) + cel.index(3), cel.index(8) + cel.index(3), cel.index(9) + cel.index(5), cel.index(10) + cel.index(5)], cel.index(11))" + value: { + int64_value: 17 + } + } + test: { + name: "timestamp" + expr: "cel.block([timestamp(1000000000), int(cel.index(0)), timestamp(cel.index(1)), cel.index(2).getFullYear(), timestamp(50), int(cel.index(4)), timestamp(cel.index(5)), timestamp(200), int(cel.index(7)), timestamp(cel.index(8)), cel.index(9).getFullYear(), timestamp(75), int(cel.index(11)), timestamp(cel.index(12)), cel.index(13).getFullYear(), cel.index(3) + cel.index(14), cel.index(6).getFullYear(), cel.index(15) + cel.index(16), cel.index(17) + cel.index(3), cel.index(6).getSeconds(), cel.index(18) + cel.index(19), cel.index(20) + cel.index(10), cel.index(21) + cel.index(10), cel.index(13).getMinutes(), cel.index(22) + cel.index(23), cel.index(24) + cel.index(3)], cel.index(25))" + value: { + int64_value: 13934 + } + } + test: { + name: "map_index" + expr: "cel.block([{\"a\": 2}, cel.index(0)[\"a\"], cel.index(1) * cel.index(1), cel.index(1) + cel.index(2)], cel.index(3))" + value: { + int64_value: 6 + } + } + test: { + name: "nested_map_construction" + expr: "cel.block([{\"b\": 1}, {\"e\": cel.index(0)}], {\"a\": cel.index(0), \"c\": cel.index(0), \"d\": cel.index(1), \"e\": cel.index(1)})" + value: { + map_value: { + entries { + key: { + string_value: 'a' + } + value: { + map_value: { + entries { + key: { + string_value: 'b' + } + value: { + int64_value: 1 + } + } + } + } + } + entries { + key: { + string_value: 'c' + } + value: { + map_value: { + entries { + key: { + string_value: 'b' + } + value: { + int64_value: 1 + } + } + } + } + } + entries { + key: { + string_value: 'd' + } + value: { + map_value: { + entries { + key: { + string_value: 'e' + } + value: { + map_value: { + entries { + key: { + string_value: 'b' + } + value: { + int64_value: 1 + } + } + } + } + } + } + } + } + entries { + key: { + string_value: 'e' + } + value: { + map_value: { + entries { + key: { + string_value: 'e' + } + value: { + map_value: { + entries { + key: { + string_value: 'b' + } + value: { + int64_value: 1 + } + } + } + } + } + } + } + } + } + } + } + test: { + name: "nested_list_construction" + expr: "cel.block([[1, 2, 3, 4], [1, 2], [cel.index(1), cel.index(0)]], [1, cel.index(0), 2, cel.index(0), 5, cel.index(0), 7, cel.index(2), cel.index(1)])" + value: { + list_value: { + values { + int64_value: 1 + } + values { + list_value: { + values { + int64_value: 1 + } + values { + int64_value: 2 + } + values { + int64_value: 3 + } + values { + int64_value: 4 + } + } + } + values { + int64_value: 2 + } + values { + list_value: { + values { + int64_value: 1 + } + values { + int64_value: 2 + } + values { + int64_value: 3 + } + values { + int64_value: 4 + } + } + } + values { + int64_value: 5 + } + values { + list_value: { + values { + int64_value: 1 + } + values { + int64_value: 2 + } + values { + int64_value: 3 + } + values { + int64_value: 4 + } + } + } + values { + int64_value: 7 + } + values { + list_value: { + values { + list_value: { + values { + int64_value: 1 + } + values { + int64_value: 2 + } + } + } + values { + list_value: { + values { + int64_value: 1 + } + values { + int64_value: 2 + } + values { + int64_value: 3 + } + values { + int64_value: 4 + } + } + } + } + } + values { + list_value: { + values { + int64_value: 1 + } + values { + int64_value: 2 + } + } + } + } + } + } + test: { + name: "select" + expr: "cel.block([msg.single_int64, cel.index(0) + cel.index(0)], cel.index(1))" + value: { + int64_value: 6 + } + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto3.TestAllTypes" }} + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + single_int64: 3 + single_int32: 5 + oneof_type: { + payload: { + single_int32: 8 + single_int64: 10 + map_int32_int64 { + key: 0 + value: 1 + } + map_int32_int64 { + key: 1 + value: 5 + } + map_int32_int64 { + key: 2 + value: 2 + } + map_string_string { + key: "key" + value: "A" + } + } + } + } + } + } + } + } + } + test: { + name: "select_nested_1" + expr: "cel.block([msg.oneof_type, cel.index(0).payload, cel.index(1).single_int64, cel.index(1).single_int32, cel.index(2) + cel.index(3), cel.index(4) + cel.index(2), msg.single_int64, cel.index(5) + cel.index(6), cel.index(1).oneof_type, cel.index(8).payload, cel.index(9).single_int64, cel.index(7) + cel.index(10)], cel.index(11))" + value: { + int64_value: 31 + } + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto3.TestAllTypes" }} + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + single_int64: 3 + single_int32: 5 + oneof_type: { + payload: { + single_int32: 8 + single_int64: 10 + map_int32_int64 { + key: 0 + value: 1 + } + map_int32_int64 { + key: 1 + value: 5 + } + map_int32_int64 { + key: 2 + value: 2 + } + map_string_string { + key: "key" + value: "A" + } + } + } + } + } + } + } + } + } + test: { + name: "select_nested_2" + expr: "cel.block([msg.oneof_type, cel.index(0).payload, cel.index(1).oneof_type, cel.index(2).payload, cel.index(3).oneof_type, cel.index(4).payload, cel.index(5).oneof_type, cel.index(6).payload, cel.index(7).single_bool, true || cel.index(8), cel.index(4).child, cel.index(10).child, cel.index(11).payload, cel.index(12).single_bool], cel.index(9) || cel.index(13))" + value: { + bool_value: true + } + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto3.TestAllTypes" }} + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + single_int64: 3 + single_int32: 5 + oneof_type: { + payload: { + single_int32: 8 + single_int64: 10 + map_int32_int64 { + key: 0 + value: 1 + } + map_int32_int64 { + key: 1 + value: 5 + } + map_int32_int64 { + key: 2 + value: 2 + } + map_string_string { + key: "key" + value: "A" + } + } + } + } + } + } + } + } + } + test: { + name: "select_nested_message_map_index_1" + expr: "cel.block([msg.oneof_type, cel.index(0).payload, cel.index(1).map_int32_int64, cel.index(2)[1], cel.index(3) + cel.index(3), cel.index(4) + cel.index(3)], cel.index(5))" + value: { + int64_value: 15 + } + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto3.TestAllTypes" }} + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + single_int64: 3 + single_int32: 5 + oneof_type: { + payload: { + single_int32: 8 + single_int64: 10 + map_int32_int64 { + key: 0 + value: 1 + } + map_int32_int64 { + key: 1 + value: 5 + } + map_int32_int64 { + key: 2 + value: 2 + } + map_string_string { + key: "key" + value: "A" + } + } + } + } + } + } + } + } + } + test: { + name: "select_nested_message_map_index_2" + expr: "cel.block([msg.oneof_type, cel.index(0).payload, cel.index(1).map_int32_int64, cel.index(2)[0], cel.index(2)[1], cel.index(3) + cel.index(4), cel.index(2)[2], cel.index(5) + cel.index(6)], cel.index(7))" + value: { + int64_value: 8 + } + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto3.TestAllTypes" }} + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + single_int64: 3 + single_int32: 5 + oneof_type: { + payload: { + single_int32: 8 + single_int64: 10 + map_int32_int64 { + key: 0 + value: 1 + } + map_int32_int64 { + key: 1 + value: 5 + } + map_int32_int64 { + key: 2 + value: 2 + } + map_string_string { + key: "key" + value: "A" + } + } + } + } + } + } + } + } + } + test: { + name: "ternary" + expr: "cel.block([msg.single_int64, cel.index(0) > 0, cel.index(1) ? cel.index(0) : 0], cel.index(2))" + value: { + int64_value: 3 + } + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto3.TestAllTypes" }} + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + single_int64: 3 + single_int32: 5 + oneof_type: { + payload: { + single_int32: 8 + single_int64: 10 + map_int32_int64 { + key: 0 + value: 1 + } + map_int32_int64 { + key: 1 + value: 5 + } + map_int32_int64 { + key: 2 + value: 2 + } + map_string_string { + key: "key" + value: "A" + } + } + } + } + } + } + } + } + } + test: { + name: "nested_ternary" + expr: "cel.block([msg.single_int64, msg.single_int32, cel.index(0) > 0, cel.index(1) > 0, cel.index(0) + cel.index(1), cel.index(3) ? cel.index(4) : 0, cel.index(2) ? cel.index(5) : 0], cel.index(6))" + value: { + int64_value: 8 + } + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto3.TestAllTypes" }} + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + single_int64: 3 + single_int32: 5 + oneof_type: { + payload: { + single_int32: 8 + single_int64: 10 + map_int32_int64 { + key: 0 + value: 1 + } + map_int32_int64 { + key: 1 + value: 5 + } + map_int32_int64 { + key: 2 + value: 2 + } + map_string_string { + key: "key" + value: "A" + } + } + } + } + } + } + } + } + } + test: { + name: "multiple_macros_1" + expr: "cel.block([[1].exists(cel.iterVar(0, 0), cel.iterVar(0, 0) > 0), size([cel.index(0)]), [2].exists(cel.iterVar(0, 0), cel.iterVar(0, 0) > 1), size([cel.index(2)])], cel.index(1) + cel.index(1) + cel.index(3) + cel.index(3))" + value: { + int64_value: 4 + } + } + test: { + name: "multiple_macros_2" + expr: "cel.block([[1].exists(cel.iterVar(0, 0), cel.iterVar(0, 0) > 0), [cel.index(0)], ['a'].exists(cel.iterVar(0, 1), cel.iterVar(0, 1) == 'a'), [cel.index(2)]], cel.index(1) + cel.index(1) + cel.index(3) + cel.index(3))" + value: { + list_value: { + values { + bool_value: true + } + values { + bool_value: true + } + values { + bool_value: true + } + values { + bool_value: true + } + } + } + } + test: { + name: "multiple_macros_3" + expr: "cel.block([[1].exists(cel.iterVar(0, 0), cel.iterVar(0, 0) > 0)], cel.index(0) && cel.index(0) && [1].exists(cel.iterVar(0, 0), cel.iterVar(0, 0) > 1) && [2].exists(cel.iterVar(0, 0), cel.iterVar(0, 0) > 1))" + value: { + bool_value: false + } + } + test: { + name: "nested_macros_1" + expr: "cel.block([[1, 2, 3]], cel.index(0).map(cel.iterVar(0, 0), cel.index(0).map(cel.iterVar(1, 0), cel.iterVar(1, 0) + 1)))" + value: { + list_value: { + values { + list_value: { + values { + int64_value: 2 + } + values { + int64_value: 3 + } + values { + int64_value: 4 + } + } + } + values { + list_value: { + values { + int64_value: 2 + } + values { + int64_value: 3 + } + values { + int64_value: 4 + } + } + } + values { + list_value: { + values { + int64_value: 2 + } + values { + int64_value: 3 + } + values { + int64_value: 4 + } + } + } + } + } + } + test: { + name: "nested_macros_2" + expr: "[1, 2].map(cel.iterVar(0, 0), [1, 2, 3].filter(cel.iterVar(1, 0), cel.iterVar(1, 0) == cel.iterVar(0, 0)))" + value: { + list_value: { + values { + list_value: { + values { + int64_value: 1 + } + } + } + values { + list_value: { + values { + int64_value: 2 + } + } + } + } + } + } + test: { + name: "adjacent_macros" + expr: "cel.block([[1, 2, 3], cel.index(0).map(cel.iterVar(0, 0), cel.index(0).map(cel.iterVar(1, 0), cel.iterVar(1, 0) + 1))], cel.index(1) == cel.index(1))" + value: { + bool_value: true + } + } + test: { + name: "macro_shadowed_variable_1" + expr: "cel.block([x - 1, cel.index(0) > 3], [cel.index(1) ? cel.index(0) : 5].exists(cel.iterVar(0, 0), cel.iterVar(0, 0) - 1 > 3) || cel.index(1))" + value: { + bool_value: true + } + type_env: { + name: "x" + ident: { type: { primitive: INT64 }} + } + bindings: { + key: "x" + value: { + value: { + int64_value: 5 + } + } + } + } + test: { + name: "macro_shadowed_variable_2" + expr: "['foo', 'bar'].map(cel.iterVar(1, 0), [cel.iterVar(1, 0) + cel.iterVar(1, 0), cel.iterVar(1, 0) + cel.iterVar(1, 0)]).map(cel.iterVar(0, 0), [cel.iterVar(0, 0) + cel.iterVar(0, 0), cel.iterVar(0, 0) + cel.iterVar(0, 0)])" + value: { + list_value: { + values { + list_value: { + values { + list_value: { + values { + string_value: "foofoo" + } + values { + string_value: "foofoo" + } + values { + string_value: "foofoo" + } + values { + string_value: "foofoo" + } + } + } + values { + list_value: { + values { + string_value: "foofoo" + } + values { + string_value: "foofoo" + } + values { + string_value: "foofoo" + } + values { + string_value: "foofoo" + } + } + } + } + } + values { + list_value: { + values { + list_value: { + values { + string_value: "barbar" + } + values { + string_value: "barbar" + } + values { + string_value: "barbar" + } + values { + string_value: "barbar" + } + } + } + values { + list_value: { + values { + string_value: "barbar" + } + values { + string_value: "barbar" + } + values { + string_value: "barbar" + } + values { + string_value: "barbar" + } + } + } + } + } + } + } + type_env: { + name: "x" + ident: { type: { primitive: INT64 }} + } + bindings: { + key: "x" + value: { + value: { + int64_value: 5 + } + } + } + } + test: { + name: "inclusion_list" + expr: "cel.block([[1, 2, 3], 1 in cel.index(0), 2 in cel.index(0), cel.index(1) && cel.index(2), [3, cel.index(0)], 3 in cel.index(4), cel.index(5) && cel.index(1)], cel.index(3) && cel.index(6))" + value: { + bool_value: true + } + } + test: { + name: "inclusion_map" + expr: "cel.block([{true: false}, {\"a\": 1, 2: cel.index(0), 3: cel.index(0)}], 2 in cel.index(1))" + value: { + bool_value: true + } + } + test: { + name: "presence_test" + expr: "cel.block([{\"a\": true}, has(cel.index(0).a), cel.index(0)[\"a\"]], cel.index(1) && cel.index(2))" + value: { + bool_value: true + } + } + test: { + name: "presence_test_2" + expr: "cel.block([{\"a\": true}, has(cel.index(0).a)], cel.index(1) && cel.index(1))" + value: { + bool_value: true + } + } + test: { + name: "presence_test_with_ternary" + expr: "cel.block([msg.oneof_type, has(cel.index(0).payload), cel.index(0).payload, cel.index(2).single_int64, cel.index(1) ? cel.index(3) : 0], cel.index(4))" + value: { + int64_value: 10 + } + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto3.TestAllTypes" }} + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + single_int64: 3 + single_int32: 5 + oneof_type: { + payload: { + single_int32: 8 + single_int64: 10 + map_int32_int64 { + key: 0 + value: 1 + } + map_int32_int64 { + key: 1 + value: 5 + } + map_int32_int64 { + key: 2 + value: 2 + } + map_string_string { + key: "key" + value: "A" + } + } + } + } + } + } + } + } + } + test: { + name: "presence_test_with_ternary_2" + expr: "cel.block([msg.oneof_type, cel.index(0).payload, cel.index(1).single_int64, has(cel.index(0).payload), cel.index(2) * 0, cel.index(3) ? cel.index(2) : cel.index(4)], cel.index(5))" + value: { + int64_value: 10 + } + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto3.TestAllTypes" }} + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + single_int64: 3 + single_int32: 5 + oneof_type: { + payload: { + single_int32: 8 + single_int64: 10 + map_int32_int64 { + key: 0 + value: 1 + } + map_int32_int64 { + key: 1 + value: 5 + } + map_int32_int64 { + key: 2 + value: 2 + } + map_string_string { + key: "key" + value: "A" + } + } + } + } + } + } + } + } + } + test: { + name: "presence_test_with_ternary_3" + expr: "cel.block([msg.oneof_type, cel.index(0).payload, cel.index(1).single_int64, has(cel.index(1).single_int64), cel.index(2) * 0, cel.index(3) ? cel.index(2) : cel.index(4)], cel.index(5))" + value: { + int64_value: 10 + } + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto3.TestAllTypes" }} + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + single_int64: 3 + single_int32: 5 + oneof_type: { + payload: { + single_int32: 8 + single_int64: 10 + map_int32_int64 { + key: 0 + value: 1 + } + map_int32_int64 { + key: 1 + value: 5 + } + map_int32_int64 { + key: 2 + value: 2 + } + map_string_string { + key: "key" + value: "A" + } + } + } + } + } + } + } + } + } + test: { + name: "presence_test_with_ternary_nested" + expr: "cel.block([msg.oneof_type, cel.index(0).payload, cel.index(1).map_string_string, has(msg.oneof_type), has(cel.index(0).payload), cel.index(3) && cel.index(4), has(cel.index(1).single_int64), cel.index(5) && cel.index(6), has(cel.index(1).map_string_string), has(cel.index(2).key), cel.index(8) && cel.index(9), cel.index(2).key, cel.index(11) == \"A\", cel.index(10) ? cel.index(12) : false], cel.index(7) ? cel.index(13) : false)" + value: { + bool_value: true + } + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto3.TestAllTypes" }} + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + single_int64: 3 + single_int32: 5 + oneof_type: { + payload: { + single_int32: 8 + single_int64: 10 + map_int32_int64 { + key: 0 + value: 1 + } + map_int32_int64 { + key: 1 + value: 5 + } + map_int32_int64 { + key: 2 + value: 2 + } + map_string_string { + key: "key" + value: "A" + } + } + } + } + } + } + } + } + } + test: { + name: "optional_list" + expr: "cel.block([optional.none(), [?cel.index(0), ?optional.of(opt_x)], [5], [10, ?cel.index(0), cel.index(1), cel.index(1)], [10, cel.index(2), cel.index(2)]], cel.index(3) == cel.index(4))" + value: { + bool_value: true + } + type_env: { + name: "opt_x" + ident: { type: { primitive: INT64 }} + } + bindings: { + key: "opt_x", + value: { + value: { + int64_value: 5 + } + } + } + } + test: { + name: "optional_map" + expr: "cel.block([optional.of(\"hello\"), {?\"hello\": cel.index(0)}, cel.index(1)[\"hello\"], cel.index(2) + cel.index(2)], cel.index(3) == \"hellohello\")" + value: { + bool_value: true + } + } + test: { + name: "optional_map_chained" + expr: "cel.block([{\"key\": \"test\"}, optional.of(\"test\"), {?\"key\": cel.index(1)}, cel.index(2)[?\"bogus\"], cel.index(0)[?\"bogus\"], cel.index(3).or(cel.index(4)), cel.index(0)[\"key\"], cel.index(5).orValue(cel.index(6))], cel.index(7))" + value: { + string_value: 'test' + } + } + test: { + name: "optional_message" + container: "cel.expr.conformance.proto3" + expr: "cel.block([optional.ofNonZeroValue(1), optional.of(4), TestAllTypes{?single_int64: cel.index(0), ?single_int32: cel.index(1)}, cel.index(2).single_int32, cel.index(2).single_int64, cel.index(3) + cel.index(4)], cel.index(5))" + value: { + int64_value: 5 + } + } + test: { + name: "call" + expr: "cel.block([\"h\" + \"e\", cel.index(0) + \"l\", cel.index(1) + \"l\", cel.index(2) + \"o\", cel.index(3) + \" world\"], cel.index(4).matches(cel.index(3)))" + value: { + bool_value: true + } + } +} diff --git a/features/comparisons.feature b/features/comparisons.feature index cda2c4a..534cc79 100644 --- a/features/comparisons.feature +++ b/features/comparisons.feature @@ -1,1351 +1,2354 @@ - +@conformance Feature: comparisons Tests for boolean-valued functions and operators. + # eq_literal -- Literals comparison on _==_ -Scenario: eq_int +Scenario: eq_literal/eq_int - When CEL expression "1 == 1" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression '1 == 1' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: eq_literal/not_eq_int -Scenario: not_eq_int + When CEL expression '-1 == 1' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "-1 == 1" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: eq_literal/eq_int_uint + When CEL expression 'dyn(1) == 1u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: eq_uint +@wip +Scenario: eq_literal/not_eq_int_uint - When CEL expression "2u == 2u" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'dyn(2) == 1u' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +@wip +Scenario: eq_literal/eq_int_double -Scenario: not_eq_uint + When CEL expression 'dyn(1) == 1.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "1u == 2u" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: eq_literal/not_eq_int_double + When CEL expression 'dyn(2) == 1.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: eq_double +Scenario: eq_literal/eq_uint - When CEL expression "1.0 == 1.0e+0" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression '2u == 2u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: eq_literal/not_eq_uint -Scenario: not_eq_double + When CEL expression '1u == 2u' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "-1.0 == 1.0" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: eq_literal/eq_uint_int + When CEL expression 'dyn(1u) == 1' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: eq_double_NaN - CEL defines all NaN values to be equal. - When CEL expression "1.0 / 0.0 == 1.0 / 0.0" is evaluated - # bool_value:true - Then value is BoolType(source=True) +@wip +Scenario: eq_literal/not_eq_uint_int + When CEL expression 'dyn(2u) == 1' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: eq_string +@wip +Scenario: eq_literal/eq_uint_double - When CEL expression ''' == ""' is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'dyn(1u) == 1.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +@wip +Scenario: eq_literal/not_eq_uint_double -Scenario: not_eq_string + When CEL expression 'dyn(2u) == 1.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "'a' == 'b'" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: eq_literal/eq_double + When CEL expression '1.0 == 1.0e+0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: eq_raw_string +Scenario: eq_literal/not_eq_double - When CEL expression "'abc' == r'abc'" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression '-1.0 == 1.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +@wip +Scenario: eq_literal/not_eq_double_nan -Scenario: not_eq_string_case + When CEL expression '0.0/0.0 == 0.0/0.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "'abc' == 'ABC'" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: eq_literal/not_eq_int_double_nan + When CEL expression 'dyn(1) == 0.0/0.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: eq_string_unicode +@wip +Scenario: eq_literal/not_eq_uint_double_nan - When CEL expression "'ίσος' == 'ίσος'" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'dyn(1u) == 0.0/0.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +@wip +Scenario: eq_literal/eq_double_int -Scenario: not_eq_string_unicode_ascii + When CEL expression 'dyn(1.0) == 1' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "'a' == 'à'" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: eq_literal/not_eq_double_int + When CEL expression 'dyn(2.0) == 1' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: no_string_normalization - Should not normalize Unicode. - When CEL expression "'Am\u00E9lie' == 'Ame\u0301lie'" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: eq_literal/eq_double_uint + + When CEL expression 'dyn(1.0) == 1u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_literal/not_eq_double_uint + + When CEL expression 'dyn(2.0) == 1u' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: eq_literal/eq_string + + When CEL expression '\'\' == ""' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: eq_literal/not_eq_string + When CEL expression "'a' == 'b'" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: eq_literal/eq_raw_string + + When CEL expression "'abc' == r'abc'" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: eq_literal/not_eq_string_case + + When CEL expression "'abc' == 'ABC'" is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: no_string_normalization_surrogate - Should not replace surrogate pairs. - When CEL expression "'\U0001F436' == '\xef\xbf\xbd\xef\xbf\bd'" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: eq_literal/eq_string_unicode + When CEL expression "'ίσος' == 'ίσος'" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: eq_literal/not_eq_string_unicode_ascii -Scenario: eq_null + When CEL expression "'a' == 'à'" is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "null == null" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: eq_literal/no_string_normalization + Should not normalize Unicode. + When CEL expression "'Am\\u00E9lie' == 'Ame\\u0301lie'" is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: eq_bool +Scenario: eq_literal/eq_null - When CEL expression "true == true" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'null == null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: eq_literal/eq_bool -Scenario: not_eq_bool + When CEL expression 'true == true' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "false == true" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: eq_literal/not_eq_bool + When CEL expression 'false == true' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: eq_bytes +Scenario: eq_literal/eq_bytes Test bytes literal equality with encoding - When CEL expression "b'ÿ' == b'\303\277'" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression "b'ÿ' == b'\\303\\277'" is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: not_eq_bytes +Scenario: eq_literal/not_eq_bytes When CEL expression "b'abc' == b'abcd'" is evaluated - # bool_value:false - Then value is BoolType(source=False) + Then value is celpy.celtypes.BoolType(source=False) +Scenario: eq_literal/eq_list_empty -Scenario: eq_list_empty + When CEL expression '[] == []' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "[] == []" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: eq_literal/eq_list_null + When CEL expression '[null] == [null]' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: eq_list_numbers +Scenario: eq_literal/not_eq_list_null - When CEL expression "[1, 2, 3] == [1, 2, 3]" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression "['1', '2', null] == ['1', '2', '3']" is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: eq_literal/eq_list_numbers -Scenario: not_eq_list_order + When CEL expression '[1, 2, 3] == [1, 2, 3]' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "[1, 2, 3] == [1, 3, 2]" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: eq_literal/eq_list_mixed_type_numbers + When CEL expression '[1.0, 2.0, 3] == [1u, 2, 3u]' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: not_eq_list_string_case +@wip +Scenario: eq_literal/not_eq_list_mixed_type_numbers - When CEL expression "['case'] == ['cAse']" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression '[1.0, 2.1] == [1u, 2]' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: eq_literal/not_eq_list_order -Scenario: not_eq_list_length + When CEL expression '[1, 2, 3] == [1, 3, 2]' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "['one'] == [2, 3]" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: eq_literal/not_eq_list_string_case + + When CEL expression "['case'] == ['cAse']" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: eq_literal/not_eq_list_length + Given disable_check parameter is True + When CEL expression "['one'] == [2, 3]" is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: not_eq_list_false_vs_types +Scenario: eq_literal/not_eq_list_false_vs_types When CEL expression "[1, 'dos', 3] == [1, 2, 4]" is evaluated - # bool_value:false - Then value is BoolType(source=False) + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: eq_literal/eq_map_empty + When CEL expression '{} == {}' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: eq_map_empty +Scenario: eq_literal/eq_map_null - When CEL expression "{} == {}" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression "{'k': null} == {'k': null}" is evaluated + Then value is celpy.celtypes.BoolType(source=True) +@wip +Scenario: eq_literal/not_eq_map_null -Scenario: eq_map_onekey + When CEL expression "{'k': 1, 'j': 2} == {'k': 1, 'j': null}" is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression '{'k':'v'} == {"k":"v"}' is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: eq_literal/eq_map_onekey + When CEL expression '{\'k\':\'v\'} == {"k":"v"}' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: eq_map_doublevalue +Scenario: eq_literal/eq_map_double_value When CEL expression "{'k':1.0} == {'k':1e+0}" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Then value is celpy.celtypes.BoolType(source=True) +@wip +Scenario: eq_literal/eq_map_mixed_type_numbers -Scenario: not_eq_map_value + When CEL expression '{1: 1.0, 2u: 3u} == {1u: 1, 2: 3.0}' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "{'k':'v'} == {'k':'v1'}" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: eq_literal/not_eq_map_value + When CEL expression "{'k':'v'} == {'k':'v1'}" is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: not_eq_map_extrakey +Scenario: eq_literal/not_eq_map_extra_key When CEL expression "{'k':'v','k1':'v1'} == {'k':'v'}" is evaluated - # bool_value:false - Then value is BoolType(source=False) - + Then value is celpy.celtypes.BoolType(source=False) -Scenario: eq_map_keyorder +Scenario: eq_literal/eq_map_key_order When CEL expression "{'k1':'v1','k2':'v2'} == {'k2':'v2','k1':'v1'}" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Then value is celpy.celtypes.BoolType(source=True) - -Scenario: not_eq_map_key_casing +Scenario: eq_literal/not_eq_map_key_casing When CEL expression "{'key':'value'} == {'Key':'value'}" is evaluated - # bool_value:false - Then value is BoolType(source=False) - + Then value is celpy.celtypes.BoolType(source=False) -Scenario: not_eq_map_false_vs_types +Scenario: eq_literal/not_eq_map_false_vs_types When CEL expression "{'k1': 1, 'k2': 'dos', 'k3': 3} == {'k1': 1, 'k2': 2, 'k3': 4}" is evaluated - # bool_value:false - Then value is BoolType(source=False) + Then value is celpy.celtypes.BoolType(source=False) +@wip +Scenario: eq_literal/eq_mixed_types -Scenario: eq_mixed_types_error - A mix of types fails during type checks but can't be captured in the conformance tests yet (See google/cel-go#155). Also, if you disable checks it yields {bool_value: false} where it should also yield an error - When CEL expression "1.0 == 1" is evaluated - # errors:{message:"no such overload"} - Then eval_error is 'no such overload' + Given disable_check parameter is True + When CEL expression '1.0 == 1' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +@wip +Scenario: eq_literal/eq_list_elem_mixed_types -Scenario: eq_list_elem_mixed_types_error - A mix of types in a list fails during type checks. See #self_test_equals_mixed_types - When CEL expression "[1] == [1.0]" is evaluated - # errors:{message:"no such overload"} - Then eval_error is 'no such overload' + Given disable_check parameter is True + When CEL expression '[1] == [1.0]' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +@wip +Scenario: eq_literal/eq_map_value_mixed_types -Scenario: eq_map_value_mixed_types_error - Mixed map value types yields error as key '1' values differed by type. When CEL expression "{'k':'v', 1:1} == {'k':'v', 1:'v1'}" is evaluated - # errors:{message:"no such overload"} - Then eval_error is 'no such overload' + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: eq_literal/eq_dyn_json_null + + When CEL expression 'dyn(google.protobuf.Value{}) == null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: eq_literal/not_eq_dyn_bool_null + + When CEL expression 'dyn(false) == null' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: eq_literal/not_eq_dyn_bytes_null + + When CEL expression "dyn(b'') == null" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: eq_literal/not_eq_dyn_double_null + + When CEL expression 'dyn(2.1) == null' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: eq_literal/not_eq_dyn_duration_null + + When CEL expression "dyn(duration('0s')) == null" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: eq_literal/not_eq_dyn_int_null + + When CEL expression 'dyn(1) == null' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: eq_literal/not_eq_dyn_list_null + + When CEL expression 'dyn([]) == null' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: eq_literal/not_eq_dyn_map_null + + When CEL expression 'dyn({}) == null' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: eq_literal/not_eq_dyn_proto2_msg_null + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'dyn(TestAllTypes{}) == null' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: eq_literal/not_eq_dyn_proto3_msg_null + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'dyn(TestAllTypes{}) == null' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: eq_literal/not_eq_dyn_string_null + + When CEL expression "dyn('') == null" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: eq_literal/not_eq_dyn_timestamp_null + + When CEL expression 'dyn(timestamp(0)) == null' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: eq_literal/not_eq_list_elem_null + + When CEL expression '[1, 2, null] == [1, null, 3]' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: eq_literal/not_eq_map_value_null + + When CEL expression "{1:'hello', 2:'world'} == {1:'goodbye', 2:null}" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: eq_literal/eq_dyn_int_uint + + When CEL expression 'dyn(1) == 1u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_literal/eq_dyn_int_double + + When CEL expression 'dyn(1) == 1.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_literal/eq_dyn_uint_int + + When CEL expression 'dyn(1u) == 1' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_literal/eq_dyn_uint_double + + When CEL expression 'dyn(1u) == 1.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_literal/eq_dyn_double_int + + When CEL expression 'dyn(1.0) == 1' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_literal/eq_dyn_double_uint + + When CEL expression 'dyn(1.0) == 1u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_literal/not_eq_dyn_int_uint + + When CEL expression 'dyn(1) == 2u' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: eq_literal/not_eq_dyn_int_double + + When CEL expression 'dyn(1) == 2.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: eq_literal/not_eq_dyn_uint_int + + When CEL expression 'dyn(1u) == 2' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: eq_literal/not_eq_dyn_uint_double + + When CEL expression 'dyn(1u) == 120' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: eq_literal/not_eq_dyn_double_int + + When CEL expression 'dyn(1.0) == 2' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: eq_literal/not_eq_dyn_double_uint + + When CEL expression 'dyn(1.0) == 2u' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + + +# eq_wrapper -- Wrapper type comparison on _==_. Wrapper types treated as boxed primitives when they appear on message fields. An unset wrapper field should be treated as null. The tests show the distinction between unset, empty, and set equality behavior. + +@wip +Scenario: eq_wrapper/eq_bool + + When CEL expression 'google.protobuf.BoolValue{value: true} == true' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_bool_empty + + When CEL expression 'google.protobuf.BoolValue{} == false' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_bool_not_null + + When CEL expression 'google.protobuf.BoolValue{} != null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_bool_proto2_null + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.single_bool_wrapper == null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_bool_proto3_null + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{}.single_bool_wrapper == null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_bytes + + When CEL expression "google.protobuf.BytesValue{value: b'set'} == b'set'" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: eq_wrapper/eq_bytes_empty + + When CEL expression "google.protobuf.BytesValue{} == b''" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: eq_wrapper/eq_bytes_not_null + + When CEL expression 'google.protobuf.BytesValue{} != null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_bytes_proto2_null + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.single_bytes_wrapper == null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_bytes_proto3_null + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{}.single_bytes_wrapper == null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_double + + When CEL expression 'google.protobuf.DoubleValue{value: -1.175494e-40} == -1.175494e-40' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_double_empty + + When CEL expression 'google.protobuf.DoubleValue{} == 0.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_double_not_null + + When CEL expression 'google.protobuf.DoubleValue{} != null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_double_proto2_null + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.single_double_wrapper == null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_double_proto3_null + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{}.single_double_wrapper == null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_float + + When CEL expression 'google.protobuf.FloatValue{value: -1.5} == -1.5' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_float_empty + + When CEL expression 'google.protobuf.FloatValue{} == 0.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_float_not_null + + When CEL expression 'google.protobuf.FloatValue{} != null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_float_proto2_null + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.single_float_wrapper == null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_float_proto3_null + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{}.single_float_wrapper == null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_int32 + + When CEL expression 'google.protobuf.Int32Value{value: 123} == 123' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_int32_empty + + When CEL expression 'google.protobuf.Int32Value{} == 0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_int32_not_null + + When CEL expression 'google.protobuf.Int32Value{} != null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_int32_proto2_null + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.single_int32_wrapper == null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_int32_proto3_null + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{}.single_int32_wrapper == null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_int64 + + When CEL expression 'google.protobuf.Int64Value{value: 2147483650} == 2147483650' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_int64_empty + + When CEL expression 'google.protobuf.Int64Value{} == 0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_int64_not_null + + When CEL expression 'google.protobuf.Int64Value{} != null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_int64_proto2_null + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.single_int64_wrapper == null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_int64_proto3_null + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{}.single_int64_wrapper == null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_string + + When CEL expression "google.protobuf.StringValue{value: 'set'} == 'set'" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_string_empty + + When CEL expression "google.protobuf.StringValue{} == ''" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: eq_wrapper/eq_string_not_null + + When CEL expression 'google.protobuf.StringValue{} != null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_string_proto2_null + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.single_string_wrapper == null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_string_proto3_null + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{}.single_string_wrapper == null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_uint32 + + When CEL expression 'google.protobuf.UInt32Value{value: 42u} == 42u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_uint32_empty + + When CEL expression 'google.protobuf.UInt32Value{} == 0u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_uint32_not_null + + When CEL expression 'google.protobuf.UInt32Value{} != null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_uint32_proto2_null + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.single_uint32_wrapper == null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_uint32_proto3_null + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{}.single_uint32_wrapper == null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_uint64 + + When CEL expression 'google.protobuf.UInt64Value{value: 4294967296u} == 4294967296u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_uint64_empty + + When CEL expression 'google.protobuf.UInt64Value{} == 0u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_uint64_not_null + + When CEL expression 'google.protobuf.UInt64Value{} != null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_uint64_proto2_null + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.single_uint64_wrapper == null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_uint64_proto3_null + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{}.single_uint64_wrapper == null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: eq_wrapper/eq_proto2 + + Given container is 'cel.expr.conformance.proto2' + When CEL expression "TestAllTypes{single_int64: 1234, single_string: '1234'} == TestAllTypes{single_int64: 1234, single_string: '1234'}" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: eq_wrapper/eq_proto3 + + Given container is 'cel.expr.conformance.proto3' + When CEL expression "TestAllTypes{single_int64: 1234, single_string: '1234'} == TestAllTypes{single_int64: 1234, single_string: '1234'}" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_proto2_missing_fields_neq + + Given container is 'cel.expr.conformance.proto2' + When CEL expression "TestAllTypes{single_int64: 1234} == TestAllTypes{single_string: '1234'}" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: eq_wrapper/eq_proto3_missing_fields_neq + + Given container is 'cel.expr.conformance.proto3' + When CEL expression "TestAllTypes{single_int64: 1234} == TestAllTypes{single_string: '1234'}" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: eq_wrapper/eq_proto_nan_equal + For proto equality, fields with NaN value are treated as not equal. + + Given container is 'cel.expr.conformance.proto2' + When CEL expression "TestAllTypes{single_double: double('NaN')} == TestAllTypes{single_double: double('NaN')}" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: eq_wrapper/eq_proto_different_types + At runtime, differently typed messages are treated as not equal. + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'dyn(TestAllTypes{}) == dyn(NestedTestAllTypes{})' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: eq_wrapper/eq_proto2_any_unpack_equal + Any values should be unpacked and compared. + + Given container is 'cel.expr.conformance.proto2' + When CEL expression "TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001r\\0041234'}} == TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'r\\0041234\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001'}}" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_proto2_any_unpack_not_equal + Any values should be unpacked and compared. + + Given container is 'cel.expr.conformance.proto2' + When CEL expression "TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'a\\000\\000\\000\\000\\000H\\223\\300r\\0041234'}} == TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'r\\0041234\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001'}}" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: eq_wrapper/eq_proto2_any_unpack_bytewise_fallback_not_equal + If an any field is missing its type_url, the comparison should + fallback to a bytewise comparison of the serialized proto. + + Given container is 'cel.expr.conformance.proto2' + When CEL expression "TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\242\\006\\023\\022\\021\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001r\\0041234'}} == TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\242\\006\\023\\022\\021r\\0041234\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001'}}" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: eq_wrapper/eq_proto2_any_unpack_bytewise_fallback_equal + If an any field is missing its type_url, the comparison should + fallback to a bytewise comparison of the serialized proto. + + Given container is 'cel.expr.conformance.proto2' + When CEL expression "TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\242\\006\\023\\022\\021\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001r\\0041234'}} == TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\242\\006\\023\\022\\021\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001r\\0041234'}}" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_proto3_any_unpack_equal + Any values should be unpacked and compared. + + Given container is 'cel.expr.conformance.proto3' + When CEL expression "TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001r\\0041234'}} == TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'r\\0041234\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001'}}" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: eq_wrapper/eq_proto3_any_unpack_not_equal + Any values should be unpacked and compared. + + Given container is 'cel.expr.conformance.proto3' + When CEL expression "TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'a\\000\\000\\000\\000\\000H\\223\\300r\\0041234'}} == TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'r\\0041234\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001'}}" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: eq_wrapper/eq_proto3_any_unpack_bytewise_fallback_not_equal + If an any field is missing its type_url, the comparison should + fallback to a bytewise comparison of the serialized proto. + + Given container is 'cel.expr.conformance.proto3' + When CEL expression "TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\242\\006\\023\\022\\021\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001r\\0041234'}} == TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\242\\006\\023\\022\\021r\\0041234\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001'}}" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: eq_wrapper/eq_proto3_any_unpack_bytewise_fallback_equal + If an any field is missing its type_url, the comparison should + fallback to a bytewise comparison of the serialized proto. + + Given container is 'cel.expr.conformance.proto3' + When CEL expression "TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\242\\006\\023\\022\\021\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001r\\0041234'}} == TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\242\\006\\023\\022\\021\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001r\\0041234'}}" is evaluated + Then value is celpy.celtypes.BoolType(source=True) # ne_literal -- Literals comparison on _!=_ -Scenario: ne_int +Scenario: ne_literal/ne_int - When CEL expression "24 != 42" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression '24 != 42' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: ne_literal/not_ne_int -Scenario: not_ne_int + When CEL expression '1 != 1' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "1 != 1" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: ne_literal/ne_int_double + When CEL expression 'dyn(24) != 24.1' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: ne_uint +@wip +Scenario: ne_literal/not_ne_int_double - When CEL expression "1u != 2u" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'dyn(1) != 1.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +@wip +Scenario: ne_literal/ne_int_uint -Scenario: not_ne_uint + When CEL expression 'dyn(24) != 42u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "99u != 99u" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: ne_literal/not_ne_int_uint + When CEL expression 'dyn(1) != 1u' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: ne_double +Scenario: ne_literal/ne_uint - When CEL expression "9.0e+3 != 9001.0" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression '1u != 2u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: ne_literal/not_ne_uint -Scenario: not_ne_double + When CEL expression '99u != 99u' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "1.0 != 1e+0" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: ne_literal/ne_uint_double + When CEL expression 'dyn(1u) != 2.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: ne_string +@wip +Scenario: ne_literal/not_ne_uint_double - When CEL expression "'abc' != ''" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'dyn(99u) != 99.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: ne_literal/ne_double -Scenario: not_ne_string + When CEL expression '9.0e+3 != 9001.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "'abc' != 'abc'" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: ne_literal/not_ne_double_nan + When CEL expression '0.0/0.0 != 0.0/0.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: ne_string_unicode +@wip +Scenario: ne_literal/not_ne_int_double_nan - When CEL expression "'résumé' != 'resume'" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'dyn(1) != 0.0/0.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +@wip +Scenario: ne_literal/not_ne_uint_double_nan -Scenario: not_ne_string_unicode + When CEL expression 'dyn(1u) != 0.0/0.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "'ίδιο' != 'ίδιο'" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: ne_literal/not_ne_double + When CEL expression '1.0 != 1e+0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: ne_bytes +@wip +Scenario: ne_literal/ne_double_int - When CEL expression "b'\x00\xFF' != b'ÿ'" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'dyn(9000) != 9001.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +@wip +Scenario: ne_literal/not_ne_double_int -Scenario: not_ne_bytes + When CEL expression 'dyn(1) != 1e+0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "b'\303\277' != b'ÿ'" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: ne_literal/ne_double_uint + When CEL expression 'dyn(9000u) != 9001.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: ne_bool +@wip +Scenario: ne_literal/not_ne_double_uint - When CEL expression "false != true" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'dyn(1u) != 1e+0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +@wip +Scenario: ne_literal/ne_double_nan -Scenario: not_ne_bool + When CEL expression '0.0/0.0 != 0.0/0.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "true != true" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: ne_literal/ne_string + When CEL expression "'abc' != ''" is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: not_ne_null - null can only be equal to null, or else it won't match - When CEL expression "null != null" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: ne_literal/not_ne_string + + When CEL expression "'abc' != 'abc'" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: ne_literal/ne_string_unicode + + When CEL expression "'résumé' != 'resume'" is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: ne_literal/not_ne_string_unicode -Scenario: ne_list_empty + When CEL expression "'ίδιο' != 'ίδιο'" is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "[] != [1]" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: ne_literal/ne_bytes + When CEL expression "b'\\x00\\xFF' != b'ÿ'" is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: not_ne_list_empty +Scenario: ne_literal/not_ne_bytes - When CEL expression "[] != []" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression "b'\\303\\277' != b'ÿ'" is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: ne_literal/ne_bool -Scenario: ne_list_bool + When CEL expression 'false != true' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "[true, false, true] != [true, true, false]" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: ne_literal/not_ne_bool + When CEL expression 'true != true' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: not_ne_list_bool +Scenario: ne_literal/not_ne_null + null can only be equal to null, or else it won't match - When CEL expression "[false, true] != [false, true]" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression 'null != null' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: ne_literal/ne_list_empty -Scenario: not_ne_list_of_list + When CEL expression '[] != [1]' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "[[]] != [[]]" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: ne_literal/not_ne_list_empty + When CEL expression '[] != []' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: ne_map_by_value +Scenario: ne_literal/ne_list_bool - When CEL expression "{'k':'v'} != {'k':'v1'}" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression '[true, false, true] != [true, true, false]' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: ne_literal/not_ne_list_bool -Scenario: ne_map_by_key + When CEL expression '[false, true] != [false, true]' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "{'k':true} != {'k1':true}" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: ne_literal/not_ne_list_of_list + + When CEL expression '[[]] != [[]]' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: ne_literal/ne_map_by_value + When CEL expression "{'k':'v'} != {'k':'v1'}" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: ne_literal/ne_map_by_key -Scenario: not_ne_map_int_to_float + When CEL expression "{'k':true} != {'k1':true}" is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "{1:1.0} != {1:1.0}" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: ne_literal/not_ne_map_int_to_float + When CEL expression '{1:1.0} != {1:1.0}' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: not_ne_map_key_order +Scenario: ne_literal/not_ne_map_key_order When CEL expression "{'a':'b','c':'d'} != {'c':'d','a':'b'}" is evaluated - # bool_value:false - Then value is BoolType(source=False) + Then value is celpy.celtypes.BoolType(source=False) +@wip +Scenario: ne_literal/ne_mixed_types -Scenario: ne_mixed_types_error + Given disable_check parameter is True + When CEL expression '2u != 2' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "2u != 2" is evaluated - # errors:{message:"no such overload"} - Then eval_error is 'no such overload' +Scenario: ne_literal/ne_proto2 + Given container is 'cel.expr.conformance.proto2' + When CEL expression "TestAllTypes{single_int64: 1234, single_string: '1234'} != TestAllTypes{single_int64: 1234, single_string: '1234'}" is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: ne_literal/ne_proto3 -# lt_literal -- Literals comparison on _<_. (a < b) == (b > a) == !(a >= b) == !(b <= a) + Given container is 'cel.expr.conformance.proto3' + When CEL expression "TestAllTypes{single_int64: 1234, single_string: '1234'} != TestAllTypes{single_int64: 1234, single_string: '1234'}" is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: lt_int +Scenario: ne_literal/ne_proto2_missing_fields_neq - When CEL expression "-1 < 0" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Given container is 'cel.expr.conformance.proto2' + When CEL expression "TestAllTypes{single_int64: 1234} != TestAllTypes{single_string: '1234'}" is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: ne_literal/ne_proto3_missing_fields_neq -Scenario: not_lt_int + Given container is 'cel.expr.conformance.proto3' + When CEL expression "TestAllTypes{single_int64: 1234} != TestAllTypes{single_string: '1234'}" is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "0 < 0" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: ne_literal/ne_proto_nan_not_equal + For proto equality, NaN field values are not considered equal. + Given container is 'cel.expr.conformance.proto2' + When CEL expression "TestAllTypes{single_double: double('NaN')} != TestAllTypes{single_double: double('NaN')}" is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: lt_uint +@wip +Scenario: ne_literal/ne_proto_different_types + At runtime, comparing differently typed messages is false. - When CEL expression "0u < 1u" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'dyn(TestAllTypes{}) != dyn(NestedTestAllTypes{})' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +@wip +Scenario: ne_literal/ne_proto2_any_unpack + Any values should be unpacked and compared. -Scenario: not_lt_uint + Given container is 'cel.expr.conformance.proto2' + When CEL expression "TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001r\\0041234'}} != TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'r\\0041234\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001'}}" is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "2u < 2u" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: ne_literal/ne_proto2_any_unpack_bytewise_fallback + If an any field is missing its type_url, the comparison should + fallback to a bytewise comparison of the serialized proto. + Given container is 'cel.expr.conformance.proto3' + When CEL expression "TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\242\\006\\023\\022\\021\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001r\\0041234'}} != TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\242\\006\\023\\022\\021r\\0041234\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001'}}" is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: lt_double +@wip +Scenario: ne_literal/ne_proto3_any_unpack + Any values should be unpacked and compared. - When CEL expression "1.0 < 1.0000001" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Given container is 'cel.expr.conformance.proto2' + When CEL expression "TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001r\\0041234'}} != TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'r\\0041234\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001'}}" is evaluated + Then value is celpy.celtypes.BoolType(source=False) +@wip +Scenario: ne_literal/ne_proto3_any_unpack_bytewise_fallback + If an any field is missing its type_url, the comparison should + fallback to a bytewise comparison of the serialized proto. -Scenario: not_lt_double - Following IEEE 754, negative zero compares equal to zero - When CEL expression "-0.0 < 0.0" is evaluated - # bool_value:false - Then value is BoolType(source=False) + Given container is 'cel.expr.conformance.proto3' + When CEL expression "TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\242\\006\\023\\022\\021\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001r\\0041234'}} != TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\242\\006\\023\\022\\021r\\0041234\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001'}}" is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: lt_string +# lt_literal -- Literals comparison on _<_. (a < b) == (b > a) == !(a >= b) == !(b <= a) - When CEL expression "'a' < 'b'" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: lt_literal/lt_int + When CEL expression '-1 < 0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: lt_string_empty_to_nonempty +Scenario: lt_literal/not_lt_int - When CEL expression "'' < 'a'" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression '0 < 0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: lt_literal/lt_uint -Scenario: lt_string_case + When CEL expression '0u < 1u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "'Abc' < 'aBC'" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: lt_literal/not_lt_uint + When CEL expression '2u < 2u' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: lt_string_length +Scenario: lt_literal/lt_double - When CEL expression "'abc' < 'abcd'" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression '1.0 < 1.0000001' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: lt_literal/not_lt_double + Following IEEE 754, negative zero compares equal to zero -Scenario: lt_string_diacritical_mark_sensitive - Verifies that the we're not using a string comparison function that strips diacritical marks (á) - When CEL expression "'a' < '\u00E1'" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression '-0.0 < 0.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: lt_literal/lt_string -Scenario: not_lt_string_empty + When CEL expression "'a' < 'b'" is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "'' < ''" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: lt_literal/lt_string_empty_to_nonempty + When CEL expression "'' < 'a'" is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: not_lt_string_same +Scenario: lt_literal/lt_string_case - When CEL expression "'abc' < 'abc'" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression "'Abc' < 'aBC'" is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: lt_literal/lt_string_length -Scenario: not_lt_string_case_length + When CEL expression "'abc' < 'abcd'" is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "'a' < 'AB'" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: lt_literal/lt_string_diacritical_mark_sensitive + Verifies that the we're not using a string comparison function that + strips diacritical marks (á) + When CEL expression "'a' < '\\u00E1'" is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: unicode_order_lexical - Compare the actual code points of the string, instead of decomposing ế into 'e' plus accent modifiers. - When CEL expression "'f' < '\u1EBF'" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: lt_literal/not_lt_string_empty + When CEL expression "'' < ''" is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: lt_bytes +Scenario: lt_literal/not_lt_string_same - When CEL expression "b'a' < b'b'" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression "'abc' < 'abc'" is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: lt_literal/not_lt_string_case_length -Scenario: not_lt_bytes_same + When CEL expression "'a' < 'AB'" is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "b'abc' < b'abc'" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: lt_literal/unicode_order_lexical + Compare the actual code points of the string, instead of decomposing ế + into 'e' plus accent modifiers. + When CEL expression "'f' < '\\u1EBF'" is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: not_lt_bytes_width +Scenario: lt_literal/lt_bytes - When CEL expression "b'á' < b'b'" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression "b'a' < b'b'" is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: lt_literal/not_lt_bytes_same -Scenario: lt_bool_false_first + When CEL expression "b'abc' < b'abc'" is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "false < true" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: lt_literal/not_lt_bytes_width + When CEL expression "b'á' < b'b'" is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: not_lt_bool_same +Scenario: lt_literal/lt_bool_false_first - When CEL expression "true < true" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression 'false < true' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: lt_literal/not_lt_bool_same -Scenario: not_lt_bool_true_first + When CEL expression 'true < true' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "true < false" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: lt_literal/not_lt_bool_true_first + When CEL expression 'true < false' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: lt_list_unsupported +Scenario: lt_literal/lt_list_unsupported - When CEL expression "[0] < [1]" is evaluated - # errors:{message:"no such overload"} + Given disable_check parameter is True + When CEL expression '[0] < [1]' is evaluated Then eval_error is 'no such overload' +Scenario: lt_literal/lt_map_unsupported -Scenario: lt_map_unsupported - + Given disable_check parameter is True When CEL expression "{0:'a'} < {1:'b'}" is evaluated - # errors:{message:"no such overload"} Then eval_error is 'no such overload' - -Scenario: lt_null_unsupported +Scenario: lt_literal/lt_null_unsupported Ensure _<_ doesn't have a binding for null - When CEL expression "null < null" is evaluated - # errors:{message:"no such overload"} - Then eval_error is 'no such overload' + Given disable_check parameter is True + When CEL expression 'null < null' is evaluated + Then eval_error is 'no such overload' -Scenario: lt_mixed_types_error +Scenario: lt_literal/lt_mixed_types_error + Given disable_check parameter is True When CEL expression "'foo' < 1024" is evaluated - # errors:{message:"no such overload"} Then eval_error is 'no such overload' +@wip +Scenario: lt_literal/lt_dyn_int_uint + When CEL expression 'dyn(1) < 2u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -# gt_literal -- Literals comparison on _>_ +@wip +Scenario: lt_literal/lt_dyn_int_double -Scenario: gt_int + When CEL expression 'dyn(1) < 2.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "42 > -42" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: lt_literal/lt_dyn_uint_int + When CEL expression 'dyn(1u) < 2' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: not_gt_int +Scenario: lt_literal/lt_dyn_uint_double - When CEL expression "0 > 0" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression 'dyn(1u) < 2.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: lt_literal/lt_dyn_double_int -Scenario: gt_uint + When CEL expression 'dyn(1.0) < 2' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "48u > 46u" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: lt_literal/lt_dyn_double_uint + When CEL expression 'dyn(1.0) < 2u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: not_gt_uint +@wip +Scenario: lt_literal/not_lt_dyn_int_uint - When CEL expression "0u > 999u" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression 'dyn(1) < 1u' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +@wip +Scenario: lt_literal/not_lt_dyn_int_double -Scenario: gt_double + When CEL expression 'dyn(1) < 1.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "1e+1 > 1e+0" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: lt_literal/not_lt_dyn_uint_int + When CEL expression 'dyn(1u) < 1' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: not_gt_double +Scenario: lt_literal/not_lt_dyn_uint_double - When CEL expression ".99 > 9.9e-1" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression 'dyn(1u) < 1.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: lt_literal/not_lt_dyn_double_int -Scenario: gt_string_case + When CEL expression 'dyn(1.0) < 1' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "'abc' > 'aBc'" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: lt_literal/not_lt_dyn_double_uint + When CEL expression 'dyn(1.0) < 1u' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: gt_string_to_empty +@wip +Scenario: lt_literal/lt_dyn_int_big_uint - When CEL expression "'A' > ''" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'dyn(1) < 9223372036854775808u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +@wip +Scenario: lt_literal/lt_dyn_small_int_uint -Scenario: not_gt_string_empty_to_empty + When CEL expression 'dyn(-1) < 0u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "'' > ''" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: lt_literal/not_lt_dyn_int_big_lossy_double + When CEL expression 'dyn(9223372036854775807) < 9223372036854775808.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: gt_string_unicode +@wip +Scenario: lt_literal/lt_dyn_int_big_lossy_double - When CEL expression "'α' > 'omega'" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'dyn(9223372036854775807) < 9223372036854777857.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +@wip +Scenario: lt_literal/not_lt_dyn_int_small_double -Scenario: gt_bytes_one + When CEL expression 'dyn(9223372036854775807) < -9223372036854777857.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "b'' > b''" is evaluated - # bool_value:true - Then value is BoolType(source=True) +@wip +Scenario: lt_literal/not_lt_dyn_int_small_lossy_double + When CEL expression 'dyn(-9223372036854775808) < -9223372036854775809.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: gt_bytes_one_to_empty +Scenario: lt_literal/not_lt_dyn_uint_small_int - When CEL expression "b'' > b''" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'dyn(1u) < -9223372036854775808' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: lt_literal/not_lt_dyn_big_uint_int -Scenario: not_gt_bytes_sorting + When CEL expression 'dyn(9223372036854775808u) < 1' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "b'' > b''" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: lt_literal/not_lt_dyn_uint_small_double + When CEL expression 'dyn(18446744073709551615u) < -1.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: gt_bool_true_false +Scenario: lt_literal/lt_dyn_uint_big_double - When CEL expression "true > false" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'dyn(18446744073709551615u) < 18446744073709590000.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: lt_literal/not_lt_dyn_big_double_uint -Scenario: not_gt_bool_false_true + When CEL expression 'dyn(18446744073709553665.0) < 18446744073709551615u' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "false > true" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: lt_literal/not_lt_dyn_big_double_int + When CEL expression 'dyn(9223372036854775808.0) < 9223372036854775807' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: not_gt_bool_same +@wip +Scenario: lt_literal/not_lt_dyn_small_double_int - When CEL expression "true > true" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression 'dyn(-9223372036854775809.0) < -9223372036854775808' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: gt_null_unsupported +# gt_literal -- Literals comparison on _>_ - When CEL expression "null > null" is evaluated - # errors:{message:"no such overload"} - Then eval_error is 'no such overload' +Scenario: gt_literal/gt_int + + When CEL expression '42 > -42' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: gt_literal/not_gt_int + + When CEL expression '0 > 0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: gt_literal/gt_uint + + When CEL expression '48u > 46u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: gt_literal/not_gt_uint + + When CEL expression '0u > 999u' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: gt_literal/gt_double + + When CEL expression '1e+1 > 1e+0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: gt_literal/not_gt_double + When CEL expression '.99 > 9.9e-1' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: gt_list_unsupported +Scenario: gt_literal/gt_string_case - When CEL expression "[1] > [0]" is evaluated - # errors:{message:"no such overload"} + When CEL expression "'abc' > 'aBc'" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: gt_literal/gt_string_to_empty + + When CEL expression "'A' > ''" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: gt_literal/not_gt_string_empty_to_empty + + When CEL expression "'' > ''" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: gt_literal/gt_string_unicode + + When CEL expression "'α' > 'omega'" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: gt_literal/gt_bytes_one + + When CEL expression "b'\x01' > b'\x00'" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: gt_literal/gt_bytes_one_to_empty + + When CEL expression "b'\x00' > b''" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: gt_literal/not_gt_bytes_sorting + + When CEL expression "b'\x00\x01' > b'\x01'" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: gt_literal/gt_bool_true_false + + When CEL expression 'true > false' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: gt_literal/not_gt_bool_false_true + + When CEL expression 'false > true' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: gt_literal/not_gt_bool_same + + When CEL expression 'true > true' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: gt_literal/gt_null_unsupported + + Given disable_check parameter is True + When CEL expression 'null > null' is evaluated Then eval_error is 'no such overload' +Scenario: gt_literal/gt_list_unsupported -Scenario: gt_map_unsupported + Given disable_check parameter is True + When CEL expression '[1] > [0]' is evaluated + Then eval_error is 'no such overload' +Scenario: gt_literal/gt_map_unsupported + + Given disable_check parameter is True When CEL expression "{1:'b'} > {0:'a'}" is evaluated - # errors:{message:"no such overload"} Then eval_error is 'no such overload' +Scenario: gt_literal/gt_mixed_types_error -Scenario: gt_mixed_types_error - + Given disable_check parameter is True When CEL expression "'foo' > 1024" is evaluated - # errors:{message:"no such overload"} Then eval_error is 'no such overload' +@wip +Scenario: gt_literal/gt_dyn_int_uint + When CEL expression 'dyn(2) > 1u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -# lte_literal -- Literals comparison on _<=_ +@wip +Scenario: gt_literal/gt_dyn_int_double -Scenario: lte_int_lt + When CEL expression 'dyn(2) > 1.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "0 <= 1" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: gt_literal/gt_dyn_uint_int + When CEL expression 'dyn(2u) > 1' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: lte_int_eq +Scenario: gt_literal/gt_dyn_uint_double - When CEL expression "1 <= 1" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'dyn(2u) > 1.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: gt_literal/gt_dyn_double_int -Scenario: not_lte_int_gt + When CEL expression 'dyn(2.0) > 1' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "1 <= -1" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: gt_literal/gt_dyn_double_uint + When CEL expression 'dyn(2.0) > 1u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: lte_uint_lt +@wip +Scenario: gt_literal/not_gt_dyn_int_uint - When CEL expression "0u <= 1u" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'dyn(1) > 1u' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +@wip +Scenario: gt_literal/not_gt_dyn_int_double -Scenario: lte_uint_eq + When CEL expression 'dyn(1) > 1.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "1u <= 1u" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: gt_literal/not_gt_dyn_uint_int + When CEL expression 'dyn(1u) > 1' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: not_lte_uint_gt +Scenario: gt_literal/not_gt_dyn_uint_double - When CEL expression "1u <= 0u" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression 'dyn(1u) > 1.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: gt_literal/not_gt_dyn_double_int -Scenario: lte_double_lt + When CEL expression 'dyn(1.0) > 1' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "0.0 <= 0.1e-31" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: gt_literal/not_gt_dyn_double_uint + When CEL expression 'dyn(1.0) > 1u' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: lte_double_eq +@wip +Scenario: gt_literal/not_gt_dyn_int_big_uint - When CEL expression "0.0 <= 0e-1" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'dyn(1) > 9223372036854775808u' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +@wip +Scenario: gt_literal/not_gt_dyn_small_int_uint -Scenario: not_lte_double_gt + When CEL expression 'dyn(-1) > 0u' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "1.0 <= 0.99" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: gt_literal/not_gt_dyn_int_big_double + When CEL expression 'dyn(9223372036854775807) > 9223372036854775808.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: lte_string_empty +@wip +Scenario: gt_literal/not_gt_dyn_int_small_lossy_double + The conversion of the int to double is lossy and the numbers end up + being equal - When CEL expression "'' <= ''" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'dyn(-9223372036854775808) > -9223372036854775809.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +@wip +Scenario: gt_literal/gt_dyn_int_small_lossy_double_greater -Scenario: lte_string_from_empty + When CEL expression 'dyn(-9223372036854775808) > -9223372036854777857.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "'' <= 'a'" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: gt_literal/gt_dyn_uint_small_int + When CEL expression 'dyn(1u) > -1' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: not_lte_string_to_empty +Scenario: gt_literal/gt_dyn_big_uint_int - When CEL expression "'a' <= ''" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression 'dyn(9223372036854775808u) > 1' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: gt_literal/gt_dyn_uint_small_double -Scenario: lte_string_lexicographical + When CEL expression 'dyn(9223372036854775807u) > -1.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "'aBc' <= 'abc'" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: gt_literal/not_gt_dyn_uint_big_double + When CEL expression 'dyn(18446744073709551615u) > 18446744073709590000.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: lte_string_unicode_eq +Scenario: gt_literal/gt_dyn_big_double_uint - When CEL expression "'α' <= 'α'" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'dyn(18446744073709553665.0) > 18446744073709551615u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +@wip +Scenario: gt_literal/not_gt_dyn_big_double_int -Scenario: lte_string_unicode_lt + When CEL expression 'dyn(9223372036854775808.0) > 9223372036854775807' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "'a' <= 'α'" is evaluated - # bool_value:true - Then value is BoolType(source=True) +@wip +Scenario: gt_literal/not_gt_dyn_small_double_int + When CEL expression 'dyn(-9223372036854775809.0) > -9223372036854775808' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: not_lte_string_unicode - When CEL expression "'α' <= 'a'" is evaluated - # bool_value:false - Then value is BoolType(source=False) +# lte_literal -- Literals comparison on _<=_ +Scenario: lte_literal/lte_int_lt -Scenario: lte_bytes_empty + When CEL expression '0 <= 1' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "b'' <= b''" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: lte_literal/lte_int_eq + When CEL expression '1 <= 1' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: not_lte_bytes_length +Scenario: lte_literal/not_lte_int_gt - When CEL expression "b'' <= b''" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression '1 <= -1' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: lte_literal/lte_uint_lt -Scenario: lte_bool_false_true + When CEL expression '0u <= 1u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "false <= true" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: lte_literal/lte_uint_eq + When CEL expression '1u <= 1u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: lte_bool_false_false +Scenario: lte_literal/not_lte_uint_gt - When CEL expression "false <= false" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression '1u <= 0u' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: lte_literal/lte_double_lt -Scenario: lte_bool_true_false + When CEL expression '0.0 <= 0.1e-31' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "true <= false" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: lte_literal/lte_double_eq + When CEL expression '0.0 <= 0e-1' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: lte_null_unsupported +Scenario: lte_literal/not_lte_double_gt - When CEL expression "null <= null" is evaluated - # errors:{message:"no such overload"} - Then eval_error is 'no such overload' + When CEL expression '1.0 <= 0.99' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: lte_literal/lte_string_empty + + When CEL expression "'' <= ''" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: lte_literal/lte_string_from_empty + + When CEL expression "'' <= 'a'" is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: lte_list_unsupported +Scenario: lte_literal/not_lte_string_to_empty - When CEL expression "[0] <= [0]" is evaluated - # errors:{message:"no such overload"} + When CEL expression "'a' <= ''" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: lte_literal/lte_string_lexicographical + + When CEL expression "'aBc' <= 'abc'" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: lte_literal/lte_string_unicode_eq + + When CEL expression "'α' <= 'α'" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: lte_literal/lte_string_unicode_lt + + When CEL expression "'a' <= 'α'" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: lte_literal/not_lte_string_unicode + + When CEL expression "'α' <= 'a'" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: lte_literal/lte_bytes_empty + + When CEL expression "b'' <= b'\x00'" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: lte_literal/not_lte_bytes_length + + When CEL expression "b'\x01\x00' <= b'\x01'" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: lte_literal/lte_bool_false_true + + When CEL expression 'false <= true' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: lte_literal/lte_bool_false_false + + When CEL expression 'false <= false' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: lte_literal/lte_bool_true_false + + When CEL expression 'true <= false' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: lte_literal/lte_null_unsupported + + Given disable_check parameter is True + When CEL expression 'null <= null' is evaluated Then eval_error is 'no such overload' +Scenario: lte_literal/lte_list_unsupported + + Given disable_check parameter is True + When CEL expression '[0] <= [0]' is evaluated + Then eval_error is 'no such overload' -Scenario: lte_map_unsupported +Scenario: lte_literal/lte_map_unsupported + Given disable_check parameter is True When CEL expression "{0:'a'} <= {1:'b'}" is evaluated - # errors:{message:"no such overload"} Then eval_error is 'no such overload' +Scenario: lte_literal/lte_mixed_types_error -Scenario: lte_mixed_types_error - + Given disable_check parameter is True When CEL expression "'foo' <= 1024" is evaluated - # errors:{message:"no such overload"} Then eval_error is 'no such overload' +@wip +Scenario: lte_literal/lte_dyn_int_uint + When CEL expression 'dyn(1) <= 2u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -# gte_literal -- Literals comparison on _>=_ +@wip +Scenario: lte_literal/lte_dyn_int_double -Scenario: gte_int_gt + When CEL expression 'dyn(1) <= 2.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "0 >= -1" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: lte_literal/lte_dyn_uint_int + When CEL expression 'dyn(1u) <= 2' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: gte_int_eq +Scenario: lte_literal/lte_dyn_uint_double - When CEL expression "999 >= 999" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'dyn(1u) <= 2.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: lte_literal/lte_dyn_double_int -Scenario: not_gte_int_lt + When CEL expression 'dyn(1.0) <= 2' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "999 >= 1000" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: lte_literal/lte_dyn_double_uint + When CEL expression 'dyn(1.0) <= 2u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: gte_uint_gt +@wip +Scenario: lte_literal/not_lte_dyn_int_uint - When CEL expression "1u >= 0u" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'dyn(2) <= 1u' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +@wip +Scenario: lte_literal/not_lte_dyn_int_double -Scenario: gte_uint_eq + When CEL expression 'dyn(2) <= 1.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "0u >= 0u" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: lte_literal/not_lte_dyn_uint_int + When CEL expression 'dyn(2u) <= 1' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: not_gte_uint_lt +Scenario: lte_literal/not_lte_dyn_uint_double - When CEL expression "1u >= 10u" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression 'dyn(2u) <= 1.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: lte_literal/not_lte_dyn_double_int -Scenario: gte_double_gt + When CEL expression 'dyn(2.0) <= 1' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "1e+1 >= 1e+0" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: lte_literal/not_lte_dyn_double_uint + When CEL expression 'dyn(2.0) <= 1u' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: gte_double_eq +@wip +Scenario: lte_literal/lte_dyn_int_big_uint - When CEL expression "9.80665 >= 9.80665e+0" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'dyn(1) <= 9223372036854775808u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +@wip +Scenario: lte_literal/lte_dyn_small_int_uint -Scenario: not_gte_double_lt + When CEL expression 'dyn(-1) <= 0u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "0.9999 >= 1.0" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: lte_literal/lte_dyn_int_big_double + When CEL expression 'dyn(9223372036854775807) <= 9223372036854775808.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: gte_string_empty +@wip +Scenario: lte_literal/lte_dyn_int_small_lossy_double + The conversion of the int to double is lossy and the numbers end up + being equal - When CEL expression "'' >= ''" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'dyn(-9223372036854775808) <= -9223372036854775809.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +@wip +Scenario: lte_literal/not_lte_dyn_int_small_lossy_double_less -Scenario: gte_string_to_empty + When CEL expression 'dyn(-9223372036854775808) <= -9223372036854777857.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "'a' >= ''" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: lte_literal/not_lte_dyn_uint_small_int + When CEL expression 'dyn(1u) <= -9223372036854775808' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: gte_string_empty_to_nonempty +Scenario: lte_literal/not_lte_dyn_big_uint_int - When CEL expression "'' >= 'a'" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression 'dyn(9223372036854775808u) <= 1' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: lte_literal/not_lte_dyn_uint_small_double -Scenario: gte_string_length + When CEL expression 'dyn(18446744073709551615u) <= -1.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "'abcd' >= 'abc'" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: lte_literal/lte_dyn_uint_big_double + When CEL expression 'dyn(18446744073709551615u) <= 18446744073709590000.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: not_gte_string_lexicographical +Scenario: lte_literal/not_lte_dyn_big_double_uint - When CEL expression "'abc' >= 'abd'" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression 'dyn(18446744073709553665.0) <= 18446744073709551615u' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +@wip +Scenario: lte_literal/lte_dyn_big_double_int -Scenario: gte_string_unicode_eq + When CEL expression 'dyn(9223372036854775808.0) <= 9223372036854775807' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "'τ' >= 'τ'" is evaluated - # bool_value:true - Then value is BoolType(source=True) +@wip +Scenario: lte_literal/lte_dyn_small_double_int + When CEL expression 'dyn(-9223372036854775809.0) <= -9223372036854775808' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: gte_string_unicode_gt - When CEL expression "'τ' >= 't'" is evaluated - # bool_value:true - Then value is BoolType(source=True) +# gte_literal -- Literals comparison on _>=_ +Scenario: gte_literal/gte_int_gt -Scenario: not_get_string_unicode + When CEL expression '0 >= -1' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "'t' >= 'τ'" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: gte_literal/gte_int_eq + When CEL expression '999 >= 999' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: gte_bytes_to_empty +Scenario: gte_literal/not_gte_int_lt - When CEL expression "b'' >= b''" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression '999 >= 1000' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: gte_literal/gte_uint_gt -Scenario: not_gte_bytes_empty_to_nonempty + When CEL expression '1u >= 0u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "b'' >= b''" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: gte_literal/gte_uint_eq + When CEL expression '0u >= 0u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: gte_bytes_samelength +Scenario: gte_literal/not_gte_uint_lt - When CEL expression "b'' >= b''" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression '1u >= 10u' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: gte_literal/gte_double_gt -Scenario: gte_bool_gt + When CEL expression '1e+1 >= 1e+0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "true >= false" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: gte_literal/gte_double_eq + When CEL expression '9.80665 >= 9.80665e+0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: gte_bool_eq +Scenario: gte_literal/not_gte_double_lt - When CEL expression "true >= true" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression '0.9999 >= 1.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: gte_literal/gte_string_empty -Scenario: not_gte_bool_lt + When CEL expression "'' >= ''" is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "false >= true" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: gte_literal/gte_string_to_empty + When CEL expression "'a' >= ''" is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: gte_null_unsupported +Scenario: gte_literal/gte_string_empty_to_nonempty - When CEL expression "null >= null" is evaluated - # errors:{message:"no such overload"} - Then eval_error is 'no such overload' + When CEL expression "'' >= 'a'" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: gte_literal/gte_string_length + When CEL expression "'abcd' >= 'abc'" is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: gte_list_unsupported +Scenario: gte_literal/not_gte_string_lexicographical - When CEL expression "['y'] >= ['x']" is evaluated - # errors:{message:"no such overload"} + When CEL expression "'abc' >= 'abd'" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: gte_literal/gte_string_unicode_eq + + When CEL expression "'τ' >= 'τ'" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: gte_literal/gte_string_unicode_gt + + When CEL expression "'τ' >= 't'" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: gte_literal/not_get_string_unicode + + When CEL expression "'t' >= 'τ'" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: gte_literal/gte_bytes_to_empty + + When CEL expression "b'\x00' >= b''" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: gte_literal/not_gte_bytes_empty_to_nonempty + + When CEL expression "b'' >= b'\x00'" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: gte_literal/gte_bytes_samelength + + When CEL expression "b'\x00\x01' >= b'\x01\x00'" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: gte_literal/gte_bool_gt + + When CEL expression 'true >= false' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: gte_literal/gte_bool_eq + + When CEL expression 'true >= true' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: gte_literal/not_gte_bool_lt + + When CEL expression 'false >= true' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: gte_literal/gte_null_unsupported + + Given disable_check parameter is True + When CEL expression 'null >= null' is evaluated Then eval_error is 'no such overload' +Scenario: gte_literal/gte_list_unsupported + + Given disable_check parameter is True + When CEL expression "['y'] >= ['x']" is evaluated + Then eval_error is 'no such overload' -Scenario: gte_map_unsupported +Scenario: gte_literal/gte_map_unsupported + Given disable_check parameter is True When CEL expression "{1:'b'} >= {0:'a'}" is evaluated - # errors:{message:"no such overload"} Then eval_error is 'no such overload' +Scenario: gte_literal/gte_mixed_types_error -Scenario: gte_mixed_types_error - + Given disable_check parameter is True When CEL expression "'foo' >= 1.0" is evaluated - # errors:{message:"no such overload"} Then eval_error is 'no such overload' +@wip +Scenario: gte_literal/gte_dyn_int_uint + When CEL expression 'dyn(2) >= 1u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -# in_list_literal -- Set membership tests using list literals and the 'in' operator +@wip +Scenario: gte_literal/gte_dyn_int_double -Scenario: elem_not_in_empty_list + When CEL expression 'dyn(2) >= 1.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "'empty' in []" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: gte_literal/gte_dyn_uint_int + When CEL expression 'dyn(2u) >= 1' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: elem_in_list +Scenario: gte_literal/gte_dyn_uint_double - When CEL expression "'elem' in ['elem', 'elemA', 'elemB']" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'dyn(2u) >= 1.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: gte_literal/gte_dyn_double_int -Scenario: elem_not_in_list + When CEL expression 'dyn(2.0) >= 1' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "'not' in ['elem1', 'elem2', 'elem3']" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: gte_literal/gte_dyn_double_uint + When CEL expression 'dyn(2.0) >= 1u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: elem_in_mixed_type_list - Set membership tests should succeed if the 'elem' exists in a mixed element type list. - When CEL expression "'elem' in [1, 'elem', 2]" is evaluated - # bool_value:true - Then value is BoolType(source=True) +@wip +Scenario: gte_literal/not_gte_dyn_int_uint + When CEL expression 'dyn(0) >= 1u' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: elem_in_mixed_type_list_error - Set membership tests should error if the 'elem' does not exist in a mixed element type list as containment is equivalent to the macro exists() behavior. - When CEL expression "'elem' in [1u, 'str', 2, b'bytes']" is evaluated - # errors:{message:"no such overload"} - Then eval_error is 'no such overload' +@wip +Scenario: gte_literal/not_gte_dyn_int_double + When CEL expression 'dyn(0) >= 1.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: gte_literal/not_gte_dyn_uint_int -# in_map_literal -- Set membership tests using map literals and the 'in' operator + When CEL expression 'dyn(0u) >= 1' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: key_not_in_empty_map +Scenario: gte_literal/not_gte_dyn_uint_double - When CEL expression "'empty' in {}" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression 'dyn(0u) >= 1.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: gte_literal/not_gte_dyn_double_int -Scenario: key_in_map + When CEL expression 'dyn(0.0) >= 1' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "'key' in {'key':'1', 'other':'2'}" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: gte_literal/not_gte_dyn_double_uint + When CEL expression 'dyn(0.0) >= 1u' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: key_not_in_map +@wip +Scenario: gte_literal/not_gte_dyn_int_big_uint - When CEL expression "'key' in {'lock':1, 'gate':2}" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression 'dyn(1) >= 9223372036854775808u' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +@wip +Scenario: gte_literal/not_gte_dyn_small_int_uint -Scenario: key_in_mixed_key_type_map - Map keys are of mixed type, but since the key is present the result is true. - When CEL expression "'key' in {3:3.0, 'key':2u}" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'dyn(-1) >= 0u' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +@wip +Scenario: gte_literal/gte_dyn_int_big_lossy_double -Scenario: key_in_mixed_key_type_map_error + When CEL expression 'dyn(9223372036854775807) >= 9223372036854775808.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "'key' in {1u:'str', 2:b'bytes'}" is evaluated - # errors:{message:"no such overload"} - Then eval_error is 'no such overload' +@wip +Scenario: gte_literal/not_gte_dyn_int_big_double + When CEL expression 'dyn(9223372036854775807) >= 9223372036854777857.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +@wip +Scenario: gte_literal/gte_dyn_int_small_lossy_double_equal + The conversion of the int to double is lossy and the numbers end up + being equal -# bound -- Comparing bound variables with literals or other variables + When CEL expression 'dyn(-9223372036854775808) >= -9223372036854775809.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: bytes_gt_left_false +@wip +Scenario: gte_literal/gte_dyn_int_small_lossy_double_greater - # type:{primitive:BYTES} - # Given type_env parameter "x" is TypeType(value='BYTES') - Given type_env parameter "x" is BYTES + When CEL expression 'dyn(-9223372036854775808) >= -9223372036854777857.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - # bytes_value:"\x00" - Given bindings parameter "x" is BytesType(source=b'\x00') +Scenario: gte_literal/gte_dyn_uint_small_int - When CEL expression "x > b''" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression 'dyn(1u) >= -1' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: gte_literal/gte_dyn_big_uint_int -Scenario: int_lte_right_true + When CEL expression 'dyn(9223372036854775808u) >= 1' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - # type:{primitive:INT64} - # Given type_env parameter "x" is TypeType(value='INT64') - Given type_env parameter "x" is INT64 +Scenario: gte_literal/gte_dyn_uint_small_double - # int64_value:124 - Given bindings parameter "x" is IntType(source=124) + When CEL expression 'dyn(9223372036854775807u) >= -1.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "123 <= x" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: gte_literal/not_gte_dyn_uint_big_double + When CEL expression 'dyn(18446744073709551615u) >= 18446744073709553665.0' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: bool_lt_right_true +Scenario: gte_literal/gte_dyn_big_double_uint - # type:{primitive:BOOL} - # Given type_env parameter "x" is TypeType(value='BOOL') - Given type_env parameter "x" is BOOL + When CEL expression 'dyn(18446744073709553665.0) >= 18446744073709551615u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - # bool_value:true - Given bindings parameter "x" is BoolType(source=True) +Scenario: gte_literal/gte_dyn_big_double_int - When CEL expression "false < x" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'dyn(9223372036854775808.0) >= 9223372036854775807' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +@wip +Scenario: gte_literal/gte_dyn_small_double_int -Scenario: double_ne_left_false + When CEL expression 'dyn(-9223372036854775809.0) >= -9223372036854775808' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - # type:{primitive:DOUBLE} - # Given type_env parameter "x" is TypeType(value='DOUBLE') - Given type_env parameter "x" is DOUBLE - # double_value:9.8 - Given bindings parameter "x" is DoubleType(source=9.8) +# in_list_literal -- Set membership tests using list literals and the 'in' operator - When CEL expression "x != 9.8" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: in_list_literal/elem_not_in_empty_list + When CEL expression "'empty' in []" is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: map_ne_right_false +Scenario: in_list_literal/elem_in_list - # type:{map_type:{key_type:{primitive:STRING} value_type:{primitive:STRING}}} - # Given type_env parameter "x" is TypeType(value='map_type') - Given type_env parameter "x" is map_type + When CEL expression "'elem' in ['elem', 'elemA', 'elemB']" is evaluated + Then value is celpy.celtypes.BoolType(source=True) - # map_value:{entries:{key:{string_value:"c"} value:{string_value:"d"}} entries:{key:{string_value:"a"} value:{string_value:"b"}}} - Given bindings parameter "x" is MapType({StringType(source='c'): StringType(source='d'), StringType(source='a'): StringType(source='b')}) +Scenario: in_list_literal/elem_not_in_list - When CEL expression "{'a':'b','c':'d'} != x" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression "'not' in ['elem1', 'elem2', 'elem3']" is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: in_list_literal/elem_in_mixed_type_list + Set membership tests should succeed if the 'elem' exists in a mixed + element type list. -Scenario: null_eq_left_true - A comparison _==_ against null only binds if the type is determined to be null or we skip the type checking - # type:{null:NULL_VALUE} - # Given type_env parameter "x" is TypeType(value=None) - Given type_env parameter "x" is null_type + When CEL expression "'elem' in [1, 'elem', 2]" is evaluated + Then value is celpy.celtypes.BoolType(source=True) - # null_value:NULL_VALUE - Given bindings parameter "x" is None +@wip +Scenario: in_list_literal/elem_in_mixed_type_list_cross_type + Set membership tests should return false due to the introduction of + heterogeneous-equality. Set membership via 'in' is equivalent to the + macro exists() behavior. - When CEL expression "x == null" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression "'elem' in [1u, 'str', 2, b'bytes']" is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: list_eq_right_false +# in_map_literal -- Set membership tests using map literals and the 'in' operator - # type:{list_type:{elem_type:{primitive:INT64}}} - # Given type_env parameter "x" is TypeType(value='list_type') - Given type_env parameter "x" is list_type +Scenario: in_map_literal/key_not_in_empty_map - # list_value:{values:{int64_value:2} values:{int64_value:1}} - Given bindings parameter "x" is [IntType(source=2), IntType(source=1)] + When CEL expression "'empty' in {}" is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "[1, 2] == x" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: in_map_literal/key_in_map + When CEL expression "'key' in {'key':'1', 'other':'2'}" is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: string_gte_right_true +Scenario: in_map_literal/key_not_in_map - # type:{primitive:STRING} - # Given type_env parameter "x" is TypeType(value='STRING') - Given type_env parameter "x" is STRING + When CEL expression "'key' in {'lock':1, 'gate':2}" is evaluated + Then value is celpy.celtypes.BoolType(source=False) - # string_value:"abc" - Given bindings parameter "x" is StringType(source='abc') +Scenario: in_map_literal/key_in_mixed_key_type_map + Map keys are of mixed type, but since the key is present the result is + true. + + When CEL expression "'key' in {3:3.0, 'key':2u}" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: in_map_literal/key_in_mixed_key_type_map_cross_type + + When CEL expression "'key' in {1u:'str', 2:b'bytes'}" is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "'abcd' >= x" is evaluated - # bool_value:true - Then value is BoolType(source=True) +# bound -- Comparing bound variables with literals or other variables -Scenario: uint_eq_right_false +Scenario: bound/bytes_gt_left_false - # type:{primitive:UINT64} - # Given type_env parameter "x" is TypeType(value='UINT64') - Given type_env parameter "x" is UINT64 + Given type_env parameter "x" is celpy.celtypes.BytesType + and bindings parameter "x" is celpy.celtypes.BytesType(source=b'\x00') + When CEL expression "x > b'\x00'" is evaluated + Then value is celpy.celtypes.BoolType(source=False) - # uint64_value:1000 - Given bindings parameter "x" is UintType(source=1000) +Scenario: bound/int_lte_right_true - When CEL expression "999u == x" is evaluated - # bool_value:false - Then value is BoolType(source=False) + Given type_env parameter "x" is celpy.celtypes.IntType + and bindings parameter "x" is celpy.celtypes.IntType(source=124) + When CEL expression '123 <= x' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: bound/bool_lt_right_true -Scenario: null_lt_right_no_such_overload - There is no _<_ operation for null, even if both operands are null - # type:{null:NULL_VALUE} - # Given type_env parameter "x" is TypeType(value=None) - Given type_env parameter "x" is null_type + Given type_env parameter "x" is celpy.celtypes.BoolType + and bindings parameter "x" is celpy.celtypes.BoolType(source=True) + When CEL expression 'false < x' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - # null_value:NULL_VALUE - Given bindings parameter "x" is None +Scenario: bound/double_ne_left_false - When CEL expression "null < x" is evaluated - # errors:{message:"no such overload"} + Given type_env parameter "x" is celpy.celtypes.DoubleType + and bindings parameter "x" is celpy.celtypes.DoubleType(source=9.8) + When CEL expression 'x != 9.8' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: bound/map_ne_right_false + + Given type_env parameter "x" is celpy.celtypes.MapType + and bindings parameter "x" is celpy.celtypes.MapType({'c': celpy.celtypes.StringType(source='d'), 'a': celpy.celtypes.StringType(source='b')}) + When CEL expression "{'a':'b','c':'d'} != x" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: bound/null_eq_left_true + A comparison _==_ against null only binds if the type is determined to + be null or we skip the type checking + + Given type_env parameter "x" is NoneType + and bindings parameter "x" is None + When CEL expression 'x == null' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: bound/list_eq_right_false + + Given type_env parameter "x" is celpy.celtypes.ListType + and bindings parameter "x" is [celpy.celtypes.IntType(source=2), celpy.celtypes.IntType(source=1)] + When CEL expression '[1, 2] == x' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: bound/string_gte_right_true + + Given type_env parameter "x" is celpy.celtypes.StringType + and bindings parameter "x" is celpy.celtypes.StringType(source='abc') + When CEL expression "'abcd' >= x" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: bound/uint_eq_right_false + + Given type_env parameter "x" is celpy.celtypes.UintType + and bindings parameter "x" is celpy.celtypes.UintType(source=1000) + When CEL expression '999u == x' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: bound/null_lt_right_no_such_overload + There is no _<_ operation for null, even if both operands are null + + Given disable_check parameter is True + and bindings parameter "x" is None + When CEL expression 'null < x' is evaluated Then eval_error is 'no such overload' + diff --git a/features/comparisons.textproto b/features/comparisons.textproto index a01b6f7..e712196 100644 --- a/features/comparisons.textproto +++ b/features/comparisons.textproto @@ -1,3 +1,6 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: cel.expr.conformance.test.SimpleTestFile + name: "comparisons" description: "Tests for boolean-valued functions and operators." section { @@ -13,6 +16,26 @@ section { expr: "-1 == 1" value: { bool_value: false } } + test { + name: "eq_int_uint" + expr: "dyn(1) == 1u" + value: { bool_value: true } + } + test { + name: "not_eq_int_uint" + expr: "dyn(2) == 1u" + value: { bool_value: false } + } + test { + name: "eq_int_double" + expr: "dyn(1) == 1.0" + value: { bool_value: true } + } + test { + name: "not_eq_int_double" + expr: "dyn(2) == 1.0" + value: { bool_value: false } + } test { name: "eq_uint" expr: "2u == 2u" @@ -23,6 +46,26 @@ section { expr: "1u == 2u" value: { bool_value: false } } + test { + name: "eq_uint_int" + expr: "dyn(1u) == 1" + value: { bool_value: true } + } + test { + name: "not_eq_uint_int" + expr: "dyn(2u) == 1" + value: { bool_value: false } + } + test { + name: "eq_uint_double" + expr: "dyn(1u) == 1.0" + value: { bool_value: true } + } + test { + name: "not_eq_uint_double" + expr: "dyn(2u) == 1.0" + value: { bool_value: false } + } test { name: "eq_double" expr: "1.0 == 1.0e+0" @@ -34,11 +77,40 @@ section { value: { bool_value: false } } test { - name: "eq_double_NaN" - description: "CEL defines all NaN values to be equal." - expr: "1.0 / 0.0 == 1.0 / 0.0" + name: "not_eq_double_nan" + expr: "0.0/0.0 == 0.0/0.0" + value: { bool_value: false } + } + test { + name: "not_eq_int_double_nan" + expr: "dyn(1) == 0.0/0.0" + value: { bool_value: false } + } + test { + name: "not_eq_uint_double_nan" + expr: "dyn(1u) == 0.0/0.0" + value: { bool_value: false } + } + test { + name: "eq_double_int" + expr: "dyn(1.0) == 1" + value: { bool_value: true } + } + test { + name: "not_eq_double_int" + expr: "dyn(2.0) == 1" + value: { bool_value: false } + } + test { + name: "eq_double_uint" + expr: "dyn(1.0) == 1u" value: { bool_value: true } } + test { + name: "not_eq_double_uint" + expr: "dyn(2.0) == 1u" + value: { bool_value: false } + } test { name: "eq_string" expr: "'' == \"\"" @@ -75,12 +147,6 @@ section { expr: "'Am\\u00E9lie' == 'Ame\\u0301lie'" value: { bool_value: false } } - test { - name: "no_string_normalization_surrogate" - description: "Should not replace surrogate pairs." - expr: "'\\U0001F436' == '\\xef\\xbf\\xbd\\xef\\xbf\\bd'" - value: { bool_value: false } - } test { name: "eq_null" expr: "null == null" @@ -112,11 +178,31 @@ section { expr: "[] == []" value: { bool_value: true } } + test { + name: "eq_list_null" + expr: "[null] == [null]" + value: { bool_value: true } + } + test { + name: "not_eq_list_null" + expr: "['1', '2', null] == ['1', '2', '3']" + value: { bool_value: false } + } test { name: "eq_list_numbers" expr: "[1, 2, 3] == [1, 2, 3]" value: { bool_value: true } } + test { + name: "eq_list_mixed_type_numbers" + expr: "[1.0, 2.0, 3] == [1u, 2, 3u]" + value: { bool_value: true } + } + test { + name: "not_eq_list_mixed_type_numbers" + expr: "[1.0, 2.1] == [1u, 2]" + value: { bool_value: false } + } test { name: "not_eq_list_order" expr: "[1, 2, 3] == [1, 3, 2]" @@ -143,28 +229,43 @@ section { expr: "{} == {}" value: { bool_value: true } } + test { + name: "eq_map_null" + expr: "{'k': null} == {'k': null}" + value: { bool_value: true } + } + test { + name: "not_eq_map_null" + expr: "{'k': 1, 'j': 2} == {'k': 1, 'j': null}" + value: { bool_value: false } + } test { name: "eq_map_onekey" expr: "{'k':'v'} == {\"k\":\"v\"}" value: { bool_value: true } } test { - name: "eq_map_doublevalue" + name: "eq_map_double_value" expr: "{'k':1.0} == {'k':1e+0}" value: { bool_value: true } } + test { + name: "eq_map_mixed_type_numbers" + expr: "{1: 1.0, 2u: 3u} == {1u: 1, 2: 3.0}" + value: { bool_value: true } + } test { name: "not_eq_map_value" expr: "{'k':'v'} == {'k':'v1'}" value: { bool_value: false } } test { - name: "not_eq_map_extrakey" + name: "not_eq_map_extra_key" expr: "{'k':'v','k1':'v1'} == {'k':'v'}" value: { bool_value: false } } test { - name: "eq_map_keyorder" + name: "eq_map_key_order" expr: "{'k1':'v1','k2':'v2'} == {'k2':'v2','k1':'v1'}" value: { bool_value: true } } @@ -179,30 +280,531 @@ section { value: { bool_value: false } } test { - name: "eq_mixed_types_error" - description: "A mix of types fails during type checks but can't be captured in the conformance tests yet (See google/cel-go#155). Also, if you disable checks it yields {bool_value: false} where it should also yield an error" + name: "eq_mixed_types" expr: "1.0 == 1" - disable_check: true # need to make it fail in the evaluation phase - eval_error { - errors: { message: "no such overload" } - } + disable_check: true # need to make it fail in the evaluation phase + value: { bool_value: true } } test { - name: "eq_list_elem_mixed_types_error" - description: "A mix of types in a list fails during type checks. See #self_test_equals_mixed_types" + name: "eq_list_elem_mixed_types" expr: "[1] == [1.0]" - disable_check: true # need to make it fail in the evaluation phase - eval_error: { - errors: { message: "no such overload" } - } + disable_check: true # need to make it fail in the evaluation phase + value: { bool_value: true } } test { - name: "eq_map_value_mixed_types_error" - description: "Mixed map value types yields error as key '1' values differed by type." + name: "eq_map_value_mixed_types" expr: "{'k':'v', 1:1} == {'k':'v', 1:'v1'}" - eval_error: { - errors: { message: "no such overload" } - } + value: { bool_value: false } + } + test { + name: "eq_dyn_json_null" + expr: "dyn(google.protobuf.Value{}) == null" + value: { bool_value: true } + } + test { + name: "not_eq_dyn_bool_null" + expr: "dyn(false) == null" + value: { bool_value: false } + } + test { + name: "not_eq_dyn_bytes_null" + expr: "dyn(b'') == null" + value: { bool_value: false } + } + test { + name: "not_eq_dyn_double_null" + expr: "dyn(2.1) == null" + value: { bool_value: false } + } + test { + name: "not_eq_dyn_duration_null" + expr: "dyn(duration('0s')) == null" + value: { bool_value: false } + } + test { + name: "not_eq_dyn_int_null" + expr: "dyn(1) == null" + value: { bool_value: false } + } + test { + name: "not_eq_dyn_list_null" + expr: "dyn([]) == null" + value: { bool_value: false } + } + test { + name: "not_eq_dyn_map_null" + expr: "dyn({}) == null" + value: { bool_value: false } + } + test { + name: "not_eq_dyn_proto2_msg_null" + container: "cel.expr.conformance.proto2" + expr: "dyn(TestAllTypes{}) == null" + value: { bool_value: false } + } + test { + name: "not_eq_dyn_proto3_msg_null" + container: "cel.expr.conformance.proto3" + expr: "dyn(TestAllTypes{}) == null" + value: { bool_value: false } + } + test { + name: "not_eq_dyn_string_null" + expr: "dyn('') == null" + value: { bool_value: false } + } + test { + name: "not_eq_dyn_timestamp_null" + expr: "dyn(timestamp(0)) == null" + value: { bool_value: false } + } + test { + name: "not_eq_list_elem_null" + expr: "[1, 2, null] == [1, null, 3]" + value: { bool_value: false } + } + test { + name: "not_eq_map_value_null" + expr: "{1:'hello', 2:'world'} == {1:'goodbye', 2:null}" + value: { bool_value: false } + } + test { + name: "eq_dyn_int_uint" + expr: "dyn(1) == 1u" + value: { bool_value: true } + } + test { + name: "eq_dyn_int_double" + expr: "dyn(1) == 1.0" + value: { bool_value: true } + } + test { + name: "eq_dyn_uint_int" + expr: "dyn(1u) == 1" + value: { bool_value: true } + } + test { + name: "eq_dyn_uint_double" + expr: "dyn(1u) == 1.0" + value: { bool_value: true } + } + test { + name: "eq_dyn_double_int" + expr: "dyn(1.0) == 1" + value: { bool_value: true } + } + test { + name: "eq_dyn_double_uint" + expr: "dyn(1.0) == 1u" + value: { bool_value: true } + } + test { + name: "not_eq_dyn_int_uint" + expr: "dyn(1) == 2u" + value: { bool_value: false } + } + test { + name: "not_eq_dyn_int_double" + expr: "dyn(1) == 2.0" + value: { bool_value: false } + } + test { + name: "not_eq_dyn_uint_int" + expr: "dyn(1u) == 2" + value: { bool_value: false } + } + test { + name: "not_eq_dyn_uint_double" + expr: "dyn(1u) == 120" + value: { bool_value: false } + } + test { + name: "not_eq_dyn_double_int" + expr: "dyn(1.0) == 2" + value: { bool_value: false } + } + test { + name: "not_eq_dyn_double_uint" + expr: "dyn(1.0) == 2u" + value: { bool_value: false } + } +} +section { + name: "eq_wrapper" + description: "Wrapper type comparison on _==_. Wrapper types treated as boxed primitives when they appear on message fields. An unset wrapper field should be treated as null. The tests show the distinction between unset, empty, and set equality behavior." + test { + name: "eq_bool" + expr: "google.protobuf.BoolValue{value: true} == true" + value: { bool_value: true } + } + test { + name: "eq_bool_empty" + expr: "google.protobuf.BoolValue{} == false" + value: { bool_value: true } + } + test { + name: "eq_bool_not_null" + expr: "google.protobuf.BoolValue{} != null" + value: { bool_value: true } + } + test { + name: "eq_bool_proto2_null" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{}.single_bool_wrapper == null" + value: { bool_value: true } + } + test { + name: "eq_bool_proto3_null" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{}.single_bool_wrapper == null" + value: { bool_value: true } + } + + test { + name: "eq_bytes" + expr: "google.protobuf.BytesValue{value: b'set'} == b'set'" + value: { bool_value: true } + } + test { + name: "eq_bytes_empty" + expr: "google.protobuf.BytesValue{} == b''" + value: { bool_value: true } + } + test { + name: "eq_bytes_not_null" + expr: "google.protobuf.BytesValue{} != null" + value: { bool_value: true } + } + test { + name: "eq_bytes_proto2_null" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{}.single_bytes_wrapper == null" + value: { bool_value: true } + } + test { + name: "eq_bytes_proto3_null" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{}.single_bytes_wrapper == null" + value: { bool_value: true } + } + + test { + name: "eq_double" + expr: "google.protobuf.DoubleValue{value: -1.175494e-40} == -1.175494e-40" + value: { bool_value: true } + } + test { + name: "eq_double_empty" + expr: "google.protobuf.DoubleValue{} == 0.0" + value: { bool_value: true } + } + test { + name: "eq_double_not_null" + expr: "google.protobuf.DoubleValue{} != null" + value: { bool_value: true } + } + test { + name: "eq_double_proto2_null" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{}.single_double_wrapper == null" + value: { bool_value: true } + } + test { + name: "eq_double_proto3_null" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{}.single_double_wrapper == null" + value: { bool_value: true } + } + + test { + name: "eq_float" + expr: "google.protobuf.FloatValue{value: -1.5} == -1.5" + value: { bool_value: true } + } + test { + name: "eq_float_empty" + expr: "google.protobuf.FloatValue{} == 0.0" + value: { bool_value: true } + } + test { + name: "eq_float_not_null" + expr: "google.protobuf.FloatValue{} != null" + value: { bool_value: true } + } + test { + name: "eq_float_proto2_null" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{}.single_float_wrapper == null" + value: { bool_value: true } + } + test { + name: "eq_float_proto3_null" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{}.single_float_wrapper == null" + value: { bool_value: true } + } + + test { + name: "eq_int32" + expr: "google.protobuf.Int32Value{value: 123} == 123" + value: { bool_value: true } + } + test { + name: "eq_int32_empty" + expr: "google.protobuf.Int32Value{} == 0" + value: { bool_value: true } + } + test { + name: "eq_int32_not_null" + expr: "google.protobuf.Int32Value{} != null" + value: { bool_value: true } + } + test { + name: "eq_int32_proto2_null" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{}.single_int32_wrapper == null" + value: { bool_value: true } + } + test { + name: "eq_int32_proto3_null" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{}.single_int32_wrapper == null" + value: { bool_value: true } + } + + test { + name: "eq_int64" + expr: "google.protobuf.Int64Value{value: 2147483650} == 2147483650" + value: { bool_value: true } + } + test { + name: "eq_int64_empty" + expr: "google.protobuf.Int64Value{} == 0" + value: { bool_value: true } + } + test { + name: "eq_int64_not_null" + expr: "google.protobuf.Int64Value{} != null" + value: { bool_value: true } + } + test { + name: "eq_int64_proto2_null" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{}.single_int64_wrapper == null" + value: { bool_value: true } + } + test { + name: "eq_int64_proto3_null" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{}.single_int64_wrapper == null" + value: { bool_value: true } + } + + test { + name: "eq_string" + expr: "google.protobuf.StringValue{value: 'set'} == 'set'" + value: { bool_value: true } + } + test { + name: "eq_string_empty" + expr: "google.protobuf.StringValue{} == ''" + value: { bool_value: true } + } + test { + name: "eq_string_not_null" + expr: "google.protobuf.StringValue{} != null" + value: { bool_value: true } + } + test { + name: "eq_string_proto2_null" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{}.single_string_wrapper == null" + value: { bool_value: true } + } + test { + name: "eq_string_proto3_null" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{}.single_string_wrapper == null" + value: { bool_value: true } + } + + test { + name: "eq_uint32" + expr: "google.protobuf.UInt32Value{value: 42u} == 42u" + value: { bool_value: true } + } + test { + name: "eq_uint32_empty" + expr: "google.protobuf.UInt32Value{} == 0u" + value: { bool_value: true } + } + test { + name: "eq_uint32_not_null" + expr: "google.protobuf.UInt32Value{} != null" + value: { bool_value: true } + } + test { + name: "eq_uint32_proto2_null" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{}.single_uint32_wrapper == null" + value: { bool_value: true } + } + test { + name: "eq_uint32_proto3_null" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{}.single_uint32_wrapper == null" + value: { bool_value: true } + } + + test { + name: "eq_uint64" + expr: "google.protobuf.UInt64Value{value: 4294967296u} == 4294967296u" + value: { bool_value: true } + } + test { + name: "eq_uint64_empty" + expr: "google.protobuf.UInt64Value{} == 0u" + value: { bool_value: true } + } + test { + name: "eq_uint64_not_null" + expr: "google.protobuf.UInt64Value{} != null" + value: { bool_value: true } + } + test { + name: "eq_uint64_proto2_null" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{}.single_uint64_wrapper == null" + value: { bool_value: true } + } + test { + name: "eq_uint64_proto3_null" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{}.single_uint64_wrapper == null" + value: { bool_value: true } + } + test { + name: "eq_proto2" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{single_int64: 1234, single_string: '1234'} == TestAllTypes{single_int64: 1234, single_string: '1234'}" + value { bool_value: true } + } + test { + name: "eq_proto3" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_int64: 1234, single_string: '1234'} == TestAllTypes{single_int64: 1234, single_string: '1234'}" + value { bool_value: true } + } + test { + name: "eq_proto2_missing_fields_neq" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{single_int64: 1234} == TestAllTypes{single_string: '1234'}" + value { bool_value: false } + } + test { + name: "eq_proto3_missing_fields_neq" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_int64: 1234} == TestAllTypes{single_string: '1234'}" + value { bool_value: false } + } + test { + name: "eq_proto_nan_equal" + container: "cel.expr.conformance.proto2" + description: "For proto equality, fields with NaN value are treated as not equal." + expr: "TestAllTypes{single_double: double('NaN')} == TestAllTypes{single_double: double('NaN')}" + value { bool_value: false } + } + test { + name: "eq_proto_different_types" + container: "cel.expr.conformance.proto2" + description: "At runtime, differently typed messages are treated as not equal." + expr: "dyn(TestAllTypes{}) == dyn(NestedTestAllTypes{})" + value { bool_value: false } + } + test { + name: "eq_proto2_any_unpack_equal" + description: "Any values should be unpacked and compared." + container: "cel.expr.conformance.proto2" + # Two equal messages with any fields serialized differently (but both are valid). + # TestAllTypes{single_any: [TestAllTypes]{single_int64: 1234, single_string: '1234'}} + expr: + "TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001r\\0041234'}} ==" + " TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'r\\0041234\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001'}}" + value { bool_value: true } + } + test { + name: "eq_proto2_any_unpack_not_equal" + description: "Any values should be unpacked and compared." + container: "cel.expr.conformance.proto2" + # Two messages with any fields that are not equal + # TestAllTypes{single_any: [TestAllTypes]{single_int64: 1234, single_string: '1234'}} + # TestAllTypes{single_any: [TestAllTypes]{single_double: -1234.0, single_string: '1234'}} + expr: + "TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'a\\000\\000\\000\\000\\000H\\223\\300r\\0041234'}} ==" + " TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'r\\0041234\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001'}}" + value { bool_value: false } + } + test { + name: "eq_proto2_any_unpack_bytewise_fallback_not_equal" + description: "If an any field is missing its type_url, the comparison should fallback to a bytewise comparison of the serialized proto." + container: "cel.expr.conformance.proto2" + # The missing type info any is doubly nested to skip create message validations. + expr: + "TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\242\\006\\023\\022\\021\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001r\\0041234'}} ==" + " TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\242\\006\\023\\022\\021r\\0041234\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001'}}" + value { bool_value: false } + } + test { + name: "eq_proto2_any_unpack_bytewise_fallback_equal" + description: "If an any field is missing its type_url, the comparison should fallback to a bytewise comparison of the serialized proto." + container: "cel.expr.conformance.proto2" + # The missing type info any is doubly nested to skip create message validations. + expr: + "TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\242\\006\\023\\022\\021\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001r\\0041234'}} ==" + " TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\242\\006\\023\\022\\021\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001r\\0041234'}}" + value { bool_value: true } + } + test { + name: "eq_proto3_any_unpack_equal" + description: "Any values should be unpacked and compared." + container: "cel.expr.conformance.proto3" + # Two equal messages with any fields serialized differently (but both are valid). + expr: + "TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001r\\0041234'}} ==" + " TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'r\\0041234\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001'}}" + value { bool_value: true } + } + test { + name: "eq_proto3_any_unpack_not_equal" + description: "Any values should be unpacked and compared." + container: "cel.expr.conformance.proto3" + # Two messages with any fields that are not equal + # TestAllTypes{single_any: [TestAllTypes]{single_int64: 1234, single_string: '1234'}} + # TestAllTypes{single_any: [TestAllTypes]{single_double: -1234.0, single_string: '1234'}} + expr: + "TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'a\\000\\000\\000\\000\\000H\\223\\300r\\0041234'}} ==" + " TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'r\\0041234\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001'}}" + value { bool_value: false } + } + test { + name: "eq_proto3_any_unpack_bytewise_fallback_not_equal" + description: "If an any field is missing its type_url, the comparison should fallback to a bytewise comparison of the serialized proto." + container: "cel.expr.conformance.proto3" + # The missing type info any is doubly nested to skip create message validations. + expr: + "TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\242\\006\\023\\022\\021\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001r\\0041234'}} ==" + " TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\242\\006\\023\\022\\021r\\0041234\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001'}}" + value { bool_value: false } + } + test { + name: "eq_proto3_any_unpack_bytewise_fallback_equal" + description: "If an any field is missing its type_url, the comparison should fallback to a bytewise comparison of the serialized proto." + container: "cel.expr.conformance.proto3" + # The missing type info any is doubly nested to skip create message validations. + expr: + "TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\242\\006\\023\\022\\021\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001r\\0041234'}} ==" + " TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\242\\006\\023\\022\\021\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001r\\0041234'}}" + value { bool_value: true } } } section { @@ -218,6 +820,26 @@ section { expr: "1 != 1" value: { bool_value: false } } + test { + name: "ne_int_double" + expr: "dyn(24) != 24.1" + value: { bool_value: true } + } + test { + name: "not_ne_int_double" + expr: "dyn(1) != 1.0" + value: { bool_value: false } + } + test { + name: "ne_int_uint" + expr: "dyn(24) != 42u" + value: { bool_value: true } + } + test { + name: "not_ne_int_uint" + expr: "dyn(1) != 1u" + value: { bool_value: false } + } test { name: "ne_uint" expr: "1u != 2u" @@ -228,16 +850,66 @@ section { expr: "99u != 99u" value: { bool_value: false } } + test { + name: "ne_uint_double" + expr: "dyn(1u) != 2.0" + value: { bool_value: true } + } + test { + name: "not_ne_uint_double" + expr: "dyn(99u) != 99.0" + value: { bool_value: false } + } test { name: "ne_double" expr: "9.0e+3 != 9001.0" value: { bool_value: true } } + test { + name: "not_ne_double_nan" + expr: "0.0/0.0 != 0.0/0.0" + value: { bool_value: true } + } + test { + name: "not_ne_int_double_nan" + expr: "dyn(1) != 0.0/0.0" + value: { bool_value: true } + } + test { + name: "not_ne_uint_double_nan" + expr: "dyn(1u) != 0.0/0.0" + value: { bool_value: true } + } test { name: "not_ne_double" expr: "1.0 != 1e+0" value: { bool_value: false } } + test { + name: "ne_double_int" + expr: "dyn(9000) != 9001.0" + value: { bool_value: true } + } + test { + name: "not_ne_double_int" + expr: "dyn(1) != 1e+0" + value: { bool_value: false } + } + test { + name: "ne_double_uint" + expr: "dyn(9000u) != 9001.0" + value: { bool_value: true } + } + test { + name: "not_ne_double_uint" + expr: "dyn(1u) != 1e+0" + value: { bool_value: false } + } + test { + name: "ne_double_nan" + expr: "0.0/0.0 != 0.0/0.0" + value: { bool_value: true } + } test { name: "ne_string" expr: "'abc' != ''" @@ -330,12 +1002,90 @@ section { value: { bool_value: false } } test { - name: "ne_mixed_types_error" + name: "ne_mixed_types" expr: "2u != 2" disable_check: true - eval_error : { - errors: { message: "no such overload" } - } + value: { bool_value: false } + } + test { + name: "ne_proto2" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{single_int64: 1234, single_string: '1234'} != TestAllTypes{single_int64: 1234, single_string: '1234'}" + value { bool_value: false } + } + test { + name: "ne_proto3" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_int64: 1234, single_string: '1234'} != TestAllTypes{single_int64: 1234, single_string: '1234'}" + value { bool_value: false } + } + test { + name: "ne_proto2_missing_fields_neq" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{single_int64: 1234} != TestAllTypes{single_string: '1234'}" + value { bool_value: true } + } + test { + name: "ne_proto3_missing_fields_neq" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_int64: 1234} != TestAllTypes{single_string: '1234'}" + value { bool_value: true } + } + test { + name: "ne_proto_nan_not_equal" + container: "cel.expr.conformance.proto2" + description: "For proto equality, NaN field values are not considered equal." + expr: "TestAllTypes{single_double: double('NaN')} != TestAllTypes{single_double: double('NaN')}" + value { bool_value: true } + } + test { + name: "ne_proto_different_types" + container: "cel.expr.conformance.proto2" + description: "At runtime, comparing differently typed messages is false." + expr: "dyn(TestAllTypes{}) != dyn(NestedTestAllTypes{})" + value: { bool_value: true } + } + test { + name: "ne_proto2_any_unpack" + description: "Any values should be unpacked and compared." + container: "cel.expr.conformance.proto2" + # Two equal messages with any fields serialized differently (but both are valid). + # TestAllTypes{single_any: [TestAllTypes]{single_int64: 1234, single_string: '1234'}} + expr: + "TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001r\\0041234'}} !=" + " TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'r\\0041234\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001'}}" + value { bool_value: false } + } + test { + name: "ne_proto2_any_unpack_bytewise_fallback" + description: "If an any field is missing its type_url, the comparison should fallback to a bytewise comparison of the serialized proto." + container: "cel.expr.conformance.proto3" + # The missing type info any is doubly nested to skip create + # message validations. + expr: + "TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\242\\006\\023\\022\\021\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001r\\0041234'}} !=" + " TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\242\\006\\023\\022\\021r\\0041234\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001'}}" + value { bool_value: true } + } + test { + name: "ne_proto3_any_unpack" + description: "Any values should be unpacked and compared." + container: "cel.expr.conformance.proto2" + # Two equal messages with any fields serialized differently (but both are valid). + expr: + "TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001r\\0041234'}} !=" + " TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'r\\0041234\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001'}}" + value { bool_value: false } + } + test { + name: "ne_proto3_any_unpack_bytewise_fallback" + description: "If an any field is missing its type_url, the comparison should fallback to a bytewise comparison of the serialized proto." + container: "cel.expr.conformance.proto3" + # The missing type info any is doubly nested to skip create message validations. + expr: + "TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\242\\006\\023\\022\\021\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001r\\0041234'}} !=" + " TestAllTypes{single_any: google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\242\\006\\023\\022\\021r\\0041234\\020\\256\\366\\377\\377\\377\\377\\377\\377\\377\\001'}}" + value { bool_value: true } } } section { @@ -475,13 +1225,139 @@ section { } } test { - name: "lt_mixed_types_error" - expr: "'foo' < 1024" - disable_check: true - eval_error : { - errors: { message: "no such overload" } - } + name: "lt_mixed_types_error" + expr: "'foo' < 1024" + disable_check: true + eval_error: { + errors: { message: "no such overload" } + } + } + test { + name: "lt_dyn_int_uint" + expr: "dyn(1) < 2u" + value: { bool_value: true } + } + test { + name: "lt_dyn_int_double" + expr: "dyn(1) < 2.0" + value: { bool_value: true } + } + test { + name: "lt_dyn_uint_int" + expr: "dyn(1u) < 2" + value: { bool_value: true } + } + test { + name: "lt_dyn_uint_double" + expr: "dyn(1u) < 2.0" + value: { bool_value: true } + } + test { + name: "lt_dyn_double_int" + expr: "dyn(1.0) < 2" + value: { bool_value: true } + } + test { + name: "lt_dyn_double_uint" + expr: "dyn(1.0) < 2u" + value: { bool_value: true } + } + test { + name: "not_lt_dyn_int_uint" + expr: "dyn(1) < 1u" + value: { bool_value: false } + } + test { + name: "not_lt_dyn_int_double" + expr: "dyn(1) < 1.0" + value: { bool_value: false } + } + test { + name: "not_lt_dyn_uint_int" + expr: "dyn(1u) < 1" + value: { bool_value: false } + } + test { + name: "not_lt_dyn_uint_double" + expr: "dyn(1u) < 1.0" + value: { bool_value: false } + } + test { + name: "not_lt_dyn_double_int" + expr: "dyn(1.0) < 1" + value: { bool_value: false } + } + test { + name: "not_lt_dyn_double_uint" + expr: "dyn(1.0) < 1u" + value: { bool_value: false } + } + test { + name: "lt_dyn_int_big_uint" + expr: "dyn(1) < 9223372036854775808u" + value: { bool_value: true } + } + test { + name: "lt_dyn_small_int_uint" + expr: "dyn(-1) < 0u" + value: { bool_value: true } + } + test { + name: "not_lt_dyn_int_big_lossy_double" + expr: "dyn(9223372036854775807) < 9223372036854775808.0" + value: { bool_value: false } + } + test { + name: "lt_dyn_int_big_lossy_double" + expr: "dyn(9223372036854775807) < 9223372036854777857.0" + value: { bool_value: true } + } + test { + name: "not_lt_dyn_int_small_double" + expr: "dyn(9223372036854775807) < -9223372036854777857.0" + value: { bool_value: false } + } + test { + name: "not_lt_dyn_int_small_lossy_double" + expr: "dyn(-9223372036854775808) < -9223372036854775809.0" + value: { bool_value: false } + } + test { + name: "not_lt_dyn_uint_small_int" + expr: "dyn(1u) < -9223372036854775808" + value: { bool_value: false } + } + test { + name: "not_lt_dyn_big_uint_int" + expr: "dyn(9223372036854775808u) < 1" + value: { bool_value: false } + } + test { + name: "not_lt_dyn_uint_small_double" + expr: "dyn(18446744073709551615u) < -1.0" + value: { bool_value: false } + } + test { + name: "lt_dyn_uint_big_double" + expr: "dyn(18446744073709551615u) < 18446744073709590000.0" + value: { bool_value: true } + } + test { + name: "not_lt_dyn_big_double_uint" + expr: "dyn(18446744073709553665.0) < 18446744073709551615u" + value: { bool_value: false } + } + test { + name: "not_lt_dyn_big_double_int" + expr: "dyn(9223372036854775808.0) < 9223372036854775807" + value: { bool_value: false } + } + test { + name: "not_lt_dyn_small_double_int" + expr: "dyn(-9223372036854775809.0) < -9223372036854775808" + value: { bool_value: false } } + } section { name: "gt_literal" @@ -594,10 +1470,131 @@ section { name: "gt_mixed_types_error" expr: "'foo' > 1024" disable_check: true - eval_error : { + eval_error: { errors: { message: "no such overload" } } } + test { + name: "gt_dyn_int_uint" + expr: "dyn(2) > 1u" + value: { bool_value: true } + } + test { + name: "gt_dyn_int_double" + expr: "dyn(2) > 1.0" + value: { bool_value: true } + } + test { + name: "gt_dyn_uint_int" + expr: "dyn(2u) > 1" + value: { bool_value: true } + } + test { + name: "gt_dyn_uint_double" + expr: "dyn(2u) > 1.0" + value: { bool_value: true } + } + test { + name: "gt_dyn_double_int" + expr: "dyn(2.0) > 1" + value: { bool_value: true } + } + test { + name: "gt_dyn_double_uint" + expr: "dyn(2.0) > 1u" + value: { bool_value: true } + } + test { + name: "not_gt_dyn_int_uint" + expr: "dyn(1) > 1u" + value: { bool_value: false } + } + test { + name: "not_gt_dyn_int_double" + expr: "dyn(1) > 1.0" + value: { bool_value: false } + } + test { + name: "not_gt_dyn_uint_int" + expr: "dyn(1u) > 1" + value: { bool_value: false } + } + test { + name: "not_gt_dyn_uint_double" + expr: "dyn(1u) > 1.0" + value: { bool_value: false } + } + test { + name: "not_gt_dyn_double_int" + expr: "dyn(1.0) > 1" + value: { bool_value: false } + } + test { + name: "not_gt_dyn_double_uint" + expr: "dyn(1.0) > 1u" + value: { bool_value: false } + } + test { + name: "not_gt_dyn_int_big_uint" + expr: "dyn(1) > 9223372036854775808u" + value: { bool_value: false } + } + test { + name: "not_gt_dyn_small_int_uint" + expr: "dyn(-1) > 0u" + value: { bool_value: false } + } + test { + name: "not_gt_dyn_int_big_double" + expr: "dyn(9223372036854775807) > 9223372036854775808.0" + value: { bool_value: false } + } + test { + name: "not_gt_dyn_int_small_lossy_double" + description: "The conversion of the int to double is lossy and the numbers end up being equal" + expr: "dyn(-9223372036854775808) > -9223372036854775809.0" + value: { bool_value: false } + } + test { + name: "gt_dyn_int_small_lossy_double_greater" + expr: "dyn(-9223372036854775808) > -9223372036854777857.0" + value: { bool_value: true } + } + test { + name: "gt_dyn_uint_small_int" + expr: "dyn(1u) > -1" + value: { bool_value: true } + } + test { + name: "gt_dyn_big_uint_int" + expr: "dyn(9223372036854775808u) > 1" + value: { bool_value: true } + } + test { + name: "gt_dyn_uint_small_double" + expr: "dyn(9223372036854775807u) > -1.0" + value: { bool_value: true } + } + test { + name: "not_gt_dyn_uint_big_double" + expr: "dyn(18446744073709551615u) > 18446744073709590000.0" + value: { bool_value: false } + } + test { + name: "gt_dyn_big_double_uint" + expr: "dyn(18446744073709553665.0) > 18446744073709551615u" + value: { bool_value: true } + } + test { + name: "not_gt_dyn_big_double_int" + expr: "dyn(9223372036854775808.0) > 9223372036854775807" + value: { bool_value: false } + } + test { + name: "not_gt_dyn_small_double_int" + expr: "dyn(-9223372036854775809.0) > -9223372036854775808" + value: { bool_value: false } + } } section { name: "lte_literal" @@ -735,10 +1732,131 @@ section { name: "lte_mixed_types_error" expr: "'foo' <= 1024" disable_check: true - eval_error : { + eval_error: { errors: { message: "no such overload" } } } + test { + name: "lte_dyn_int_uint" + expr: "dyn(1) <= 2u" + value: { bool_value: true } + } + test { + name: "lte_dyn_int_double" + expr: "dyn(1) <= 2.0" + value: { bool_value: true } + } + test { + name: "lte_dyn_uint_int" + expr: "dyn(1u) <= 2" + value: { bool_value: true } + } + test { + name: "lte_dyn_uint_double" + expr: "dyn(1u) <= 2.0" + value: { bool_value: true } + } + test { + name: "lte_dyn_double_int" + expr: "dyn(1.0) <= 2" + value: { bool_value: true } + } + test { + name: "lte_dyn_double_uint" + expr: "dyn(1.0) <= 2u" + value: { bool_value: true } + } + test { + name: "not_lte_dyn_int_uint" + expr: "dyn(2) <= 1u" + value: { bool_value: false } + } + test { + name: "not_lte_dyn_int_double" + expr: "dyn(2) <= 1.0" + value: { bool_value: false } + } + test { + name: "not_lte_dyn_uint_int" + expr: "dyn(2u) <= 1" + value: { bool_value: false } + } + test { + name: "not_lte_dyn_uint_double" + expr: "dyn(2u) <= 1.0" + value: { bool_value: false } + } + test { + name: "not_lte_dyn_double_int" + expr: "dyn(2.0) <= 1" + value: { bool_value: false } + } + test { + name: "not_lte_dyn_double_uint" + expr: "dyn(2.0) <= 1u" + value: { bool_value: false } + } + test { + name: "lte_dyn_int_big_uint" + expr: "dyn(1) <= 9223372036854775808u" + value: { bool_value: true } + } + test { + name: "lte_dyn_small_int_uint" + expr: "dyn(-1) <= 0u" + value: { bool_value: true } + } + test { + name: "lte_dyn_int_big_double" + expr: "dyn(9223372036854775807) <= 9223372036854775808.0" + value: { bool_value: true } + } + test { + name: "lte_dyn_int_small_lossy_double" + description: "The conversion of the int to double is lossy and the numbers end up being equal" + expr: "dyn(-9223372036854775808) <= -9223372036854775809.0" + value: { bool_value: true } + } + test { + name: "not_lte_dyn_int_small_lossy_double_less" + expr: "dyn(-9223372036854775808) <= -9223372036854777857.0" + value: { bool_value: false } + } + test { + name: "not_lte_dyn_uint_small_int" + expr: "dyn(1u) <= -9223372036854775808" + value: { bool_value: false } + } + test { + name: "not_lte_dyn_big_uint_int" + expr: "dyn(9223372036854775808u) <= 1" + value: { bool_value: false } + } + test { + name: "not_lte_dyn_uint_small_double" + expr: "dyn(18446744073709551615u) <= -1.0" + value: { bool_value: false } + } + test { + name: "lte_dyn_uint_big_double" + expr: "dyn(18446744073709551615u) <= 18446744073709590000.0" + value: { bool_value: true } + } + test { + name: "not_lte_dyn_big_double_uint" + expr: "dyn(18446744073709553665.0) <= 18446744073709551615u" + value: { bool_value: false } + } + test { + name: "lte_dyn_big_double_int" + expr: "dyn(9223372036854775808.0) <= 9223372036854775807" + value: { bool_value: true } + } + test { + name: "lte_dyn_small_double_int" + expr: "dyn(-9223372036854775809.0) <= -9223372036854775808" + value: { bool_value: true } + } } section { name: "gte_literal" @@ -886,10 +2004,136 @@ section { name: "gte_mixed_types_error" expr: "'foo' >= 1.0" disable_check: true - eval_error : { + eval_error: { errors: { message: "no such overload" } } } + test { + name: "gte_dyn_int_uint" + expr: "dyn(2) >= 1u" + value: { bool_value: true } + } + test { + name: "gte_dyn_int_double" + expr: "dyn(2) >= 1.0" + value: { bool_value: true } + } + test { + name: "gte_dyn_uint_int" + expr: "dyn(2u) >= 1" + value: { bool_value: true } + } + test { + name: "gte_dyn_uint_double" + expr: "dyn(2u) >= 1.0" + value: { bool_value: true } + } + test { + name: "gte_dyn_double_int" + expr: "dyn(2.0) >= 1" + value: { bool_value: true } + } + test { + name: "gte_dyn_double_uint" + expr: "dyn(2.0) >= 1u" + value: { bool_value: true } + } + test { + name: "not_gte_dyn_int_uint" + expr: "dyn(0) >= 1u" + value: { bool_value: false } + } + test { + name: "not_gte_dyn_int_double" + expr: "dyn(0) >= 1.0" + value: { bool_value: false } + } + test { + name: "not_gte_dyn_uint_int" + expr: "dyn(0u) >= 1" + value: { bool_value: false } + } + test { + name: "not_gte_dyn_uint_double" + expr: "dyn(0u) >= 1.0" + value: { bool_value: false } + } + test { + name: "not_gte_dyn_double_int" + expr: "dyn(0.0) >= 1" + value: { bool_value: false } + } + test { + name: "not_gte_dyn_double_uint" + expr: "dyn(0.0) >= 1u" + value: { bool_value: false } + } + test { + name: "not_gte_dyn_int_big_uint" + expr: "dyn(1) >= 9223372036854775808u" + value: { bool_value: false } + } + test { + name: "not_gte_dyn_small_int_uint" + expr: "dyn(-1) >= 0u" + value: { bool_value: false } + } + test { + name: "gte_dyn_int_big_lossy_double" + expr: "dyn(9223372036854775807) >= 9223372036854775808.0" + value: { bool_value: true } + } + test { + name: "not_gte_dyn_int_big_double" + expr: "dyn(9223372036854775807) >= 9223372036854777857.0" + value: { bool_value: false } + } + test { + name: "gte_dyn_int_small_lossy_double_equal" + description: "The conversion of the int to double is lossy and the numbers end up being equal" + expr: "dyn(-9223372036854775808) >= -9223372036854775809.0" + value: { bool_value: true } + } + test { + name: "gte_dyn_int_small_lossy_double_greater" + expr: "dyn(-9223372036854775808) >= -9223372036854777857.0" + value: { bool_value: true } + } + test { + name: "gte_dyn_uint_small_int" + expr: "dyn(1u) >= -1" + value: { bool_value: true } + } + test { + name: "gte_dyn_big_uint_int" + expr: "dyn(9223372036854775808u) >= 1" + value: { bool_value: true } + } + test { + name: "gte_dyn_uint_small_double" + expr: "dyn(9223372036854775807u) >= -1.0" + value: { bool_value: true } + } + test { + name: "not_gte_dyn_uint_big_double" + expr: "dyn(18446744073709551615u) >= 18446744073709553665.0" + value: { bool_value: false } + } + test { + name: "gte_dyn_big_double_uint" + expr: "dyn(18446744073709553665.0) >= 18446744073709551615u" + value: { bool_value: true } + } + test { + name: "gte_dyn_big_double_int" + expr: "dyn(9223372036854775808.0) >= 9223372036854775807" + value: { bool_value: true } + } + test { + name: "gte_dyn_small_double_int" + expr: "dyn(-9223372036854775809.0) >= -9223372036854775808" + value: { bool_value: true } + } } section { name: "in_list_literal" @@ -916,12 +2160,10 @@ section { value { bool_value: true } } test { - name: "elem_in_mixed_type_list_error" - description: "Set membership tests should error if the 'elem' does not exist in a mixed element type list as containment is equivalent to the macro exists() behavior." + name: "elem_in_mixed_type_list_cross_type" + description: "Set membership tests should return false due to the introduction of heterogeneous-equality. Set membership via 'in' is equivalent to the macro exists() behavior." expr: "'elem' in [1u, 'str', 2, b'bytes']" - eval_error: { - errors: { message: "no such overload" } - } + value: { bool_value: false } } } section { @@ -949,17 +2191,9 @@ section { value { bool_value: true } } test { - name: "key_in_mixed_key_type_map_error" + name: "key_in_mixed_key_type_map_cross_type" expr: "'key' in {1u:'str', 2:b'bytes'}" - # Current behavior - # value: { bool_value: false } - # This behavior is expected for homogeneous equality, but should break - # with heterogeneous equality supported in CEL 0.1.0. This case should - # be revisited when support for heterogeneous equality is added to CEL. - # - eval_error: { - errors: { message: "no such overload" } - } + value: { bool_value: false } } } section { @@ -970,11 +2204,11 @@ section { expr: "x > b'\x00'" value: { bool_value: false } type_env: { - name: "x", + name: "x" ident: { type: { primitive: BYTES } } } bindings: { - key: "x", + key: "x" value: { value: { bytes_value: "\x00" } } } } @@ -983,11 +2217,11 @@ section { expr: "123 <= x" value: { bool_value: true } type_env: { - name: "x", + name: "x" ident: { type: { primitive: INT64 } } } bindings: { - key: "x", + key: "x" value: { value: { int64_value: 124 } } } } @@ -996,11 +2230,11 @@ section { expr: "false < x" value: { bool_value: true } type_env: { - name: "x", + name: "x" ident: { type: { primitive: BOOL } } } bindings: { - key: "x", + key: "x" value: { value: { bool_value: true } } } } @@ -1009,11 +2243,11 @@ section { expr: "x != 9.8" value: { bool_value: false } type_env: { - name: "x", + name: "x" ident: { type: { primitive: DOUBLE } } } bindings: { - key: "x", + key: "x" value: { value: { double_value: 9.8 } } } } @@ -1022,7 +2256,7 @@ section { expr: "{'a':'b','c':'d'} != x" value: { bool_value: false } type_env: { - name: "x", + name: "x" ident: { type: { map_type: { @@ -1033,7 +2267,7 @@ section { } } bindings: { - key: "x", + key: "x" value: { value: { map_value { @@ -1056,11 +2290,11 @@ section { expr: "x == null" value: { bool_value: true } type_env: { - name: "x", + name: "x" ident: { type: { null: NULL_VALUE } } } bindings: { - key: "x", + key: "x" value: { value: { null_value: NULL_VALUE } } } } @@ -1127,12 +2361,9 @@ section { eval_error: { errors: { message: "no such overload" } } - type_env: { - name: "x", - ident: { type: { null: NULL_VALUE } } - } + disable_check: true bindings: { - key: "x", + key: "x" value: { value: { null_value: NULL_VALUE } } } } diff --git a/features/conversions.feature b/features/conversions.feature index 55b0738..bd84b2b 100644 --- a/features/conversions.feature +++ b/features/conversions.feature @@ -1,590 +1,608 @@ - +@conformance Feature: conversions Tests for type conversions. + # bytes -- Conversions to bytes. -Scenario: string_empty +Scenario: bytes/string_empty When CEL expression "bytes('')" is evaluated - # bytes_value:"" - Then value is BytesType(source=b'') + Then value is celpy.celtypes.BytesType(source=b'') - -Scenario: string +Scenario: bytes/string When CEL expression "bytes('abc')" is evaluated - # bytes_value:"abc" - Then value is BytesType(source=b'abc') - + Then value is celpy.celtypes.BytesType(source=b'abc') -Scenario: string_unicode +Scenario: bytes/string_unicode When CEL expression "bytes('ÿ')" is evaluated - # bytes_value:"ÿ" - Then value is BytesType(source=b'\xc3\xbf') + Then value is celpy.celtypes.BytesType(source=b'\xc3\xbf') +Scenario: bytes/string_unicode_vs_literal -Scenario: string_unicode_vs_literal - - When CEL expression "bytes('\377') == b'\377'" is evaluated - # bool_value:false - Then value is BoolType(source=False) - + When CEL expression "bytes('\\377') == b'\\377'" is evaluated + Then value is celpy.celtypes.BoolType(source=False) # double -- Conversions to double. -Scenario: int_zero +Scenario: double/int_zero - When CEL expression "double(0)" is evaluated - # double_value:0 - Then value is DoubleType(source=0) + When CEL expression 'double(0)' is evaluated + Then value is celpy.celtypes.DoubleType(source=0.0) +Scenario: double/int_pos -Scenario: int_pos + When CEL expression 'double(1000000000000)' is evaluated + Then value is celpy.celtypes.DoubleType(source=1000000000000.0) - When CEL expression "double(1000000000000)" is evaluated - # double_value:1e+12 - Then value is DoubleType(source=1000000000000.0) +Scenario: double/int_neg + When CEL expression 'double(-1000000000000000)' is evaluated + Then value is celpy.celtypes.DoubleType(source=-1000000000000000.0) -Scenario: int_neg +Scenario: double/int_min_exact + Smallest contiguous representable int (-2^53). - When CEL expression "double(-1000000000000000)" is evaluated - # double_value:-1e+15 - Then value is DoubleType(source=-1000000000000000.0) + When CEL expression 'double(-9007199254740992)' is evaluated + Then value is celpy.celtypes.DoubleType(source=-9007199254740992.0) +Scenario: double/int_max_exact + Largest contiguous representable int (2^53). -Scenario: int_range + When CEL expression 'double(9007199254740992)' is evaluated + Then value is celpy.celtypes.DoubleType(source=9007199254740992.0) + +Scenario: double/int_range Largest signed 64-bit. Rounds to nearest double. - When CEL expression "double(9223372036854775807)" is evaluated - # double_value:9.223372036854776e+18 - Then value is DoubleType(source=9.223372036854776e+18) + When CEL expression 'double(9223372036854775807)' is evaluated + Then value is celpy.celtypes.DoubleType(source=9.223372036854776e+18) -Scenario: uint_zero +Scenario: double/uint_zero - When CEL expression "double(0u)" is evaluated - # double_value:0 - Then value is DoubleType(source=0) + When CEL expression 'double(0u)' is evaluated + Then value is celpy.celtypes.DoubleType(source=0.0) +Scenario: double/uint_pos -Scenario: uint_pos + When CEL expression 'double(123u)' is evaluated + Then value is celpy.celtypes.DoubleType(source=123.0) - When CEL expression "double(123u)" is evaluated - # double_value:123 - Then value is DoubleType(source=123) +Scenario: double/uint_max_exact + Largest contiguous representable int (2^53). + When CEL expression 'double(9007199254740992u)' is evaluated + Then value is celpy.celtypes.DoubleType(source=9007199254740992.0) -Scenario: uint_range +Scenario: double/uint_range Largest unsigned 64-bit. - When CEL expression "double(18446744073709551615u)" is evaluated - # double_value:1.8446744073709552e+19 - Then value is DoubleType(source=1.8446744073709552e+19) + When CEL expression 'double(18446744073709551615u)' is evaluated + Then value is celpy.celtypes.DoubleType(source=1.8446744073709552e+19) -Scenario: string_zero +Scenario: double/string_zero When CEL expression "double('0')" is evaluated - # double_value:0 - Then value is DoubleType(source=0) - + Then value is celpy.celtypes.DoubleType(source=0.0) -Scenario: string_zero_dec +Scenario: double/string_zero_dec When CEL expression "double('0.0')" is evaluated - # double_value:0 - Then value is DoubleType(source=0) + Then value is celpy.celtypes.DoubleType(source=0.0) - -Scenario: string_neg_zero +Scenario: double/string_neg_zero When CEL expression "double('-0.0')" is evaluated - # double_value:-0 - Then value is DoubleType(source=0) - + Then value is celpy.celtypes.DoubleType(source=-0.0) -Scenario: string_no_dec +Scenario: double/string_no_dec When CEL expression "double('123')" is evaluated - # double_value:123 - Then value is DoubleType(source=123) + Then value is celpy.celtypes.DoubleType(source=123.0) - -Scenario: string_pos +Scenario: double/string_pos When CEL expression "double('123.456')" is evaluated - # double_value:123.456 - Then value is DoubleType(source=123.456) - + Then value is celpy.celtypes.DoubleType(source=123.456) -Scenario: string_neg +Scenario: double/string_neg When CEL expression "double('-987.654')" is evaluated - # double_value:-987.654 - Then value is DoubleType(source=-987.654) + Then value is celpy.celtypes.DoubleType(source=-987.654) - -Scenario: string_exp_pos_pos +Scenario: double/string_exp_pos_pos When CEL expression "double('6.02214e23')" is evaluated - # double_value:6.02214e+23 - Then value is DoubleType(source=6.02214e+23) - + Then value is celpy.celtypes.DoubleType(source=6.02214e+23) -Scenario: string_exp_pos_neg +Scenario: double/string_exp_pos_neg When CEL expression "double('1.38e-23')" is evaluated - # double_value:1.38e-23 - Then value is DoubleType(source=1.38e-23) - + Then value is celpy.celtypes.DoubleType(source=1.38e-23) -Scenario: string_exp_neg_pos +Scenario: double/string_exp_neg_pos When CEL expression "double('-84.32e7')" is evaluated - # double_value:-8.432e+08 - Then value is DoubleType(source=-843200000.0) + Then value is celpy.celtypes.DoubleType(source=-843200000.0) - -Scenario: string_exp_neg_neg +Scenario: double/string_exp_neg_neg When CEL expression "double('-5.43e-21')" is evaluated - # double_value:-5.43e-21 - Then value is DoubleType(source=-5.43e-21) - + Then value is celpy.celtypes.DoubleType(source=-5.43e-21) # dyn -- Tests for dyn annotation. -Scenario: dyn_heterogeneous_list +Scenario: dyn/dyn_heterogeneous_list No need to disable type checking. + When CEL expression "type(dyn([1, 'one']))" is evaluated - # type_value:"list" - # Then value is TypeType(value='list') Then value is celpy.celtypes.ListType - # int -- Conversions to int. -Scenario: uint +Scenario: int/uint - When CEL expression "int(42u)" is evaluated - # int64_value:42 - Then value is IntType(source=42) + When CEL expression 'int(42u)' is evaluated + Then value is celpy.celtypes.IntType(source=42) +Scenario: int/uint_zero -Scenario: uint_zero + When CEL expression 'int(0u)' is evaluated + Then value is celpy.celtypes.IntType(source=0) - When CEL expression "int(0u)" is evaluated - # int64_value:0 - Then value is IntType(source=0) +Scenario: int/uint_max_exact + When CEL expression 'int(9223372036854775807u)' is evaluated + Then value is celpy.celtypes.IntType(source=9223372036854775807) -Scenario: uint_range +Scenario: int/uint_range - When CEL expression "int(18446744073709551615u)" is evaluated - # errors:{message:"range error"} + When CEL expression 'int(18446744073709551615u)' is evaluated Then eval_error is 'range error' +Scenario: int/double_round_neg -Scenario: double_round_neg + When CEL expression 'int(-123.456)' is evaluated + Then value is celpy.celtypes.IntType(source=-123) - When CEL expression "int(-123.456)" is evaluated - # int64_value:-123 - Then value is IntType(source=-123) +@wip +Scenario: int/double_truncate + When CEL expression 'int(1.9)' is evaluated + Then value is celpy.celtypes.IntType(source=1) -Scenario: double_nearest +@wip +Scenario: int/double_truncate_neg - When CEL expression "int(1.9)" is evaluated - # int64_value:2 - Then value is IntType(source=2) + When CEL expression 'int(-7.9)' is evaluated + Then value is celpy.celtypes.IntType(source=-7) +@wip +Scenario: int/double_half_pos -Scenario: double_nearest_neg + When CEL expression 'int(11.5)' is evaluated + Then value is celpy.celtypes.IntType(source=11) - When CEL expression "int(-7.9)" is evaluated - # int64_value:-8 - Then value is IntType(source=-8) +@wip +Scenario: int/double_half_neg + When CEL expression 'int(-3.5)' is evaluated + Then value is celpy.celtypes.IntType(source=-3) -Scenario: double_half_away_pos +Scenario: int/double_big_exact + Beyond exact range (2^53), but no loss of precision (2^55). - When CEL expression "int(11.5)" is evaluated - # int64_value:12 - Then value is IntType(source=12) + When CEL expression 'int(double(36028797018963968))' is evaluated + Then value is celpy.celtypes.IntType(source=36028797018963968) +Scenario: int/double_big_precision + Beyond exact range (2^53), but loses precision (2^55 + 1). -Scenario: double_half_away_neg + When CEL expression 'int(double(36028797018963969))' is evaluated + Then value is celpy.celtypes.IntType(source=36028797018963968) - When CEL expression "int(-3.5)" is evaluated - # int64_value:-4 - Then value is IntType(source=-4) +Scenario: int/double_int_max_range + The double(2^63-1) cast produces a floating point value outside the + int range + When CEL expression 'int(9223372036854775807.0)' is evaluated + Then eval_error is 'range' -Scenario: double_range +@wip +Scenario: int/double_int_min_range + The double(-2^63) cast produces a floating point value outside the int + range - When CEL expression "int(1e99)" is evaluated - # errors:{message:"range"} + When CEL expression 'int(-9223372036854775808.0)' is evaluated Then eval_error is 'range' +Scenario: int/double_range + + When CEL expression 'int(1e99)' is evaluated + Then eval_error is 'range' -Scenario: string +Scenario: int/string When CEL expression "int('987')" is evaluated - # int64_value:987 - Then value is IntType(source=987) - + Then value is celpy.celtypes.IntType(source=987) -Scenario: timestamp +Scenario: int/timestamp When CEL expression "int(timestamp('2004-09-16T23:59:59Z'))" is evaluated - # int64_value:1095379199 - Then value is IntType(source=1095379199) - + Then value is celpy.celtypes.IntType(source=1095379199) # string -- Conversions to string. -Scenario: int +Scenario: string/int - When CEL expression "string(123)" is evaluated - # string_value:"123" - Then value is StringType(source='123') + When CEL expression 'string(123)' is evaluated + Then value is celpy.celtypes.StringType(source='123') +Scenario: string/int_neg -Scenario: int_neg + When CEL expression 'string(-456)' is evaluated + Then value is celpy.celtypes.StringType(source='-456') - When CEL expression "string(-456)" is evaluated - # string_value:"-456" - Then value is StringType(source='-456') +Scenario: string/uint + When CEL expression 'string(9876u)' is evaluated + Then value is celpy.celtypes.StringType(source='9876') -Scenario: uint +Scenario: string/double - When CEL expression "string(9876u)" is evaluated - # string_value:"9876" - Then value is StringType(source='9876') + When CEL expression 'string(123.456)' is evaluated + Then value is celpy.celtypes.StringType(source='123.456') +Scenario: string/double_hard -Scenario: double + When CEL expression 'string(-4.5e-3)' is evaluated + Then value is celpy.celtypes.StringType(source='-0.0045') - When CEL expression "string(123.456)" is evaluated - # string_value:"123.456" - Then value is StringType(source='123.456') +Scenario: string/bytes + When CEL expression "string(b'abc')" is evaluated + Then value is celpy.celtypes.StringType(source='abc') -Scenario: double_hard +Scenario: string/bytes_unicode - When CEL expression "string(-4.5e-3)" is evaluated - # string_value:"-0.0045" - Then value is StringType(source='-0.0045') + When CEL expression "string(b'\\303\\277')" is evaluated + Then value is celpy.celtypes.StringType(source='ÿ') +Scenario: string/bytes_invalid -Scenario: bytes + When CEL expression "string(b'\\000\\xff')" is evaluated + Then eval_error is 'invalid UTF-8' - When CEL expression "string(b'abc')" is evaluated - # string_value:"abc" - Then value is StringType(source='abc') +# type -- Type reflection tests. -Scenario: bytes_unicode +Scenario: type/bool - When CEL expression "string(b'\303\277')" is evaluated - # string_value:"ÿ" - Then value is StringType(source='ÿ') + When CEL expression 'type(true)' is evaluated + Then value is celpy.celtypes.BoolType +Scenario: type/bool_denotation -Scenario: bytes_invalid + When CEL expression 'bool' is evaluated + Then value is celpy.celtypes.BoolType - When CEL expression "string(b'\000\xff')" is evaluated - # errors:{message:"invalid UTF-8"} - Then eval_error is 'invalid UTF-8' +Scenario: type/dyn_no_denotation + + Given disable_check parameter is True + When CEL expression 'dyn' is evaluated + Then eval_error is 'unknown variable' +Scenario: type/int + When CEL expression 'type(0)' is evaluated + Then value is celpy.celtypes.IntType -# type -- Type reflection tests. +Scenario: type/int_denotation -Scenario: bool + When CEL expression 'int' is evaluated + Then value is celpy.celtypes.IntType - When CEL expression "type(true)" is evaluated - # type_value:"bool" - # Then value is TypeType(value='bool') - Then value is BoolType +Scenario: type/eq_same + When CEL expression 'type(true) == type(false)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: bool_denotation +Scenario: type/uint - When CEL expression "bool" is evaluated - # type_value:"bool" - # Then value is TypeType(value='bool') - Then value is BoolType + When CEL expression 'type(64u)' is evaluated + Then value is celpy.celtypes.UintType +Scenario: type/uint_denotation -Scenario: dyn_no_denotation + When CEL expression 'uint' is evaluated + Then value is celpy.celtypes.UintType - When CEL expression "dyn" is evaluated - # errors:{message:"unknown varaible"} - Then eval_error is 'unknown variable' +Scenario: type/double + When CEL expression 'type(3.14)' is evaluated + Then value is celpy.celtypes.DoubleType -Scenario: int +Scenario: type/double_denotation - When CEL expression "type(0)" is evaluated - # type_value:"int" - # Then value is TypeType(value='int') - Then value is IntType + When CEL expression 'double' is evaluated + Then value is celpy.celtypes.DoubleType +Scenario: type/null_type -Scenario: int_denotation + When CEL expression 'type(null)' is evaluated + Then value is NoneType - When CEL expression "int" is evaluated - # type_value:"int" - # Then value is TypeType(value='int') - Then value is IntType +Scenario: type/null_type_denotation + When CEL expression 'null_type' is evaluated + Then value is NoneType -Scenario: eq_same +Scenario: type/string - When CEL expression "type(true) == type(false)" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression "type('foo')" is evaluated + Then value is celpy.celtypes.StringType +Scenario: type/string_denotation -Scenario: uint + When CEL expression 'string' is evaluated + Then value is celpy.celtypes.StringType - When CEL expression "type(64u)" is evaluated - # type_value:"uint" - # Then value is TypeType(value='uint') - Then value is UintType +Scenario: type/bytes + When CEL expression "type(b'\\xff')" is evaluated + Then value is celpy.celtypes.BytesType -Scenario: uint_denotation +Scenario: type/bytes_denotation - When CEL expression "uint" is evaluated - # type_value:"uint" - # Then value is TypeType(value='uint') - Then value is UintType + When CEL expression 'bytes' is evaluated + Then value is celpy.celtypes.BytesType +Scenario: type/list -Scenario: double + When CEL expression 'type([1, 2, 3])' is evaluated + Then value is celpy.celtypes.ListType - When CEL expression "type(3.14)" is evaluated - # type_value:"double" - # Then value is TypeType(value='double') - Then value is DoubleType +Scenario: type/list_denotation + When CEL expression 'list' is evaluated + Then value is celpy.celtypes.ListType -Scenario: double_denotation +Scenario: type/lists_monomorphic - When CEL expression "double" is evaluated - # type_value:"double" - # Then value is TypeType(value='double') - Then value is DoubleType + When CEL expression "type([1, 2, 3]) == type(['one', 'two', 'three'])" is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: type/map -Scenario: null_type + When CEL expression 'type({4: 16})' is evaluated + Then value is celpy.celtypes.MapType - When CEL expression "type(null)" is evaluated - # type_value:"null_type" - # Then value is TypeType(value='null_type') - Then value is NoneType +Scenario: type/map_denotation + When CEL expression 'map' is evaluated + Then value is celpy.celtypes.MapType -Scenario: null_type_denotation +Scenario: type/map_monomorphic - When CEL expression "null_type" is evaluated - # type_value:"null_type" - # Then value is TypeType(value='null_type') - Then value is NoneType + When CEL expression "type({'one': 1}) == type({1: 'one'})" is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: type/eq_diff -Scenario: string + When CEL expression 'type(7) == type(7u)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "type('foo')" is evaluated - # type_value:"string" - # Then value is TypeType(value='string') - Then value is StringType +Scenario: type/neq_same + When CEL expression 'type(0.0) != type(-0.0)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: string_denotation +Scenario: type/neq_diff - When CEL expression "string" is evaluated - # type_value:"string" - # Then value is TypeType(value='string') - Then value is StringType + When CEL expression 'type(0.0) != type(0)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: type/meta -Scenario: bytes + When CEL expression 'type(type(7)) == type(type(7u))' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "type(b'\xff')" is evaluated - # type_value:"bytes" - # Then value is TypeType(value='bytes') - Then value is BytesType +Scenario: type/type + When CEL expression 'type(int)' is evaluated + Then value is celpy.celtypes.TypeType -Scenario: bytes_denotation +Scenario: type/type_denotation - When CEL expression "bytes" is evaluated - # type_value:"bytes" - # Then value is TypeType(value='bytes') - Then value is BytesType + When CEL expression 'type' is evaluated + Then value is celpy.celtypes.TypeType +Scenario: type/type_type -Scenario: list + When CEL expression 'type(type)' is evaluated + Then value is celpy.celtypes.TypeType - When CEL expression "type([1, 2, 3])" is evaluated - # type_value:"list" - # Then value is TypeType(value='list') - Then value is ListType +# uint -- Conversions to uint. -Scenario: list_denotation +Scenario: uint/int - When CEL expression "list" is evaluated - # type_value:"list" - # Then value is TypeType(value='list') - Then value is ListType + When CEL expression 'uint(1729)' is evaluated + Then value is celpy.celtypes.UintType(source=1729) +Scenario: uint/int_max -Scenario: lists_monomorphic + When CEL expression 'uint(9223372036854775807)' is evaluated + Then value is celpy.celtypes.UintType(source=9223372036854775807) - When CEL expression "type([1, 2, 3]) == type(['one', 'two', 'three'])" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: uint/int_neg + When CEL expression 'uint(-1)' is evaluated + Then eval_error is 'range' -Scenario: map +Scenario: uint/double - When CEL expression "type({4: 16})" is evaluated - # type_value:"map" - # Then value is TypeType(value='map') - Then value is MapType + When CEL expression 'uint(3.14159265)' is evaluated + Then value is celpy.celtypes.UintType(source=3) +@wip +Scenario: uint/double_truncate -Scenario: map_denotation + When CEL expression 'uint(1.9)' is evaluated + Then value is celpy.celtypes.UintType(source=1) - When CEL expression "map" is evaluated - # type_value:"map" - # Then value is TypeType(value='map') - Then value is MapType +@wip +Scenario: uint/double_half + When CEL expression 'uint(25.5)' is evaluated + Then value is celpy.celtypes.UintType(source=25) -Scenario: map_monomorphic +Scenario: uint/double_big_exact + Beyond exact range (2^53), but no loss of precision (2^55). - When CEL expression "type({'one': 1}) == type({1: 'one'})" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'uint(double(36028797018963968u))' is evaluated + Then value is celpy.celtypes.UintType(source=36028797018963968) +Scenario: uint/double_big_precision + Beyond exact range (2^53), but loses precision (2^55 + 1). -Scenario: eq_diff + When CEL expression 'uint(double(36028797018963969u))' is evaluated + Then value is celpy.celtypes.UintType(source=36028797018963968) - When CEL expression "type(7) == type(7u)" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: uint/double_uint_max_range + The exact conversion of uint max as a double does not round trip. + When CEL expression 'int(18446744073709551615.0)' is evaluated + Then eval_error is 'range' -Scenario: neq_same +Scenario: uint/double_range_beyond_uint - When CEL expression "type(0.0) != type(-0.0)" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression 'uint(6.022e23)' is evaluated + Then eval_error is 'range' +Scenario: uint/string -Scenario: neq_diff + When CEL expression "uint('300')" is evaluated + Then value is celpy.celtypes.UintType(source=300) - When CEL expression "type(0.0) != type(0)" is evaluated - # bool_value:true - Then value is BoolType(source=True) +# bool -- Conversions to bool -Scenario: meta +Scenario: bool/string_1 - When CEL expression "type(type(7)) == type(type(7u))" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression "bool('1')" is evaluated + Then value is celpy.celtypes.BoolType(source=True) +@wip +Scenario: bool/string_t -Scenario: type + When CEL expression "bool('t')" is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "type(int)" is evaluated - # type_value:"type" - # Then value is TypeType(value='type') - Then value is TypeType +@wip +Scenario: bool/string_true_lowercase + When CEL expression "bool('true')" is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: type_denotation +@wip +Scenario: bool/string_true_uppercase - When CEL expression "type" is evaluated - # type_value:"type" - # Then value is TypeType(value='type') - Then value is TypeType + When CEL expression "bool('TRUE')" is evaluated + Then value is celpy.celtypes.BoolType(source=True) +@wip +Scenario: bool/string_true_pascalcase -Scenario: type_type + When CEL expression "bool('True')" is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "type(type)" is evaluated - # type_value:"type" - # Then value is TypeType(value='type') - Then value is TypeType +Scenario: bool/string_0 + When CEL expression "bool('0')" is evaluated + Then value is celpy.celtypes.BoolType(source=False) +@wip +Scenario: bool/string_f -# uint -- Conversions to uint. + When CEL expression "bool('f')" is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: int +@wip +Scenario: bool/string_false_lowercase - When CEL expression "uint(1729)" is evaluated - # uint64_value:1729 - Then value is UintType(source=1729) + When CEL expression "bool('false')" is evaluated + Then value is celpy.celtypes.BoolType(source=False) +@wip +Scenario: bool/string_false_uppercase -Scenario: int_neg + When CEL expression "bool('FALSE')" is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "uint(-1)" is evaluated - # errors:{message:"range"} - Then eval_error is 'range' +@wip +Scenario: bool/string_false_pascalcase + When CEL expression "bool('False')" is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: double +Scenario: bool/string_true_badcase - When CEL expression "uint(3.14159265)" is evaluated - # uint64_value:3 - Then value is UintType(source=3) + When CEL expression "bool('TrUe')" is evaluated + Then eval_error is 'Type conversion error' +Scenario: bool/string_false_badcase -Scenario: double_nearest_int + When CEL expression "bool('FaLsE')" is evaluated + Then eval_error is 'Type conversion error' - When CEL expression "int(1.9)" is evaluated - # int64_value:2 - Then value is IntType(source=2) +# identity -- Identity functions -Scenario: double_nearest +Scenario: identity/bool - When CEL expression "uint(1.9)" is evaluated - # uint64_value:2 - Then value is UintType(source=2) + When CEL expression 'bool(true)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: identity/int -Scenario: double_half_away + When CEL expression 'int(1)' is evaluated + Then value is celpy.celtypes.IntType(source=1) - When CEL expression "uint(25.5)" is evaluated - # uint64_value:26 - Then value is UintType(source=26) +Scenario: identity/uint + When CEL expression 'uint(1u)' is evaluated + Then value is celpy.celtypes.UintType(source=1) -Scenario: double_range +Scenario: identity/double - When CEL expression "uint(6.022e23)" is evaluated - # errors:{message:"range"} - Then eval_error is 'range' + When CEL expression 'double(5.5)' is evaluated + Then value is celpy.celtypes.DoubleType(source=5.5) +Scenario: identity/string -Scenario: string + When CEL expression "string('hello')" is evaluated + Then value is celpy.celtypes.StringType(source='hello') + +Scenario: identity/bytes + + When CEL expression "bytes(b'abc')" is evaluated + Then value is celpy.celtypes.BytesType(source=b'abc') + +Scenario: identity/duration + + When CEL expression "duration(duration('100s')) == duration('100s')" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: identity/timestamp + + When CEL expression 'timestamp(timestamp(1000000000)) == timestamp(1000000000)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "uint('300')" is evaluated - # uint64_value:300 - Then value is UintType(source=300) diff --git a/features/conversions.textproto b/features/conversions.textproto index 6f46464..0e4d4b2 100644 --- a/features/conversions.textproto +++ b/features/conversions.textproto @@ -1,3 +1,6 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: cel.expr.conformance.test.SimpleTestFile + name: "conversions" description: "Tests for type conversions." section { @@ -42,6 +45,18 @@ section { expr: "double(-1000000000000000)" value: { double_value: -1e15 } } + test { + name: "int_min_exact" + description: "Smallest contiguous representable int (-2^53)." + expr: "double(-9007199254740992)" + value { double_value: -9.007199254740992e15 } + } + test { + name: "int_max_exact" + description: "Largest contiguous representable int (2^53)." + expr: "double(9007199254740992)" + value { double_value: 9.007199254740992e15 } + } test { name: "int_range" description: "Largest signed 64-bit. Rounds to nearest double." @@ -58,6 +73,12 @@ section { expr: "double(123u)" value: { double_value: 123.0 } } + test { + name: "uint_max_exact" + description: "Largest contiguous representable int (2^53)." + expr: "double(9007199254740992u)" + value { double_value: 9.007199254740992e15 } + } test { name: "uint_range" description: "Largest unsigned 64-bit." @@ -138,6 +159,11 @@ section { expr: "int(0u)" value: { int64_value: 0 } } + test { + name: "uint_max_exact" + expr: "int(9223372036854775807u)" + value { int64_value: 9223372036854775807 } + } test { name: "uint_range" expr: "int(18446744073709551615u)" @@ -151,24 +177,52 @@ section { value: { int64_value: -123 } } test { - name: "double_nearest" + name: "double_truncate" expr: "int(1.9)" - value: { int64_value: 2 } + value: { int64_value: 1 } } test { - name: "double_nearest_neg" + name: "double_truncate_neg" expr: "int(-7.9)" - value: { int64_value: -8 } + value: { int64_value: -7 } } test { - name: "double_half_away_pos" + name: "double_half_pos" expr: "int(11.5)" - value: { int64_value: 12 } + value: { int64_value: 11 } } test { - name: "double_half_away_neg" + name: "double_half_neg" expr: "int(-3.5)" - value: { int64_value: -4 } + value: { int64_value: -3 } + } + test { + name: "double_big_exact" + description: "Beyond exact range (2^53), but no loss of precision (2^55)." + expr: "int(double(36028797018963968))" + value { int64_value: 36028797018963968 } + } + test { + name: "double_big_precision" + description: "Beyond exact range (2^53), but loses precision (2^55 + 1)." + expr: "int(double(36028797018963969))" + value { int64_value: 36028797018963968 } + } + test { + name: "double_int_max_range" + description: "The double(2^63-1) cast produces a floating point value outside the int range" + expr: "int(9223372036854775807.0)" + eval_error { + errors: { message: "range" } + } + } + test { + name: "double_int_min_range" + description: "The double(-2^63) cast produces a floating point value outside the int range" + expr: "int(-9223372036854775808.0)" + eval_error { + errors: { message: "range" } + } } test { name: "double_range" @@ -252,7 +306,7 @@ section { expr: "dyn" disable_check: true eval_error { - errors { message: "unknown varaible" } + errors { message: "unknown variable" } } } test { @@ -394,6 +448,11 @@ section { expr: "uint(1729)" value: { uint64_value: 1729 } } + test { + name: "int_max" + expr: "uint(9223372036854775807)" + value { uint64_value: 9223372036854775807 } + } test { name: "int_neg" expr: "uint(-1)" @@ -407,22 +466,37 @@ section { value: { uint64_value: 3 } } test { - name: "double_nearest_int" - expr: "int(1.9)" - value: { int64_value: 2 } - } - test { - name: "double_nearest" + name: "double_truncate" expr: "uint(1.9)" - value: { uint64_value: 2 } + value: { uint64_value: 1 } } test { - name: "double_half_away" + name: "double_half" expr: "uint(25.5)" - value: { uint64_value: 26 } + value: { uint64_value: 25 } } test { - name: "double_range" + name: "double_big_exact" + description: "Beyond exact range (2^53), but no loss of precision (2^55)." + expr: "uint(double(36028797018963968u))" + value { uint64_value: 36028797018963968 } + } + test { + name: "double_big_precision" + description: "Beyond exact range (2^53), but loses precision (2^55 + 1)." + expr: "uint(double(36028797018963969u))" + value { uint64_value: 36028797018963968 } + } + test { + name: "double_uint_max_range" + description: "The exact conversion of uint max as a double does not round trip." + expr: "int(18446744073709551615.0)" + eval_error { + errors: { message: "range" } + } + } + test { + name: "double_range_beyond_uint" expr: "uint(6.022e23)" eval_error { errors { message: "range" } @@ -434,3 +508,115 @@ section { value: { uint64_value: 300 } } } +section { + name: "bool" + description: "Conversions to bool" + test { + name: "string_1" + expr: "bool('1')" + value: { bool_value: true } + } + test { + name: "string_t" + expr: "bool('t')" + value: { bool_value: true } + } + test { + name: "string_true_lowercase" + expr: "bool('true')" + value: { bool_value: true } + } + test { + name: "string_true_uppercase" + expr: "bool('TRUE')" + value: { bool_value: true } + } + test { + name: "string_true_pascalcase" + expr: "bool('True')" + value: { bool_value: true } + } + test { + name: "string_0" + expr: "bool('0')" + value: { bool_value: false } + } + test { + name: "string_f" + expr: "bool('f')" + value: { bool_value: false } + } + test { + name: "string_false_lowercase" + expr: "bool('false')" + value: { bool_value: false } + } + test { + name: "string_false_uppercase" + expr: "bool('FALSE')" + value: { bool_value: false } + } + test { + name: "string_false_pascalcase" + expr: "bool('False')" + value: { bool_value: false } + } + test { + name: "string_true_badcase" + expr: "bool('TrUe')" + eval_error { + errors { message: "Type conversion error" } + } + } + test { + name: "string_false_badcase" + expr: "bool('FaLsE')" + eval_error { + errors { message: "Type conversion error" } + } + } +} +section { + name: "identity" + description: "Identity functions" + test { + name: "bool" + expr: "bool(true)" + value: { bool_value: true } + } + test { + name: "int" + expr: "int(1)" + value: { int64_value: 1 } + } + test { + name: "uint" + expr: "uint(1u)" + value: { uint64_value: 1 } + } + test { + name: "double" + expr: "double(5.5)" + value: { double_value: 5.5 } + } + test { + name: "string" + expr: "string('hello')" + value: { string_value: "hello" } + } + test { + name: "bytes" + expr: "bytes(b'abc')" + value: { bytes_value: "abc" } + } + test { + name: "duration" + expr: "duration(duration('100s')) == duration('100s')" + value: { bool_value: true } + } + test { + name: "timestamp" + expr: "timestamp(timestamp(1000000000)) == timestamp(1000000000)" + value: { bool_value: true } + } +} diff --git a/features/dynamic.feature b/features/dynamic.feature index 92fec2c..0d3eb9c 100644 --- a/features/dynamic.feature +++ b/features/dynamic.feature @@ -1,1964 +1,1472 @@ -@wip +@conformance Feature: dynamic - Tests for 'dynamic' proto behavior, including JSON, wrapper, and Any messages. + Tests for 'dynamic' proto behavior, including JSON, wrapper, and Any + messages. -# int32 -- Tests for int32 conversion. -Scenario: literal +# int32 -- Tests for int32 conversion. - When CEL expression "google.protobuf.Int32Value{value: -123}" is evaluated - # int64_value:-123 - Then value is IntType(source=-123) +@wip +Scenario: int32/literal + When CEL expression 'google.protobuf.Int32Value{value: -123}' is evaluated + Then value is celpy.celtypes.IntType(source=-123) -Scenario: literal_no_field_access +Scenario: int32/literal_no_field_access - When CEL expression "google.protobuf.Int32Value{value: -123}.value" is evaluated - # errors:{message:"no_matching_overload"} + Given disable_check parameter is True + When CEL expression 'google.protobuf.Int32Value{value: -123}.value' is evaluated Then eval_error is 'no_matching_overload' +@wip +Scenario: int32/literal_zero -Scenario: literal_zero - - When CEL expression "google.protobuf.Int32Value{}" is evaluated - # int64_value:0 - Then value is IntType(source=0) - - -Scenario: var - - # type:{message_type:"google.protobuf.Int32Value"} - Given type_env parameter "x" is TypeType(value='google.protobuf.Int32Value') - - # object_value:{[type.googleapis.com/google.protobuf.Int32Value]:{value:2000000}} - Given bindings parameter "x" is IntType(source=2000000) - - When CEL expression "x" is evaluated - # int64_value:2000000 - Then value is IntType(source=2000000) + When CEL expression 'google.protobuf.Int32Value{}' is evaluated + Then value is celpy.celtypes.IntType(source=0) +Scenario: int32/var -Scenario: field_assign_proto2 + Given type_env parameter "x" is celpy.celtypes.IntType + and bindings parameter "x" is celpy.celtypes.IntType(source=2000000) + When CEL expression 'x' is evaluated + Then value is celpy.celtypes.IntType(source=2000000) - Given container is "google.api.expr.test.v1.proto2" +Scenario: int32/field_assign_proto2 - When CEL expression "TestAllTypes{single_int32_wrapper: 432}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int32_wrapper:{value:432}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=432, single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_int32_wrapper: 432}' is evaluated + Then value is TestAllTypes(single_int32_wrapper=celpy.celtypes.IntType(source=432)) +Scenario: int32/field_assign_proto2_zero -Scenario: field_assign_proto2_zero + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_int32_wrapper: 0}' is evaluated + Then value is TestAllTypes(single_int32_wrapper=celpy.celtypes.IntType(source=0)) - Given container is "google.api.expr.test.v1.proto2" +Scenario: int32/field_assign_proto2_max - When CEL expression "TestAllTypes{single_int32_wrapper: 0}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int32_wrapper:{}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=None, single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_int32_wrapper: 2147483647}' is evaluated + Then value is TestAllTypes(single_int32_wrapper=celpy.celtypes.IntType(source=2147483647)) +Scenario: int32/field_assign_proto2_min -Scenario: field_assign_proto2_range + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_int32_wrapper: -2147483648}' is evaluated + Then value is TestAllTypes(single_int32_wrapper=celpy.celtypes.IntType(source=-2147483648)) - Given container is "google.api.expr.test.v1.proto2" +@wip +Scenario: int32/field_assign_proto2_range - When CEL expression "TestAllTypes{single_int32_wrapper: 12345678900}" is evaluated - # errors:{message:"range error"} + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_int32_wrapper: 12345678900}' is evaluated Then eval_error is 'range error' +Scenario: int32/field_read_proto2 -Scenario: field_read_proto2 - - Given container is "google.api.expr.test.v1.proto2" - - When CEL expression "TestAllTypes{single_int32_wrapper: 642}.single_int32_wrapper" is evaluated - # int64_value:642 - Then value is IntType(source=642) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_int32_wrapper: 642}.single_int32_wrapper' is evaluated + Then value is celpy.celtypes.IntType(source=642) +Scenario: int32/field_read_proto2_zero -Scenario: field_read_proto2_zero + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_int32_wrapper: 0}.single_int32_wrapper' is evaluated + Then value is celpy.celtypes.IntType(source=0) - Given container is "google.api.expr.test.v1.proto2" - - When CEL expression "TestAllTypes{single_int32_wrapper: 0}.single_int32_wrapper" is evaluated - # int64_value:0 - Then value is IntType(source=0) - - -Scenario: field_read_proto2_unset - - Given container is "google.api.expr.test.v1.proto2" +@wip +Scenario: int32/field_read_proto2_unset - When CEL expression "TestAllTypes{}.single_int32_wrapper" is evaluated - # null_value:NULL_VALUE + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.single_int32_wrapper' is evaluated Then value is None +Scenario: int32/field_assign_proto3 -Scenario: field_assign_proto3 - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_int32_wrapper: -975}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_int32_wrapper:{value:-975}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=-975, single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_int32_wrapper: -975}' is evaluated + Then value is TestAllTypes(single_int32_wrapper=celpy.celtypes.IntType(source=-975)) +Scenario: int32/field_assign_proto3_zero -Scenario: field_assign_proto3_zero + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_int32_wrapper: 0}' is evaluated + Then value is TestAllTypes(single_int32_wrapper=celpy.celtypes.IntType(source=0)) - Given container is "google.api.expr.test.v1.proto3" +Scenario: int32/field_assign_proto3_max - When CEL expression "TestAllTypes{single_int32_wrapper: 0}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_int32_wrapper:{}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=None, single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_int32_wrapper: 2147483647}' is evaluated + Then value is TestAllTypes(single_int32_wrapper=celpy.celtypes.IntType(source=2147483647)) +Scenario: int32/field_assign_proto3_min -Scenario: field_assign_proto3_range + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_int32_wrapper: -2147483648}' is evaluated + Then value is TestAllTypes(single_int32_wrapper=celpy.celtypes.IntType(source=-2147483648)) - Given container is "google.api.expr.test.v1.proto3" +@wip +Scenario: int32/field_assign_proto3_range - When CEL expression "TestAllTypes{single_int32_wrapper: -998877665544332211}" is evaluated - # errors:{message:"range error"} + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_int32_wrapper: -998877665544332211}' is evaluated Then eval_error is 'range error' +Scenario: int32/field_read_proto3 -Scenario: field_read_proto3 - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_int32_wrapper: 642}.single_int32_wrapper" is evaluated - # int64_value:642 - Then value is IntType(source=642) - - -Scenario: field_read_proto3_zero - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_int32_wrapper: 0}.single_int32_wrapper" is evaluated - # int64_value:0 - Then value is IntType(source=0) + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_int32_wrapper: 642}.single_int32_wrapper' is evaluated + Then value is celpy.celtypes.IntType(source=642) +Scenario: int32/field_read_proto3_zero -Scenario: field_read_proto3_unset + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_int32_wrapper: 0}.single_int32_wrapper' is evaluated + Then value is celpy.celtypes.IntType(source=0) - Given container is "google.api.expr.test.v1.proto3" +@wip +Scenario: int32/field_read_proto3_unset - When CEL expression "TestAllTypes{}.single_int32_wrapper" is evaluated - # null_value:NULL_VALUE + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{}.single_int32_wrapper' is evaluated Then value is None - # int64 -- Tests for int64 conversion. -Scenario: literal - - When CEL expression "google.protobuf.Int64Value{value: -123}" is evaluated - # int64_value:-123 - Then value is IntType(source=-123) +@wip +Scenario: int64/literal + When CEL expression 'google.protobuf.Int64Value{value: -123}' is evaluated + Then value is celpy.celtypes.IntType(source=-123) -Scenario: literal_no_field_access +Scenario: int64/literal_no_field_access - When CEL expression "google.protobuf.Int64Value{value: -123}.value" is evaluated - # errors:{message:"no_matching_overload"} + Given disable_check parameter is True + When CEL expression 'google.protobuf.Int64Value{value: -123}.value' is evaluated Then eval_error is 'no_matching_overload' +@wip +Scenario: int64/literal_zero -Scenario: literal_zero - - When CEL expression "google.protobuf.Int64Value{}" is evaluated - # int64_value:0 - Then value is IntType(source=0) - - -Scenario: var - - # type:{message_type:"google.protobuf.Int64Value"} - Given type_env parameter "x" is TypeType(value='google.protobuf.Int64Value') - - # object_value:{[type.googleapis.com/google.protobuf.Int64Value]:{value:2000000}} - Given bindings parameter "x" is IntType(source=2000000) - - When CEL expression "x" is evaluated - # int64_value:2000000 - Then value is IntType(source=2000000) - - -Scenario: field_assign_proto2 - - Given container is "google.api.expr.test.v1.proto2" - - When CEL expression "TestAllTypes{single_int64_wrapper: 432}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int64_wrapper:{value:432}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=432, single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: field_assign_proto2_zero - - Given container is "google.api.expr.test.v1.proto2" + When CEL expression 'google.protobuf.Int64Value{}' is evaluated + Then value is celpy.celtypes.IntType(source=0) - When CEL expression "TestAllTypes{single_int64_wrapper: 0}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int64_wrapper:{}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=None, single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) +Scenario: int64/var + Given type_env parameter "x" is celpy.celtypes.IntType + and bindings parameter "x" is celpy.celtypes.IntType(source=2000000) + When CEL expression 'x' is evaluated + Then value is celpy.celtypes.IntType(source=2000000) -Scenario: field_assign_proto3 +Scenario: int64/field_assign_proto2 - Given container is "google.api.expr.test.v1.proto3" + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_int64_wrapper: 432}' is evaluated + Then value is TestAllTypes(single_int64_wrapper=celpy.celtypes.IntType(source=432)) - When CEL expression "TestAllTypes{single_int64_wrapper: -975}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_int64_wrapper:{value:-975}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=-975, single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) +Scenario: int64/field_assign_proto2_zero + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_int64_wrapper: 0}' is evaluated + Then value is TestAllTypes(single_int64_wrapper=celpy.celtypes.IntType(source=0)) -Scenario: field_assign_proto3_zero +Scenario: int64/field_assign_proto3 - Given container is "google.api.expr.test.v1.proto3" + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_int64_wrapper: -975}' is evaluated + Then value is TestAllTypes(single_int64_wrapper=celpy.celtypes.IntType(source=-975)) - When CEL expression "TestAllTypes{single_int64_wrapper: 0}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_int64_wrapper:{}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=None, single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) +Scenario: int64/field_assign_proto3_zero + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_int64_wrapper: 0}' is evaluated + Then value is TestAllTypes(single_int64_wrapper=celpy.celtypes.IntType(source=0)) # uint32 -- Tests for uint32 conversion. -Scenario: literal - - When CEL expression "google.protobuf.UInt32Value{value: 123u}" is evaluated - # uint64_value:123 - Then value is UintType(source=123) +@wip +Scenario: uint32/literal + When CEL expression 'google.protobuf.UInt32Value{value: 123u}' is evaluated + Then value is celpy.celtypes.UintType(source=123) -Scenario: literal_no_field_access +Scenario: uint32/literal_no_field_access - When CEL expression "google.protobuf.UInt32Value{value: 123u}.value" is evaluated - # errors:{message:"no_matching_overload"} + Given disable_check parameter is True + When CEL expression 'google.protobuf.UInt32Value{value: 123u}.value' is evaluated Then eval_error is 'no_matching_overload' +@wip +Scenario: uint32/literal_zero -Scenario: literal_zero - - When CEL expression "google.protobuf.UInt32Value{}" is evaluated - # uint64_value:0 - Then value is UintType(source=0) - - -Scenario: var - - # type:{message_type:"google.protobuf.UInt32Value"} - Given type_env parameter "x" is TypeType(value='google.protobuf.UInt32Value') - - # object_value:{[type.googleapis.com/google.protobuf.UInt32Value]:{value:2000000}} - Given bindings parameter "x" is UintType(source=2000000) - - When CEL expression "x" is evaluated - # uint64_value:2000000 - Then value is UintType(source=2000000) - - -Scenario: field_assign_proto2 + When CEL expression 'google.protobuf.UInt32Value{}' is evaluated + Then value is celpy.celtypes.UintType(source=0) - Given container is "google.api.expr.test.v1.proto2" +Scenario: uint32/var - When CEL expression "TestAllTypes{single_uint32_wrapper: 432u}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_uint32_wrapper:{value:432}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=432, single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given type_env parameter "x" is celpy.celtypes.UintType + and bindings parameter "x" is celpy.celtypes.UintType(source=2000000) + When CEL expression 'x' is evaluated + Then value is celpy.celtypes.UintType(source=2000000) +Scenario: uint32/field_assign_proto2 -Scenario: field_assign_proto2_zero + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_uint32_wrapper: 432u}' is evaluated + Then value is TestAllTypes(single_uint32_wrapper=celpy.celtypes.UintType(source=432)) - Given container is "google.api.expr.test.v1.proto2" +Scenario: uint32/field_assign_proto2_zero - When CEL expression "TestAllTypes{single_uint32_wrapper: 0u}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_uint32_wrapper:{}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=None, single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_uint32_wrapper: 0u}' is evaluated + Then value is TestAllTypes(single_uint32_wrapper=celpy.celtypes.UintType(source=0)) +Scenario: uint32/field_assign_proto2_max -Scenario: field_assign_proto2_range + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_uint32_wrapper: 4294967295u}' is evaluated + Then value is TestAllTypes(single_uint32_wrapper=celpy.celtypes.UintType(source=4294967295)) - Given container is "google.api.expr.test.v1.proto2" +@wip +Scenario: uint32/field_assign_proto2_range - When CEL expression "TestAllTypes{single_uint32_wrapper: 6111222333u}" is evaluated - # errors:{message:"range error"} + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_uint32_wrapper: 6111222333u}' is evaluated Then eval_error is 'range error' +Scenario: uint32/field_assign_proto3 -Scenario: field_assign_proto3 - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_uint32_wrapper: 975u}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_uint32_wrapper:{value:975}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=975, single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: field_assign_proto3_zero + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_uint32_wrapper: 975u}' is evaluated + Then value is TestAllTypes(single_uint32_wrapper=celpy.celtypes.UintType(source=975)) - Given container is "google.api.expr.test.v1.proto3" +Scenario: uint32/field_assign_proto3_zero - When CEL expression "TestAllTypes{single_uint32_wrapper: 0u}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_uint32_wrapper:{}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=None, single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_uint32_wrapper: 0u}' is evaluated + Then value is TestAllTypes(single_uint32_wrapper=celpy.celtypes.UintType(source=0)) +Scenario: uint32/field_assign_proto3_max -Scenario: field_assign_proto3_range + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_uint32_wrapper: 4294967295u}' is evaluated + Then value is TestAllTypes(single_uint32_wrapper=celpy.celtypes.UintType(source=4294967295)) - Given container is "google.api.expr.test.v1.proto3" +@wip +Scenario: uint32/field_assign_proto3_range - When CEL expression "TestAllTypes{single_uint32_wrapper: 6111222333u}" is evaluated - # errors:{message:"range error"} + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_uint32_wrapper: 6111222333u}' is evaluated Then eval_error is 'range error' +Scenario: uint32/field_read_proto2 -Scenario: field_read_proto2 - - Given container is "google.api.expr.test.v1.proto2" - - When CEL expression "TestAllTypes{single_uint32_wrapper: 258u}.single_uint32_wrapper" is evaluated - # uint64_value:258 - Then value is UintType(source=258) - - -Scenario: field_read_proto2_zero - - Given container is "google.api.expr.test.v1.proto2" - - When CEL expression "TestAllTypes{single_uint32_wrapper: 0u}.single_uint32_wrapper" is evaluated - # uint64_value:0 - Then value is UintType(source=0) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_uint32_wrapper: 258u}.single_uint32_wrapper' is evaluated + Then value is celpy.celtypes.UintType(source=258) +Scenario: uint32/field_read_proto2_zero -Scenario: field_read_proto2_unset + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_uint32_wrapper: 0u}.single_uint32_wrapper' is evaluated + Then value is celpy.celtypes.UintType(source=0) - Given container is "google.api.expr.test.v1.proto2" +@wip +Scenario: uint32/field_read_proto2_unset - When CEL expression "TestAllTypes{}.single_uint32_wrapper" is evaluated - # null_value:NULL_VALUE + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.single_uint32_wrapper' is evaluated Then value is None - # uint64 -- Tests for uint64 conversion. -Scenario: literal - - When CEL expression "google.protobuf.UInt64Value{value: 123u}" is evaluated - # uint64_value:123 - Then value is UintType(source=123) +@wip +Scenario: uint64/literal + When CEL expression 'google.protobuf.UInt64Value{value: 123u}' is evaluated + Then value is celpy.celtypes.UintType(source=123) -Scenario: literal_no_field_access +Scenario: uint64/literal_no_field_access - When CEL expression "google.protobuf.UInt64Value{value: 123u}.value" is evaluated - # errors:{message:"no_matching_overload"} + Given disable_check parameter is True + When CEL expression 'google.protobuf.UInt64Value{value: 123u}.value' is evaluated Then eval_error is 'no_matching_overload' +@wip +Scenario: uint64/literal_zero -Scenario: literal_zero - - When CEL expression "google.protobuf.UInt64Value{}" is evaluated - # uint64_value:0 - Then value is UintType(source=0) - - -Scenario: var - - # type:{message_type:"google.protobuf.UInt64Value"} - Given type_env parameter "x" is TypeType(value='google.protobuf.UInt64Value') - - # object_value:{[type.googleapis.com/google.protobuf.UInt64Value]:{value:2000000}} - Given bindings parameter "x" is UintType(source=2000000) - - When CEL expression "x" is evaluated - # uint64_value:2000000 - Then value is UintType(source=2000000) - - -Scenario: field_assign_proto2 - - Given container is "google.api.expr.test.v1.proto2" - - When CEL expression "TestAllTypes{single_uint64_wrapper: 432u}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_uint64_wrapper:{value:432}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=432, single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: field_assign_proto2_zero - - Given container is "google.api.expr.test.v1.proto2" - - When CEL expression "TestAllTypes{single_uint64_wrapper: 0u}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_uint64_wrapper:{}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=None, single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: field_assign_proto3 - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_uint64_wrapper: 975u}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_uint64_wrapper:{value:975}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=975, single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + When CEL expression 'google.protobuf.UInt64Value{}' is evaluated + Then value is celpy.celtypes.UintType(source=0) +Scenario: uint64/var -Scenario: field_assign_proto3_zero + Given type_env parameter "x" is celpy.celtypes.UintType + and bindings parameter "x" is celpy.celtypes.UintType(source=2000000) + When CEL expression 'x' is evaluated + Then value is celpy.celtypes.UintType(source=2000000) - Given container is "google.api.expr.test.v1.proto3" +Scenario: uint64/field_assign_proto2 - When CEL expression "TestAllTypes{single_uint64_wrapper: 0u}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_uint64_wrapper:{}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=None, single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_uint64_wrapper: 432u}' is evaluated + Then value is TestAllTypes(single_uint64_wrapper=celpy.celtypes.UintType(source=432)) +Scenario: uint64/field_assign_proto2_zero -Scenario: field_read_proto2 + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_uint64_wrapper: 0u}' is evaluated + Then value is TestAllTypes(single_uint64_wrapper=celpy.celtypes.UintType(source=0)) - Given container is "google.api.expr.test.v1.proto2" +Scenario: uint64/field_assign_proto3 - When CEL expression "TestAllTypes{single_uint64_wrapper: 5123123123u}.single_uint64_wrapper" is evaluated - # uint64_value:5123123123 - Then value is UintType(source=5123123123) + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_uint64_wrapper: 975u}' is evaluated + Then value is TestAllTypes(single_uint64_wrapper=celpy.celtypes.UintType(source=975)) +Scenario: uint64/field_assign_proto3_zero -Scenario: field_read_proto2_zero + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_uint64_wrapper: 0u}' is evaluated + Then value is TestAllTypes(single_uint64_wrapper=celpy.celtypes.UintType(source=0)) - Given container is "google.api.expr.test.v1.proto2" +Scenario: uint64/field_read_proto2 - When CEL expression "TestAllTypes{single_uint64_wrapper: 0u}.single_uint64_wrapper" is evaluated - # uint64_value:0 - Then value is UintType(source=0) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_uint64_wrapper: 5123123123u}.single_uint64_wrapper' is evaluated + Then value is celpy.celtypes.UintType(source=5123123123) +Scenario: uint64/field_read_proto2_zero -Scenario: field_read_proto2_unset + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_uint64_wrapper: 0u}.single_uint64_wrapper' is evaluated + Then value is celpy.celtypes.UintType(source=0) - Given container is "google.api.expr.test.v1.proto2" +@wip +Scenario: uint64/field_read_proto2_unset - When CEL expression "TestAllTypes{}.single_uint64_wrapper" is evaluated - # null_value:NULL_VALUE + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.single_uint64_wrapper' is evaluated Then value is None - # float -- Tests for float conversion. -Scenario: literal - - When CEL expression "google.protobuf.FloatValue{value: -1.5e3}" is evaluated - # double_value:-1500 - Then value is DoubleType(source=-1500) +@wip +Scenario: float/literal + When CEL expression 'google.protobuf.FloatValue{value: -1.5e3}' is evaluated + Then value is celpy.celtypes.DoubleType(source=-1500.0) -Scenario: literal_not_double - Use a number with no exact representation to make sure we actually narrow to a float. - When CEL expression "google.protobuf.FloatValue{value: 1.333} == 1.333" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: float/literal_not_double + Use a number with no exact representation to make sure we actually + narrow to a float. + When CEL expression 'google.protobuf.FloatValue{value: 1.333} == 1.333' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: literal_no_field_access +Scenario: float/literal_no_field_access - When CEL expression "google.protobuf.FloatValue{value: 3.1416}.value" is evaluated - # errors:{message:"no_matching_overload"} + Given disable_check parameter is True + When CEL expression 'google.protobuf.FloatValue{value: 3.1416}.value' is evaluated Then eval_error is 'no_matching_overload' +@wip +Scenario: float/literal_zero -Scenario: literal_zero - - When CEL expression "google.protobuf.FloatValue{}" is evaluated - # double_value:0 - Then value is DoubleType(source=0) - - -Scenario: var - - # type:{message_type:"google.protobuf.FloatValue"} - Given type_env parameter "x" is TypeType(value='google.protobuf.FloatValue') - - # object_value:{[type.googleapis.com/google.protobuf.FloatValue]:{value:-1.25e+06}} - Given bindings parameter "x" is DoubleType(source=-1250000.0) - - When CEL expression "x" is evaluated - # double_value:-1.25e+06 - Then value is DoubleType(source=-1250000.0) - - -Scenario: field_assign_proto2 - - Given container is "google.api.expr.test.v1.proto2" - - When CEL expression "TestAllTypes{single_float_wrapper: 86.75}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_float_wrapper:{value:86.75}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=86.75, single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: field_assign_proto2_zero + When CEL expression 'google.protobuf.FloatValue{}' is evaluated + Then value is celpy.celtypes.DoubleType(source=0.0) - Given container is "google.api.expr.test.v1.proto2" +Scenario: float/var - When CEL expression "TestAllTypes{single_float_wrapper: 0.0}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_float_wrapper:{}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=None, single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given type_env parameter "x" is celpy.celtypes.DoubleType + and bindings parameter "x" is celpy.celtypes.DoubleType(source=-1250000.0) + When CEL expression 'x' is evaluated + Then value is celpy.celtypes.DoubleType(source=-1250000.0) +Scenario: float/field_assign_proto2 -Scenario: field_assign_proto2_range + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_float_wrapper: 86.75}' is evaluated + Then value is TestAllTypes(single_float_wrapper=celpy.celtypes.DoubleType(source=86.75)) - Given container is "google.api.expr.test.v1.proto2" +Scenario: float/field_assign_proto2_zero - When CEL expression "TestAllTypes{single_float_wrapper: 1.4e55}" is evaluated - # errors:{message:"range error"} - Then eval_error is 'range error' + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_float_wrapper: 0.0}' is evaluated + Then value is TestAllTypes(single_float_wrapper=celpy.celtypes.DoubleType(source=0.0)) +@wip +Scenario: float/field_assign_proto2_subnorm + Subnormal single floats range from ~1e-38 to ~1e-45. -Scenario: field_read_proto2 + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_float_wrapper: 1e-40}' is evaluated + Then value is TestAllTypes(single_float_wrapper=celpy.celtypes.DoubleType(source=9.99994610111476e-41)) - Given container is "google.api.expr.test.v1.proto2" +@wip +Scenario: float/field_assign_proto2_round_to_zero + Subnormal single floats range from ~1e-38 to ~1e-45. - When CEL expression "TestAllTypes{single_float_wrapper: -12.375}.single_float_wrapper" is evaluated - # double_value:-12.375 - Then value is DoubleType(source=-12.375) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_float_wrapper: 1e-50}' is evaluated + Then value is TestAllTypes(single_float_wrapper=celpy.celtypes.DoubleType(source=0.0)) +@wip +Scenario: float/field_assign_proto2_range + Single float max is about 3.4e38 -Scenario: field_read_proto2_zero + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_float_wrapper: 1.4e55}' is evaluated + Then value is TestAllTypes(single_float_wrapper=celpy.celtypes.DoubleType(source=float('inf'))) - Given container is "google.api.expr.test.v1.proto2" +Scenario: float/field_read_proto2 - When CEL expression "TestAllTypes{single_int32_wrapper: 0}.single_int32_wrapper" is evaluated - # int64_value:0 - Then value is IntType(source=0) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_float_wrapper: -12.375}.single_float_wrapper' is evaluated + Then value is celpy.celtypes.DoubleType(source=-12.375) +Scenario: float/field_read_proto2_zero -Scenario: field_read_proto2_unset + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_float_wrapper: 0.0}.single_float_wrapper' is evaluated + Then value is celpy.celtypes.DoubleType(source=0.0) - Given container is "google.api.expr.test.v1.proto2" +@wip +Scenario: float/field_read_proto2_unset - When CEL expression "TestAllTypes{}.single_float_wrapper" is evaluated - # null_value:NULL_VALUE + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.single_float_wrapper' is evaluated Then value is None +Scenario: float/field_assign_proto3 -Scenario: field_assign_proto3 - - Given container is "google.api.expr.test.v1.proto3" + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_float_wrapper: -9.75}' is evaluated + Then value is TestAllTypes(single_float_wrapper=celpy.celtypes.DoubleType(source=-9.75)) - When CEL expression "TestAllTypes{single_float_wrapper: -9.75}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_float_wrapper:{value:-9.75}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=-9.75, single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) +Scenario: float/field_assign_proto3_zero + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_float_wrapper: 0.0}' is evaluated + Then value is TestAllTypes(single_float_wrapper=celpy.celtypes.DoubleType(source=0.0)) -Scenario: field_assign_proto3_zero - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_float_wrapper: 0.0}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_float_wrapper:{}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=None, single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: field_assign_proto3_range - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_float_wrapper: -9.9e-100}" is evaluated - # errors:{message:"range error"} - Then eval_error is 'range error' - +@wip +Scenario: float/field_assign_proto2_subnorm + Subnormal single floats range from ~1e-38 to ~1e-45. -Scenario: field_read_proto3 + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_float_wrapper: 1e-40}' is evaluated + Then value is TestAllTypes(single_float_wrapper=celpy.celtypes.DoubleType(source=9.99994610111476e-41)) - Given container is "google.api.expr.test.v1.proto3" +@wip +Scenario: float/field_assign_proto3_round_to_zero - When CEL expression "TestAllTypes{single_float_wrapper: 64.25}.single_float_wrapper" is evaluated - # double_value:64.25 - Then value is DoubleType(source=64.25) + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_float_wrapper: -9.9e-100}' is evaluated + Then value is TestAllTypes(single_float_wrapper=celpy.celtypes.DoubleType(source=-0.0)) +@wip +Scenario: float/field_assign_proto3_range + Single float min is about -3.4e38 -Scenario: field_read_proto3_zero + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_float_wrapper: -9.9e100}' is evaluated + Then value is TestAllTypes(single_float_wrapper=celpy.celtypes.DoubleType(source=float('-inf'))) - Given container is "google.api.expr.test.v1.proto3" +Scenario: float/field_read_proto3 - When CEL expression "TestAllTypes{single_float_wrapper: 0.0}.single_float_wrapper" is evaluated - # double_value:0 - Then value is DoubleType(source=0) + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_float_wrapper: 64.25}.single_float_wrapper' is evaluated + Then value is celpy.celtypes.DoubleType(source=64.25) +Scenario: float/field_read_proto3_zero -Scenario: field_read_proto3_unset + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_float_wrapper: 0.0}.single_float_wrapper' is evaluated + Then value is celpy.celtypes.DoubleType(source=0.0) - Given container is "google.api.expr.test.v1.proto3" +@wip +Scenario: float/field_read_proto3_unset - When CEL expression "TestAllTypes{}.single_float_wrapper" is evaluated - # null_value:NULL_VALUE + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{}.single_float_wrapper' is evaluated Then value is None - # double -- Tests for double conversion. -Scenario: literal - - When CEL expression "google.protobuf.DoubleValue{value: -1.5e3}" is evaluated - # double_value:-1500 - Then value is DoubleType(source=-1500) +@wip +Scenario: double/literal + When CEL expression 'google.protobuf.DoubleValue{value: -1.5e3}' is evaluated + Then value is celpy.celtypes.DoubleType(source=-1500.0) -Scenario: literal_no_field_access +Scenario: double/literal_no_field_access - When CEL expression "google.protobuf.DoubleValue{value: 3.1416}.value" is evaluated - # errors:{message:"no_matching_overload"} + Given disable_check parameter is True + When CEL expression 'google.protobuf.DoubleValue{value: 3.1416}.value' is evaluated Then eval_error is 'no_matching_overload' +@wip +Scenario: double/literal_zero -Scenario: literal_zero - - When CEL expression "google.protobuf.DoubleValue{}" is evaluated - # double_value:0 - Then value is DoubleType(source=0) - - -Scenario: var - - # type:{message_type:"google.protobuf.DoubleValue"} - Given type_env parameter "x" is TypeType(value='google.protobuf.DoubleValue') - - # object_value:{[type.googleapis.com/google.protobuf.DoubleValue]:{value:-1.25e+06}} - Given bindings parameter "x" is DoubleType(source=-1250000.0) - - When CEL expression "x" is evaluated - # double_value:-1.25e+06 - Then value is DoubleType(source=-1250000.0) - - -Scenario: field_assign_proto2 - - Given container is "google.api.expr.test.v1.proto2" - - When CEL expression "TestAllTypes{single_double_wrapper: 86.75}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_double_wrapper:{value:86.75}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=86.75, single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: field_assign_proto2_zero - - Given container is "google.api.expr.test.v1.proto2" - - When CEL expression "TestAllTypes{single_double_wrapper: 0.0}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_double_wrapper:{}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=None, single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: field_assign_proto2_range + When CEL expression 'google.protobuf.DoubleValue{}' is evaluated + Then value is celpy.celtypes.DoubleType(source=0.0) - Given container is "google.api.expr.test.v1.proto2" +Scenario: double/var - When CEL expression "TestAllTypes{single_double_wrapper: 1.4e55}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_double_wrapper:{value:1.4e+55}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=1.4e+55, single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given type_env parameter "x" is celpy.celtypes.DoubleType + and bindings parameter "x" is celpy.celtypes.DoubleType(source=-1250000.0) + When CEL expression 'x' is evaluated + Then value is celpy.celtypes.DoubleType(source=-1250000.0) +Scenario: double/field_assign_proto2 -Scenario: field_read_proto2 + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_double_wrapper: 86.75}' is evaluated + Then value is TestAllTypes(single_double_wrapper=celpy.celtypes.DoubleType(source=86.75)) - Given container is "google.api.expr.test.v1.proto2" +Scenario: double/field_assign_proto2_zero - When CEL expression "TestAllTypes{single_double_wrapper: -12.375}.single_double_wrapper" is evaluated - # double_value:-12.375 - Then value is DoubleType(source=-12.375) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_double_wrapper: 0.0}' is evaluated + Then value is TestAllTypes(single_double_wrapper=celpy.celtypes.DoubleType(source=0.0)) +Scenario: double/field_assign_proto2_range -Scenario: field_read_proto2_zero + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_double_wrapper: 1.4e55}' is evaluated + Then value is TestAllTypes(single_double_wrapper=celpy.celtypes.DoubleType(source=1.4e+55)) - Given container is "google.api.expr.test.v1.proto2" +Scenario: double/field_read_proto2 - When CEL expression "TestAllTypes{single_int32_wrapper: 0}.single_int32_wrapper" is evaluated - # int64_value:0 - Then value is IntType(source=0) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_double_wrapper: -12.375}.single_double_wrapper' is evaluated + Then value is celpy.celtypes.DoubleType(source=-12.375) +Scenario: double/field_read_proto2_zero -Scenario: field_read_proto2_unset + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_int32_wrapper: 0}.single_int32_wrapper' is evaluated + Then value is celpy.celtypes.IntType(source=0) - Given container is "google.api.expr.test.v1.proto2" +@wip +Scenario: double/field_read_proto2_unset - When CEL expression "TestAllTypes{}.single_double_wrapper" is evaluated - # null_value:NULL_VALUE + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.single_double_wrapper' is evaluated Then value is None +Scenario: double/field_assign_proto3 -Scenario: field_assign_proto3 - - Given container is "google.api.expr.test.v1.proto3" + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_double_wrapper: -9.75}' is evaluated + Then value is TestAllTypes(single_double_wrapper=celpy.celtypes.DoubleType(source=-9.75)) - When CEL expression "TestAllTypes{single_double_wrapper: -9.75}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_double_wrapper:{value:-9.75}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=-9.75, single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) +Scenario: double/field_assign_proto3_zero + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_double_wrapper: 0.0}' is evaluated + Then value is TestAllTypes(single_double_wrapper=celpy.celtypes.DoubleType(source=0.0)) -Scenario: field_assign_proto3_zero +Scenario: double/field_assign_proto3_range - Given container is "google.api.expr.test.v1.proto3" + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_double_wrapper: -9.9e100}' is evaluated + Then value is TestAllTypes(single_double_wrapper=celpy.celtypes.DoubleType(source=-9.9e+100)) - When CEL expression "TestAllTypes{single_double_wrapper: 0.0}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_double_wrapper:{}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=None, single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) +Scenario: double/field_read_proto3 + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_double_wrapper: 64.25}.single_double_wrapper' is evaluated + Then value is celpy.celtypes.DoubleType(source=64.25) -Scenario: field_assign_proto3_range +Scenario: double/field_read_proto3_zero - Given container is "google.api.expr.test.v1.proto3" + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_double_wrapper: 0.0}.single_double_wrapper' is evaluated + Then value is celpy.celtypes.DoubleType(source=0.0) - When CEL expression "TestAllTypes{single_double_wrapper: -9.9e-100}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_double_wrapper:{value:-9.9e-100}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=-9.9e-100, single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: field_read_proto3 - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_double_wrapper: 64.25}.single_double_wrapper" is evaluated - # double_value:64.25 - Then value is DoubleType(source=64.25) - - -Scenario: field_read_proto3_zero - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_double_wrapper: 0.0}.single_double_wrapper" is evaluated - # double_value:0 - Then value is DoubleType(source=0) - - -Scenario: field_read_proto3_unset - - Given container is "google.api.expr.test.v1.proto3" +@wip +Scenario: double/field_read_proto3_unset - When CEL expression "TestAllTypes{}.single_double_wrapper" is evaluated - # null_value:NULL_VALUE + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{}.single_double_wrapper' is evaluated Then value is None - # bool -- Tests for bool conversion. -Scenario: literal - - When CEL expression "google.protobuf.BoolValue{value: true}" is evaluated - # bool_value:true - Then value is BoolType(source=True) +@wip +Scenario: bool/literal + When CEL expression 'google.protobuf.BoolValue{value: true}' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: literal_no_field_access +Scenario: bool/literal_no_field_access - When CEL expression "google.protobuf.BoolValue{value: true}.value" is evaluated - # errors:{message:"no_matching_overload"} + Given disable_check parameter is True + When CEL expression 'google.protobuf.BoolValue{value: true}.value' is evaluated Then eval_error is 'no_matching_overload' +@wip +Scenario: bool/literal_empty -Scenario: literal_empty - - When CEL expression "google.protobuf.BoolValue{}" is evaluated - # bool_value:false - Then value is BoolType(source=False) - - -Scenario: var - - # type:{message_type:"google.protobuf.BoolValue"} - Given type_env parameter "x" is TypeType(value='google.protobuf.BoolValue') - - # object_value:{[type.googleapis.com/google.protobuf.BoolValue]:{value:true}} - Given bindings parameter "x" is BoolType(source=True) - - When CEL expression "x" is evaluated - # bool_value:true - Then value is BoolType(source=True) - - -Scenario: field_assign_proto2 - - Given container is "google.api.expr.test.v1.proto2" - - When CEL expression "TestAllTypes{single_bool_wrapper: true}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_bool_wrapper:{value:true}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=True, single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: field_assign_proto2_false - - Given container is "google.api.expr.test.v1.proto2" + When CEL expression 'google.protobuf.BoolValue{}' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "TestAllTypes{single_bool_wrapper: false}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_bool_wrapper:{}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=None, single_bytes_wrapper=BytesType(source=b''), list_value=[]) +Scenario: bool/var + Given type_env parameter "x" is celpy.celtypes.BoolType + and bindings parameter "x" is celpy.celtypes.BoolType(source=True) + When CEL expression 'x' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: field_assign_proto3 +Scenario: bool/field_assign_proto2 - Given container is "google.api.expr.test.v1.proto3" + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_bool_wrapper: true}' is evaluated + Then value is TestAllTypes(single_bool_wrapper=celpy.celtypes.BoolType(source=True)) - When CEL expression "TestAllTypes{single_bool_wrapper: true}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_bool_wrapper:{value:true}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=True, single_bytes_wrapper=BytesType(source=b''), list_value=[]) +Scenario: bool/field_assign_proto2_false + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_bool_wrapper: false}' is evaluated + Then value is TestAllTypes(single_bool_wrapper=celpy.celtypes.BoolType(source=False)) -Scenario: field_assign_proto3_false +Scenario: bool/field_assign_proto3 - Given container is "google.api.expr.test.v1.proto3" + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_bool_wrapper: true}' is evaluated + Then value is TestAllTypes(single_bool_wrapper=celpy.celtypes.BoolType(source=True)) - When CEL expression "TestAllTypes{single_bool_wrapper: false}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_bool_wrapper:{}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=None, single_bytes_wrapper=BytesType(source=b''), list_value=[]) +Scenario: bool/field_assign_proto3_false + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_bool_wrapper: false}' is evaluated + Then value is TestAllTypes(single_bool_wrapper=celpy.celtypes.BoolType(source=False)) # string -- Tests for string conversion. -Scenario: literal +@wip +Scenario: string/literal When CEL expression "google.protobuf.StringValue{value: 'foo'}" is evaluated - # string_value:"foo" - Then value is StringType(source='foo') - + Then value is celpy.celtypes.StringType(source='foo') -Scenario: literal_no_field_access +Scenario: string/literal_no_field_access + Given disable_check parameter is True When CEL expression "google.protobuf.StringValue{value: 'foo'}.value" is evaluated - # errors:{message:"no_matching_overload"} Then eval_error is 'no_matching_overload' +@wip +Scenario: string/literal_empty -Scenario: literal_empty - - When CEL expression "google.protobuf.StringValue{}" is evaluated - # string_value:"" - Then value is StringType(source='') - + When CEL expression 'google.protobuf.StringValue{}' is evaluated + Then value is celpy.celtypes.StringType(source='') -Scenario: literal_unicode +@wip +Scenario: string/literal_unicode When CEL expression "google.protobuf.StringValue{value: 'flambé'}" is evaluated - # string_value:"flambé" - Then value is StringType(source='flambé') - - -Scenario: var - - # type:{message_type:"google.protobuf.StringValue"} - Given type_env parameter "x" is TypeType(value='google.protobuf.StringValue') - - # object_value:{[type.googleapis.com/google.protobuf.StringValue]:{value:"bar"}} - Given bindings parameter "x" is StringType(source='bar') - - When CEL expression "x" is evaluated - # string_value:"bar" - Then value is StringType(source='bar') + Then value is celpy.celtypes.StringType(source='flambé') +Scenario: string/var -Scenario: field_assign_proto2 + Given type_env parameter "x" is celpy.celtypes.StringType + and bindings parameter "x" is celpy.celtypes.StringType(source='bar') + When CEL expression 'x' is evaluated + Then value is celpy.celtypes.StringType(source='bar') - Given container is "google.api.expr.test.v1.proto2" +Scenario: string/field_assign_proto2 + Given container is 'cel.expr.conformance.proto2' When CEL expression "TestAllTypes{single_string_wrapper: 'baz'}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_string_wrapper:{value:"baz"}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper='baz', single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Then value is TestAllTypes(single_string_wrapper=celpy.celtypes.StringType(source='baz')) +Scenario: string/field_assign_proto2_empty -Scenario: field_assign_proto2_empty - - Given container is "google.api.expr.test.v1.proto2" - + Given container is 'cel.expr.conformance.proto2' When CEL expression "TestAllTypes{single_string_wrapper: ''}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_string_wrapper:{}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=None, single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: field_assign_proto3 + Then value is TestAllTypes(single_string_wrapper=celpy.celtypes.StringType(source='')) - Given container is "google.api.expr.test.v1.proto3" +Scenario: string/field_assign_proto3 + Given container is 'cel.expr.conformance.proto3' When CEL expression "TestAllTypes{single_string_wrapper: 'bletch'}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_string_wrapper:{value:"bletch"}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper='bletch', single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Then value is TestAllTypes(single_string_wrapper=celpy.celtypes.StringType(source='bletch')) +Scenario: string/field_assign_proto3_empty -Scenario: field_assign_proto3_empty - - Given container is "google.api.expr.test.v1.proto3" - + Given container is 'cel.expr.conformance.proto3' When CEL expression "TestAllTypes{single_string_wrapper: ''}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_string_wrapper:{}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=None, single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - + Then value is TestAllTypes(single_string_wrapper=celpy.celtypes.StringType(source='')) # bytes -- Tests for bytes conversion. -Scenario: literal - - When CEL expression "google.protobuf.BytesValue{value: b'foo\123'}" is evaluated - # bytes_value:"fooS" - Then value is BytesType(source=b'fooS') +@wip +Scenario: bytes/literal + When CEL expression "google.protobuf.BytesValue{value: b'foo\\123'}" is evaluated + Then value is celpy.celtypes.BytesType(source=b'fooS') -Scenario: literal_no_field_access +Scenario: bytes/literal_no_field_access + Given disable_check parameter is True When CEL expression "google.protobuf.BytesValue{value: b'foo'}.value" is evaluated - # errors:{message:"no_matching_overload"} Then eval_error is 'no_matching_overload' +Scenario: bytes/literal_empty -Scenario: literal_empty - - When CEL expression "google.protobuf.BytesValue{}" is evaluated - # bytes_value:"" - Then value is BytesType(source=b'') - + When CEL expression 'google.protobuf.BytesValue{}' is evaluated + Then value is celpy.celtypes.BytesType(source=b'') -Scenario: literal_unicode +@wip +Scenario: bytes/literal_unicode When CEL expression "google.protobuf.BytesValue{value: b'flambé'}" is evaluated - # bytes_value:"flambé" - Then value is BytesType(source=b'flamb\xc3\xa9') - - -Scenario: var + Then value is celpy.celtypes.BytesType(source=b'flamb\xc3\xa9') - # type:{message_type:"google.protobuf.BytesValue"} - Given type_env parameter "x" is TypeType(value='google.protobuf.BytesValue') +Scenario: bytes/var - # object_value:{[type.googleapis.com/google.protobuf.BytesValue]:{value:"bar"}} - Given bindings parameter "x" is BytesType(source='bar') + Given type_env parameter "x" is celpy.celtypes.BytesType + and bindings parameter "x" is celpy.celtypes.BytesType(source=b'bar') + When CEL expression 'x' is evaluated + Then value is celpy.celtypes.BytesType(source=b'bar') - When CEL expression "x" is evaluated - # bytes_value:"bar" - Then value is BytesType(source=b'bar') - - -Scenario: field_assign_proto2 - - Given container is "google.api.expr.test.v1.proto2" +Scenario: bytes/field_assign_proto2 + Given container is 'cel.expr.conformance.proto2' When CEL expression "TestAllTypes{single_bytes_wrapper: b'baz'}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_bytes_wrapper:{value:"baz"}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper='baz', list_value=[]) - + Then value is TestAllTypes(single_bytes_wrapper=celpy.celtypes.BytesType(source=b'baz')) -Scenario: field_assign_proto2_empty - - Given container is "google.api.expr.test.v1.proto2" +Scenario: bytes/field_assign_proto2_empty + Given container is 'cel.expr.conformance.proto2' When CEL expression "TestAllTypes{single_bytes_wrapper: b''}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_bytes_wrapper:{}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=None, list_value=[]) - - -Scenario: field_assign_proto3 + Then value is TestAllTypes(single_bytes_wrapper=celpy.celtypes.BytesType(source=b'')) - Given container is "google.api.expr.test.v1.proto3" +Scenario: bytes/field_assign_proto3 + Given container is 'cel.expr.conformance.proto3' When CEL expression "TestAllTypes{single_bytes_wrapper: b'bletch'}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_bytes_wrapper:{value:"bletch"}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper='bletch', list_value=[]) + Then value is TestAllTypes(single_bytes_wrapper=celpy.celtypes.BytesType(source=b'bletch')) +Scenario: bytes/field_assign_proto3_empty -Scenario: field_assign_proto3_empty - - Given container is "google.api.expr.test.v1.proto3" - + Given container is 'cel.expr.conformance.proto3' When CEL expression "TestAllTypes{single_bytes_wrapper: b''}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_bytes_wrapper:{}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=None, list_value=[]) - + Then value is TestAllTypes(single_bytes_wrapper=celpy.celtypes.BytesType(source=b'')) # list -- Tests for list conversion. -Scenario: literal +@wip +Scenario: list/literal When CEL expression "google.protobuf.ListValue{values: [3.0, 'foo', null]}" is evaluated - # list_value:{values:{double_value:3} values:{string_value:"foo"} values:{null_value:NULL_VALUE}} - Then value is [DoubleType(source=3), StringType(source='foo'), None] - + Then value is [celpy.celtypes.DoubleType(source=3.0), celpy.celtypes.StringType(source='foo'), None] -Scenario: literal_no_field_access +Scenario: list/literal_no_field_access + Given disable_check parameter is True When CEL expression "google.protobuf.ListValue{values: [3.0, 'foo', null]}.values" is evaluated - # errors:{message:"no_matching_overload"} Then eval_error is 'no_matching_overload' +@wip +Scenario: list/literal_empty -Scenario: literal_empty - - When CEL expression "google.protobuf.ListValue{values: []}" is evaluated - # list_value:{} + When CEL expression 'google.protobuf.ListValue{values: []}' is evaluated Then value is [] +Scenario: list/var -Scenario: var - - # type:{message_type:"google.protobuf.ListValue"} - Given type_env parameter "x" is TypeType(value='google.protobuf.ListValue') - - # object_value:{[type.googleapis.com/google.protobuf.ListValue]:{values:{string_value:"bar"} values:{list_value:{values:{string_value:"a"} values:{string_value:"b"}}}}} - Given bindings parameter "x" is [StringType(source='bar'), [StringType(source='a'), StringType(source='b')]] - - When CEL expression "x" is evaluated - # list_value:{values:{string_value:"bar"} values:{list_value:{values:{string_value:"a"} values:{string_value:"b"}}}} - Then value is [StringType(source='bar'), [StringType(source='a'), StringType(source='b')]] + Given type_env parameter "x" is celpy.celtypes.ListType + and bindings parameter "x" is [celpy.celtypes.StringType(source='bar'), [celpy.celtypes.StringType(source='a'), celpy.celtypes.StringType(source='b')]] + When CEL expression 'x' is evaluated + Then value is [celpy.celtypes.StringType(source='bar'), [celpy.celtypes.StringType(source='a'), celpy.celtypes.StringType(source='b')]] +Scenario: list/field_assign_proto2 -Scenario: field_assign_proto2 - - Given container is "google.api.expr.test.v1.proto2" - + Given container is 'cel.expr.conformance.proto2' When CEL expression "TestAllTypes{list_value: [1.0, 'one']}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{list_value:{values:{number_value:1} values:{string_value:"one"}}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[DoubleType(source=1), StringType(source='one')]) - + Then value is TestAllTypes(list_value=[celpy.celtypes.DoubleType(source=1.0), celpy.celtypes.StringType(source='one')]) -Scenario: field_assign_proto2_empty +Scenario: list/field_assign_proto2_empty - Given container is "google.api.expr.test.v1.proto2" + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{list_value: []}' is evaluated + Then value is TestAllTypes(list_value=[]) - When CEL expression "TestAllTypes{list_value: []}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{list_value:{}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=None) - - -Scenario: field_read_proto2 - - Given container is "google.api.expr.test.v1.proto2" +Scenario: list/field_read_proto2 + Given container is 'cel.expr.conformance.proto2' When CEL expression "TestAllTypes{list_value: [1.0, 'one']}.list_value" is evaluated - # list_value:{values:{double_value:1} values:{string_value:"one"}} - Then value is [DoubleType(source=1), StringType(source='one')] - + Then value is [celpy.celtypes.DoubleType(source=1.0), celpy.celtypes.StringType(source='one')] -Scenario: field_read_proto2_empty +Scenario: list/field_read_proto2_empty - Given container is "google.api.expr.test.v1.proto2" - - When CEL expression "TestAllTypes{list_value: []}.list_value" is evaluated - # list_value:{} + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{list_value: []}.list_value' is evaluated Then value is [] - -Scenario: field_read_proto2_unset +Scenario: list/field_read_proto2_unset Not a wrapper type, so doesn't convert to null. - Given container is "google.api.expr.test.v1.proto2" - When CEL expression "TestAllTypes{}.list_value" is evaluated - # list_value:{} + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.list_value' is evaluated Then value is [] +Scenario: list/field_assign_proto3 -Scenario: field_assign_proto3 - - Given container is "google.api.expr.test.v1.proto3" - + Given container is 'cel.expr.conformance.proto3' When CEL expression "TestAllTypes{list_value: [1.0, 'one']}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{list_value:{values:{number_value:1} values:{string_value:"one"}}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[DoubleType(source=1), StringType(source='one')]) - - -Scenario: field_assign_proto3_empty - - Given container is "google.api.expr.test.v1.proto3" + Then value is TestAllTypes(list_value=[celpy.celtypes.DoubleType(source=1.0), celpy.celtypes.StringType(source='one')]) - When CEL expression "TestAllTypes{list_value: []}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{list_value:{}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=None) +Scenario: list/field_assign_proto3_empty + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{list_value: []}' is evaluated + Then value is TestAllTypes(list_value=[]) -Scenario: field_read_proto3 - - Given container is "google.api.expr.test.v1.proto3" +Scenario: list/field_read_proto3 + Given container is 'cel.expr.conformance.proto3' When CEL expression "TestAllTypes{list_value: [1.0, 'one']}.list_value" is evaluated - # list_value:{values:{double_value:1} values:{string_value:"one"}} - Then value is [DoubleType(source=1), StringType(source='one')] - - -Scenario: field_read_proto3_empty + Then value is [celpy.celtypes.DoubleType(source=1.0), celpy.celtypes.StringType(source='one')] - Given container is "google.api.expr.test.v1.proto3" +Scenario: list/field_read_proto3_empty - When CEL expression "TestAllTypes{list_value: []}.list_value" is evaluated - # list_value:{} + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{list_value: []}.list_value' is evaluated Then value is [] - -Scenario: field_read_proto3_unset +Scenario: list/field_read_proto3_unset Not a wrapper type, so doesn't convert to null. - Given container is "google.api.expr.test.v1.proto3" - When CEL expression "TestAllTypes{}.list_value" is evaluated - # list_value:{} + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{}.list_value' is evaluated Then value is [] - # struct -- Tests for struct conversion. -Scenario: literal +@wip +Scenario: struct/literal When CEL expression "google.protobuf.Struct{fields: {'uno': 1.0, 'dos': 2.0}}" is evaluated - # map_value:{entries:{key:{string_value:"uno"} value:{double_value:1}} entries:{key:{string_value:"dos"} value:{double_value:2}}} - Then value is MapType({StringType(source='uno'): DoubleType(source=1), StringType(source='dos'): DoubleType(source=2)}) - + Then value is celpy.celtypes.MapType({'uno': celpy.celtypes.DoubleType(source=1.0), 'dos': celpy.celtypes.DoubleType(source=2.0)}) -Scenario: literal_no_field_access +@wip +Scenario: struct/literal_no_field_access + Given disable_check parameter is True When CEL expression "google.protobuf.Struct{fields: {'uno': 1.0, 'dos': 2.0}}.fields" is evaluated - # errors:{message:"no_matching_overload"} Then eval_error is 'no_matching_overload' +@wip +Scenario: struct/literal_empty -Scenario: literal_empty - - When CEL expression "google.protobuf.Struct{fields: {}}" is evaluated - # map_value:{} - Then value is MapType({}) - - -Scenario: var - - # type:{message_type:"google.protobuf.Struct"} - Given type_env parameter "x" is TypeType(value='google.protobuf.Struct') - - # object_value:{[type.googleapis.com/google.protobuf.Struct]:{fields:{key:"first" value:{string_value:"Abraham"}} fields:{key:"last" value:{string_value:"Lincoln"}}}} - Given bindings parameter "x" is {'first': StringType(source='Abraham'), 'last': StringType(source='Lincoln')} - - When CEL expression "x" is evaluated - # map_value:{entries:{key:{string_value:"first"} value:{string_value:"Abraham"}} entries:{key:{string_value:"last"} value:{string_value:"Lincoln"}}} - Then value is MapType({StringType(source='first'): StringType(source='Abraham'), StringType(source='last'): StringType(source='Lincoln')}) + When CEL expression 'google.protobuf.Struct{fields: {}}' is evaluated + Then value is celpy.celtypes.MapType({}) +Scenario: struct/var -Scenario: field_assign_proto2 + Given type_env parameter "x" is celpy.celtypes.MapType + and bindings parameter "x" is celpy.celtypes.MapType({'last': celpy.celtypes.StringType(source='Lincoln'), 'first': celpy.celtypes.StringType(source='Abraham')}) + When CEL expression 'x' is evaluated + Then value is celpy.celtypes.MapType({'first': celpy.celtypes.StringType(source='Abraham'), 'last': celpy.celtypes.StringType(source='Lincoln')}) - Given container is "google.api.expr.test.v1.proto2" +Scenario: struct/field_assign_proto2 + Given container is 'cel.expr.conformance.proto2' When CEL expression "TestAllTypes{single_struct: {'un': 1.0, 'deux': 2.0}}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_struct:{fields:{key:"deux" value:{number_value:2}} fields:{key:"un" value:{number_value:1}}}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({'deux': DoubleType(source=2), 'un': DoubleType(source=1)}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: field_assign_proto2_empty + Then value is TestAllTypes(single_struct=celpy.celtypes.MapType({'deux': celpy.celtypes.DoubleType(source=2.0), 'un': celpy.celtypes.DoubleType(source=1.0)})) - Given container is "google.api.expr.test.v1.proto2" +Scenario: struct/field_assign_proto2_empty - When CEL expression "TestAllTypes{single_struct: {}}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_struct:{}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=None, single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_struct: {}}' is evaluated + Then value is TestAllTypes(single_struct=celpy.celtypes.MapType({})) +@wip +Scenario: struct/field_assign_proto2_bad -Scenario: field_assign_proto2_bad - - Given container is "google.api.expr.test.v1.proto2" - + Given disable_check parameter is True + and container is 'cel.expr.conformance.proto2' When CEL expression "TestAllTypes{single_struct: {1: 'uno'}}" is evaluated - # errors:{message:"bad key type"} Then eval_error is 'bad key type' +Scenario: struct/field_read_proto2 -Scenario: field_read_proto2 - - Given container is "google.api.expr.test.v1.proto2" - + Given container is 'cel.expr.conformance.proto2' When CEL expression "TestAllTypes{single_struct: {'one': 1.0}}.single_struct" is evaluated - # map_value:{entries:{key:{string_value:"one"} value:{double_value:1}}} - Then value is MapType({StringType(source='one'): DoubleType(source=1)}) - - -Scenario: field_read_proto2_empty + Then value is celpy.celtypes.MapType({'one': celpy.celtypes.DoubleType(source=1.0)}) - Given container is "google.api.expr.test.v1.proto2" +Scenario: struct/field_read_proto2_empty - When CEL expression "TestAllTypes{single_struct: {}}.single_struct" is evaluated - # map_value:{} - Then value is MapType({}) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_struct: {}}.single_struct' is evaluated + Then value is celpy.celtypes.MapType({}) - -Scenario: field_read_proto2_unset +Scenario: struct/field_read_proto2_unset Not a wrapper type, so doesn't convert to null. - Given container is "google.api.expr.test.v1.proto2" - - When CEL expression "TestAllTypes{}.single_struct" is evaluated - # map_value:{} - Then value is MapType({}) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.single_struct' is evaluated + Then value is celpy.celtypes.MapType({}) -Scenario: field_assign_proto3 - - Given container is "google.api.expr.test.v1.proto3" +Scenario: struct/field_assign_proto3 + Given container is 'cel.expr.conformance.proto3' When CEL expression "TestAllTypes{single_struct: {'un': 1.0, 'deux': 2.0}}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_struct:{fields:{key:"deux" value:{number_value:2}} fields:{key:"un" value:{number_value:1}}}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({'deux': DoubleType(source=2), 'un': DoubleType(source=1)}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: field_assign_proto3_empty - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_struct: {}}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_struct:{}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=None, single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Then value is TestAllTypes(single_struct=celpy.celtypes.MapType({'deux': celpy.celtypes.DoubleType(source=2.0), 'un': celpy.celtypes.DoubleType(source=1.0)})) +Scenario: struct/field_assign_proto3_empty -Scenario: field_assign_proto3_bad + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_struct: {}}' is evaluated + Then value is TestAllTypes(single_struct=celpy.celtypes.MapType({})) - Given container is "google.api.expr.test.v1.proto3" +@wip +Scenario: struct/field_assign_proto3_bad + Given disable_check parameter is True + and container is 'cel.expr.conformance.proto3' When CEL expression "TestAllTypes{single_struct: {1: 'uno'}}" is evaluated - # errors:{message:"bad key type"} Then eval_error is 'bad key type' +Scenario: struct/field_read_proto3 -Scenario: field_read_proto3 - - Given container is "google.api.expr.test.v1.proto3" - + Given container is 'cel.expr.conformance.proto3' When CEL expression "TestAllTypes{single_struct: {'one': 1.0}}.single_struct" is evaluated - # map_value:{entries:{key:{string_value:"one"} value:{double_value:1}}} - Then value is MapType({StringType(source='one'): DoubleType(source=1)}) - - -Scenario: field_read_proto3_empty - - Given container is "google.api.expr.test.v1.proto3" + Then value is celpy.celtypes.MapType({'one': celpy.celtypes.DoubleType(source=1.0)}) - When CEL expression "TestAllTypes{single_struct: {}}.single_struct" is evaluated - # map_value:{} - Then value is MapType({}) +Scenario: struct/field_read_proto3_empty + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_struct: {}}.single_struct' is evaluated + Then value is celpy.celtypes.MapType({}) -Scenario: field_read_proto3_unset +Scenario: struct/field_read_proto3_unset Not a wrapper type, so doesn't convert to null. - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{}.single_struct" is evaluated - # map_value:{} - Then value is MapType({}) + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{}.single_struct' is evaluated + Then value is celpy.celtypes.MapType({}) # value_null -- Tests for null conversions. -Scenario: literal - - Given container is "google.protobuf" +@wip +Scenario: value_null/literal - When CEL expression "Value{null_value: NullValue.NULL_VALUE}" is evaluated - # null_value:NULL_VALUE + Given container is 'google.protobuf' + When CEL expression 'Value{null_value: NullValue.NULL_VALUE}' is evaluated Then value is None +Scenario: value_null/literal_no_field_access -Scenario: literal_no_field_access - - Given container is "google.protobuf" - - When CEL expression "Value{null_value: NullValue.NULL_VALUE}.null_value" is evaluated - # errors:{message:"no_matching_overload"} + Given disable_check parameter is True + and container is 'google.protobuf' + When CEL expression 'Value{null_value: NullValue.NULL_VALUE}.null_value' is evaluated Then eval_error is 'no_matching_overload' +@wip +Scenario: value_null/literal_unset -Scenario: literal_unset - - When CEL expression "google.protobuf.Value{}" is evaluated - # null_value:NULL_VALUE + When CEL expression 'google.protobuf.Value{}' is evaluated Then value is None +Scenario: value_null/var -Scenario: var - - # type:{message_type:"google.protobuf.Value"} - Given type_env parameter "x" is TypeType(value='google.protobuf.Value') - - # object_value:{[type.googleapis.com/google.protobuf.Value]:{null_value:NULL_VALUE}} - Given bindings parameter "x" is None - - When CEL expression "x" is evaluated - # null_value:NULL_VALUE + Given type_env parameter "x" is celpy.celtypes.MessageType + and bindings parameter "x" is None + When CEL expression 'x' is evaluated Then value is None +Scenario: value_null/field_assign_proto2 -Scenario: field_assign_proto2 - - Given container is "google.api.expr.test.v1.proto2" - - When CEL expression "TestAllTypes{single_value: null}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_value:{null_value:NULL_VALUE}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: field_read_proto2 + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_value: null}' is evaluated + Then value is TestAllTypes(single_value=None) - Given container is "google.api.expr.test.v1.proto2" +Scenario: value_null/field_read_proto2 - When CEL expression "TestAllTypes{single_value: null}.single_value" is evaluated - # null_value:NULL_VALUE + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_value: null}.single_value' is evaluated Then value is None +@wip +Scenario: value_null/field_read_proto2_unset -Scenario: field_read_proto2_unset - - Given container is "google.api.expr.test.v1.proto2" - - When CEL expression "TestAllTypes{}.single_value" is evaluated - # null_value:NULL_VALUE + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.single_value' is evaluated Then value is None +Scenario: value_null/field_assign_proto3 -Scenario: field_assign_proto3 - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_value: null}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_value:{null_value:NULL_VALUE}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: field_read_proto3 + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_value: null}' is evaluated + Then value is TestAllTypes(single_value=None) - Given container is "google.api.expr.test.v1.proto3" +Scenario: value_null/field_read_proto3 - When CEL expression "TestAllTypes{single_value: null}.single_value" is evaluated - # null_value:NULL_VALUE + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_value: null}.single_value' is evaluated Then value is None +@wip +Scenario: value_null/field_read_proto3_unset -Scenario: field_read_proto3_unset - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{}.single_value" is evaluated - # null_value:NULL_VALUE + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{}.single_value' is evaluated Then value is None - # value_number -- Tests for number conversions in Value. -Scenario: literal - - When CEL expression "google.protobuf.Value{number_value: 12.5}" is evaluated - # double_value:12.5 - Then value is DoubleType(source=12.5) +@wip +Scenario: value_number/literal + When CEL expression 'google.protobuf.Value{number_value: 12.5}' is evaluated + Then value is celpy.celtypes.DoubleType(source=12.5) -Scenario: literal_no_field_access +Scenario: value_number/literal_no_field_access - When CEL expression "google.protobuf.Value{number_value: 12.5}.number_value" is evaluated - # errors:{message:"no_matching_overload"} + Given disable_check parameter is True + When CEL expression 'google.protobuf.Value{number_value: 12.5}.number_value' is evaluated Then eval_error is 'no_matching_overload' +@wip +Scenario: value_number/literal_zero -Scenario: literal_zero - - When CEL expression "google.protobuf.Value{number_value: 0.0}" is evaluated - # double_value:0 - Then value is DoubleType(source=0) - - -Scenario: var - - # type:{message_type:"google.protobuf.Value"} - Given type_env parameter "x" is TypeType(value='google.protobuf.Value') - - # object_value:{[type.googleapis.com/google.protobuf.Value]:{number_value:-26.375}} - Given bindings parameter "x" is DoubleType(source=-26.375) - - When CEL expression "x" is evaluated - # double_value:-26.375 - Then value is DoubleType(source=-26.375) - - -Scenario: field_assign_proto2 - - Given container is "google.api.expr.test.v1.proto2" - - When CEL expression "TestAllTypes{single_value: 7e23}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_value:{number_value:7e+23}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=DoubleType(source=7e+23), single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: field_assign_proto2_zero - - Given container is "google.api.expr.test.v1.proto2" - - When CEL expression "TestAllTypes{single_value: 0.0}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_value:{number_value:0}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=DoubleType(source=0), single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: field_read_proto2 - - Given container is "google.api.expr.test.v1.proto2" - - When CEL expression "TestAllTypes{single_value: 7e23}.single_value" is evaluated - # double_value:7e+23 - Then value is DoubleType(source=7e+23) - - -Scenario: field_read_proto2_zero - - Given container is "google.api.expr.test.v1.proto2" + When CEL expression 'google.protobuf.Value{number_value: 0.0}' is evaluated + Then value is celpy.celtypes.DoubleType(source=0.0) - When CEL expression "TestAllTypes{single_value: 0.0}.single_value" is evaluated - # double_value:0 - Then value is DoubleType(source=0) +Scenario: value_number/var + Given type_env parameter "x" is celpy.celtypes.MessageType + and bindings parameter "x" is celpy.celtypes.DoubleType(source=-26.375) + When CEL expression 'x' is evaluated + Then value is celpy.celtypes.DoubleType(source=-26.375) -Scenario: field_assign_proto3 +Scenario: value_number/field_assign_proto2 - Given container is "google.api.expr.test.v1.proto3" + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_value: 7e23}' is evaluated + Then value is TestAllTypes(single_value=celpy.celtypes.DoubleType(source=7e+23)) - When CEL expression "TestAllTypes{single_value: 7e23}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_value:{number_value:7e+23}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=DoubleType(source=7e+23), single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) +Scenario: value_number/field_assign_proto2_zero + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_value: 0.0}' is evaluated + Then value is TestAllTypes(single_value=celpy.celtypes.DoubleType(source=0.0)) -Scenario: field_assign_proto3_zero +Scenario: value_number/field_read_proto2 - Given container is "google.api.expr.test.v1.proto3" + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_value: 7e23}.single_value' is evaluated + Then value is celpy.celtypes.DoubleType(source=7e+23) - When CEL expression "TestAllTypes{single_value: 0.0}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_value:{number_value:0}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=DoubleType(source=0), single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) +Scenario: value_number/field_read_proto2_zero + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_value: 0.0}.single_value' is evaluated + Then value is celpy.celtypes.DoubleType(source=0.0) -Scenario: field_read_proto3 +Scenario: value_number/field_assign_proto3 - Given container is "google.api.expr.test.v1.proto3" + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_value: 7e23}' is evaluated + Then value is TestAllTypes(single_value=celpy.celtypes.DoubleType(source=7e+23)) - When CEL expression "TestAllTypes{single_value: 7e23}.single_value" is evaluated - # double_value:7e+23 - Then value is DoubleType(source=7e+23) +Scenario: value_number/field_assign_proto3_zero + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_value: 0.0}' is evaluated + Then value is TestAllTypes(single_value=celpy.celtypes.DoubleType(source=0.0)) -Scenario: field_read_proto3_zero +Scenario: value_number/field_read_proto3 - Given container is "google.api.expr.test.v1.proto3" + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_value: 7e23}.single_value' is evaluated + Then value is celpy.celtypes.DoubleType(source=7e+23) - When CEL expression "TestAllTypes{single_value: 0.0}.single_value" is evaluated - # double_value:0 - Then value is DoubleType(source=0) +Scenario: value_number/field_read_proto3_zero + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_value: 0.0}.single_value' is evaluated + Then value is celpy.celtypes.DoubleType(source=0.0) # value_string -- Tests for string conversions in Value. -Scenario: literal +@wip +Scenario: value_string/literal When CEL expression "google.protobuf.Value{string_value: 'foo'}" is evaluated - # string_value:"foo" - Then value is StringType(source='foo') - + Then value is celpy.celtypes.StringType(source='foo') -Scenario: literal_no_field_access +Scenario: value_string/literal_no_field_access + Given disable_check parameter is True When CEL expression "google.protobuf.Value{string_value: 'foo'}.string_value" is evaluated - # errors:{message:"no_matching_overload"} Then eval_error is 'no_matching_overload' - -Scenario: literal_empty +@wip +Scenario: value_string/literal_empty When CEL expression "google.protobuf.Value{string_value: ''}" is evaluated - # string_value:"" - Then value is StringType(source='') - + Then value is celpy.celtypes.StringType(source='') -Scenario: var +Scenario: value_string/var - # type:{message_type:"google.protobuf.Value"} - Given type_env parameter "x" is TypeType(value='google.protobuf.Value') + Given type_env parameter "x" is celpy.celtypes.MessageType + and bindings parameter "x" is celpy.celtypes.StringType(source='bar') + When CEL expression 'x' is evaluated + Then value is celpy.celtypes.StringType(source='bar') - # object_value:{[type.googleapis.com/google.protobuf.Value]:{string_value:"bar"}} - Given bindings parameter "x" is StringType(source='bar') - - When CEL expression "x" is evaluated - # string_value:"bar" - Then value is StringType(source='bar') - - -Scenario: field_assign_proto2 - - Given container is "google.api.expr.test.v1.proto2" +Scenario: value_string/field_assign_proto2 + Given container is 'cel.expr.conformance.proto2' When CEL expression "TestAllTypes{single_value: 'baz'}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_value:{string_value:"baz"}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=StringType(source='baz'), single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Then value is TestAllTypes(single_value=celpy.celtypes.StringType(source='baz')) +Scenario: value_string/field_assign_proto2_empty -Scenario: field_assign_proto2_empty - - Given container is "google.api.expr.test.v1.proto2" - + Given container is 'cel.expr.conformance.proto2' When CEL expression "TestAllTypes{single_value: ''}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_value:{string_value:""}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=StringType(source=''), single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - + Then value is TestAllTypes(single_value=celpy.celtypes.StringType(source='')) -Scenario: field_read_proto2 - - Given container is "google.api.expr.test.v1.proto2" +Scenario: value_string/field_read_proto2 + Given container is 'cel.expr.conformance.proto2' When CEL expression "TestAllTypes{single_value: 'bletch'}.single_value" is evaluated - # string_value:"bletch" - Then value is StringType(source='bletch') - + Then value is celpy.celtypes.StringType(source='bletch') -Scenario: field_read_proto2_zero - - Given container is "google.api.expr.test.v1.proto2" +Scenario: value_string/field_read_proto2_zero + Given container is 'cel.expr.conformance.proto2' When CEL expression "TestAllTypes{single_value: ''}.single_value" is evaluated - # string_value:"" - Then value is StringType(source='') - + Then value is celpy.celtypes.StringType(source='') -Scenario: field_assign_proto3 - - Given container is "google.api.expr.test.v1.proto3" +Scenario: value_string/field_assign_proto3 + Given container is 'cel.expr.conformance.proto3' When CEL expression "TestAllTypes{single_value: 'baz'}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_value:{string_value:"baz"}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=StringType(source='baz'), single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: field_assign_proto3_empty + Then value is TestAllTypes(single_value=celpy.celtypes.StringType(source='baz')) - Given container is "google.api.expr.test.v1.proto3" +Scenario: value_string/field_assign_proto3_empty + Given container is 'cel.expr.conformance.proto3' When CEL expression "TestAllTypes{single_value: ''}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_value:{string_value:""}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=StringType(source=''), single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Then value is TestAllTypes(single_value=celpy.celtypes.StringType(source='')) +Scenario: value_string/field_read_proto3 -Scenario: field_read_proto3 - - Given container is "google.api.expr.test.v1.proto3" - + Given container is 'cel.expr.conformance.proto3' When CEL expression "TestAllTypes{single_value: 'bletch'}.single_value" is evaluated - # string_value:"bletch" - Then value is StringType(source='bletch') - - -Scenario: field_read_proto3_zero + Then value is celpy.celtypes.StringType(source='bletch') - Given container is "google.api.expr.test.v1.proto3" +Scenario: value_string/field_read_proto3_zero + Given container is 'cel.expr.conformance.proto3' When CEL expression "TestAllTypes{single_value: ''}.single_value" is evaluated - # string_value:"" - Then value is StringType(source='') - + Then value is celpy.celtypes.StringType(source='') # value_bool -- Tests for boolean conversions in Value. -Scenario: literal - - When CEL expression "google.protobuf.Value{bool_value: true}" is evaluated - # bool_value:true - Then value is BoolType(source=True) +@wip +Scenario: value_bool/literal + When CEL expression 'google.protobuf.Value{bool_value: true}' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: literal_no_field_access +Scenario: value_bool/literal_no_field_access - When CEL expression "google.protobuf.Value{bool_value: true}.bool_value" is evaluated - # errors:{message:"no_matching_overload"} + Given disable_check parameter is True + When CEL expression 'google.protobuf.Value{bool_value: true}.bool_value' is evaluated Then eval_error is 'no_matching_overload' +@wip +Scenario: value_bool/literal_false -Scenario: literal_false - - When CEL expression "google.protobuf.Value{bool_value: false}" is evaluated - # bool_value:false - Then value is BoolType(source=False) - - -Scenario: var - - # type:{message_type:"google.protobuf.Value"} - Given type_env parameter "x" is TypeType(value='google.protobuf.Value') - - # object_value:{[type.googleapis.com/google.protobuf.Value]:{bool_value:true}} - Given bindings parameter "x" is BoolType(source=True) - - When CEL expression "x" is evaluated - # bool_value:true - Then value is BoolType(source=True) - - -Scenario: field_assign_proto2 - - Given container is "google.api.expr.test.v1.proto2" - - When CEL expression "TestAllTypes{single_value: true}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_value:{bool_value:true}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=BoolType(source=True), single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: field_assign_proto2_false - - Given container is "google.api.expr.test.v1.proto2" - - When CEL expression "TestAllTypes{single_value: false}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_value:{bool_value:false}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=BoolType(source=False), single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: field_read_proto2 - - Given container is "google.api.expr.test.v1.proto2" - - When CEL expression "TestAllTypes{single_value: true}.single_value" is evaluated - # bool_value:true - Then value is BoolType(source=True) - - -Scenario: field_read_proto2_false - - Given container is "google.api.expr.test.v1.proto2" + When CEL expression 'google.protobuf.Value{bool_value: false}' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "TestAllTypes{single_value: false}.single_value" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: value_bool/var + Given type_env parameter "x" is celpy.celtypes.MessageType + and bindings parameter "x" is celpy.celtypes.BoolType(source=True) + When CEL expression 'x' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: field_assign_proto3 +Scenario: value_bool/field_assign_proto2 - Given container is "google.api.expr.test.v1.proto3" + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_value: true}' is evaluated + Then value is TestAllTypes(single_value=celpy.celtypes.BoolType(source=True)) - When CEL expression "TestAllTypes{single_value: true}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_value:{bool_value:true}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=BoolType(source=True), single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) +Scenario: value_bool/field_assign_proto2_false + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_value: false}' is evaluated + Then value is TestAllTypes(single_value=celpy.celtypes.BoolType(source=False)) -Scenario: field_assign_proto3_false +Scenario: value_bool/field_read_proto2 - Given container is "google.api.expr.test.v1.proto3" + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_value: true}.single_value' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "TestAllTypes{single_value: false}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_value:{bool_value:false}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=BoolType(source=False), single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) +Scenario: value_bool/field_read_proto2_false + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_value: false}.single_value' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: field_read_proto3 +Scenario: value_bool/field_assign_proto3 - Given container is "google.api.expr.test.v1.proto3" + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_value: true}' is evaluated + Then value is TestAllTypes(single_value=celpy.celtypes.BoolType(source=True)) - When CEL expression "TestAllTypes{single_value: true}.single_value" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: value_bool/field_assign_proto3_false + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_value: false}' is evaluated + Then value is TestAllTypes(single_value=celpy.celtypes.BoolType(source=False)) -Scenario: field_read_proto3_false +Scenario: value_bool/field_read_proto3 - Given container is "google.api.expr.test.v1.proto3" + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_value: true}.single_value' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "TestAllTypes{single_value: false}.single_value" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: value_bool/field_read_proto3_false + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_value: false}.single_value' is evaluated + Then value is celpy.celtypes.BoolType(source=False) # value_struct -- Tests for struct conversions in Value. -Scenario: literal +@wip +Scenario: value_struct/literal When CEL expression "google.protobuf.Value{struct_value: {'a': 1.0, 'b': 'two'}}" is evaluated - # map_value:{entries:{key:{string_value:"a"} value:{double_value:1}} entries:{key:{string_value:"b"} value:{string_value:"two"}}} - Then value is MapType({StringType(source='a'): DoubleType(source=1), StringType(source='b'): StringType(source='two')}) - + Then value is celpy.celtypes.MapType({'a': celpy.celtypes.DoubleType(source=1.0), 'b': celpy.celtypes.StringType(source='two')}) -Scenario: literal_no_field_access +Scenario: value_struct/literal_no_field_access + Given disable_check parameter is True When CEL expression "google.protobuf.Value{struct_value: {'a': 1.0, 'b': 'two'}}.struct_value" is evaluated - # errors:{message:"no_matching_overload"} Then eval_error is 'no_matching_overload' +@wip +Scenario: value_struct/literal_empty -Scenario: literal_empty - - When CEL expression "google.protobuf.Value{struct_value: {}}" is evaluated - # map_value:{} - Then value is MapType({}) - - -Scenario: var - - # type:{message_type:"google.protobuf.Value"} - Given type_env parameter "x" is TypeType(value='google.protobuf.Value') - - # object_value:{[type.googleapis.com/google.protobuf.Value]:{struct_value:{fields:{key:"x" value:{null_value:NULL_VALUE}} fields:{key:"y" value:{bool_value:false}}}}} - Given bindings parameter "x" is {'x': None, 'y': BoolType(source=False)} - - When CEL expression "x" is evaluated - # map_value:{entries:{key:{string_value:"x"} value:{null_value:NULL_VALUE}} entries:{key:{string_value:"y"} value:{bool_value:false}}} - Then value is MapType({StringType(source='x'): None, StringType(source='y'): BoolType(source=False)}) + When CEL expression 'google.protobuf.Value{struct_value: {}}' is evaluated + Then value is celpy.celtypes.MapType({}) +Scenario: value_struct/var -Scenario: field_assign_proto2 + Given type_env parameter "x" is celpy.celtypes.MessageType + and bindings parameter "x" is celpy.celtypes.MapType({'y': celpy.celtypes.BoolType(source=False), 'x': None}) + When CEL expression 'x' is evaluated + Then value is celpy.celtypes.MapType({'x': None, 'y': celpy.celtypes.BoolType(source=False)}) - Given container is "google.api.expr.test.v1.proto2" +Scenario: value_struct/field_assign_proto2 + Given container is 'cel.expr.conformance.proto2' When CEL expression "TestAllTypes{single_value: {'un': 1.0, 'deux': 2.0}}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_value:{struct_value:{fields:{key:"deux" value:{number_value:2}} fields:{key:"un" value:{number_value:1}}}}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value={'deux': DoubleType(source=2), 'un': DoubleType(source=1)}, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: field_assign_proto2_empty + Then value is TestAllTypes(single_value=celpy.celtypes.MapType({'deux': celpy.celtypes.DoubleType(source=2.0), 'un': celpy.celtypes.DoubleType(source=1.0)})) - Given container is "google.api.expr.test.v1.proto2" +Scenario: value_struct/field_assign_proto2_empty - When CEL expression "TestAllTypes{single_value: {}}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_value:{struct_value:{}}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value={}, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_value: {}}' is evaluated + Then value is TestAllTypes(single_value=celpy.celtypes.MapType({})) +Scenario: value_struct/field_read_proto2 -Scenario: field_read_proto2 - - Given container is "google.api.expr.test.v1.proto2" - + Given container is 'cel.expr.conformance.proto2' When CEL expression "TestAllTypes{single_value: {'i': true}}.single_value" is evaluated - # map_value:{entries:{key:{string_value:"i"} value:{bool_value:true}}} - Then value is MapType({StringType(source='i'): BoolType(source=True)}) - - -Scenario: field_read_proto2_empty + Then value is celpy.celtypes.MapType({'i': celpy.celtypes.BoolType(source=True)}) - Given container is "google.api.expr.test.v1.proto2" +Scenario: value_struct/field_read_proto2_empty - When CEL expression "TestAllTypes{single_value: {}}.single_value" is evaluated - # map_value:{} - Then value is MapType({}) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_value: {}}.single_value' is evaluated + Then value is celpy.celtypes.MapType({}) +Scenario: value_struct/field_assign_proto3 -Scenario: field_assign_proto3 - - Given container is "google.api.expr.test.v1.proto3" - + Given container is 'cel.expr.conformance.proto3' When CEL expression "TestAllTypes{single_value: {'un': 1.0, 'deux': 2.0}}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_value:{struct_value:{fields:{key:"deux" value:{number_value:2}} fields:{key:"un" value:{number_value:1}}}}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value={'deux': DoubleType(source=2), 'un': DoubleType(source=1)}, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - + Then value is TestAllTypes(single_value=celpy.celtypes.MapType({'deux': celpy.celtypes.DoubleType(source=2.0), 'un': celpy.celtypes.DoubleType(source=1.0)})) -Scenario: field_assign_proto3_empty +Scenario: value_struct/field_assign_proto3_empty - Given container is "google.api.expr.test.v1.proto3" + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_value: {}}' is evaluated + Then value is TestAllTypes(single_value=celpy.celtypes.MapType({})) - When CEL expression "TestAllTypes{single_value: {}}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_value:{struct_value:{}}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value={}, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: field_read_proto3 - - Given container is "google.api.expr.test.v1.proto3" +Scenario: value_struct/field_read_proto3 + Given container is 'cel.expr.conformance.proto3' When CEL expression "TestAllTypes{single_value: {'i': true}}.single_value" is evaluated - # map_value:{entries:{key:{string_value:"i"} value:{bool_value:true}}} - Then value is MapType({StringType(source='i'): BoolType(source=True)}) - + Then value is celpy.celtypes.MapType({'i': celpy.celtypes.BoolType(source=True)}) -Scenario: field_read_proto3_empty - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_value: {}}.single_value" is evaluated - # map_value:{} - Then value is MapType({}) +Scenario: value_struct/field_read_proto3_empty + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_value: {}}.single_value' is evaluated + Then value is celpy.celtypes.MapType({}) # value_list -- Tests for list conversions in Value. -Scenario: literal +@wip +Scenario: value_list/literal When CEL expression "google.protobuf.Value{list_value: ['a', 3.0]}" is evaluated - # list_value:{values:{string_value:"a"} values:{double_value:3}} - Then value is [StringType(source='a'), DoubleType(source=3)] + Then value is [celpy.celtypes.StringType(source='a'), celpy.celtypes.DoubleType(source=3.0)] +Scenario: value_list/literal_no_field_access -Scenario: literal_no_field_access - - When CEL expression "google.protobuf.Value{list_value: []}.list_value" is evaluated - # errors:{message:"no_matching_overload"} + Given disable_check parameter is True + When CEL expression 'google.protobuf.Value{list_value: []}.list_value' is evaluated Then eval_error is 'no_matching_overload' +@wip +Scenario: value_list/literal_empty -Scenario: literal_empty - - When CEL expression "google.protobuf.Value{list_value: []}" is evaluated - # list_value:{} + When CEL expression 'google.protobuf.Value{list_value: []}' is evaluated Then value is [] +Scenario: value_list/var -Scenario: var - - # type:{message_type:"google.protobuf.Value"} - Given type_env parameter "x" is TypeType(value='google.protobuf.Value') - - # object_value:{[type.googleapis.com/google.protobuf.Value]:{list_value:{values:{number_value:1} values:{bool_value:true} values:{string_value:"hi"}}}} - Given bindings parameter "x" is [DoubleType(source=1), BoolType(source=True), StringType(source='hi')] - - When CEL expression "x" is evaluated - # list_value:{values:{double_value:1} values:{bool_value:true} values:{string_value:"hi"}} - Then value is [DoubleType(source=1), BoolType(source=True), StringType(source='hi')] - + Given type_env parameter "x" is celpy.celtypes.MessageType + and bindings parameter "x" is [celpy.celtypes.DoubleType(source=1.0), celpy.celtypes.BoolType(source=True), celpy.celtypes.StringType(source='hi')] + When CEL expression 'x' is evaluated + Then value is [celpy.celtypes.DoubleType(source=1.0), celpy.celtypes.BoolType(source=True), celpy.celtypes.StringType(source='hi')] -Scenario: field_assign_proto2 - - Given container is "google.api.expr.test.v1.proto2" +Scenario: value_list/field_assign_proto2 + Given container is 'cel.expr.conformance.proto2' When CEL expression "TestAllTypes{single_value: ['un', 1.0]}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_value:{list_value:{values:{string_value:"un"} values:{number_value:1}}}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=[StringType(source='un'), DoubleType(source=1)], single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: field_assign_proto2_empty + Then value is TestAllTypes(single_value=[celpy.celtypes.StringType(source='un'), celpy.celtypes.DoubleType(source=1.0)]) - Given container is "google.api.expr.test.v1.proto2" +Scenario: value_list/field_assign_proto2_empty - When CEL expression "TestAllTypes{single_value: []}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_value:{list_value:{}}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=[], single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_value: []}' is evaluated + Then value is TestAllTypes(single_value=[]) +Scenario: value_list/field_read_proto2 -Scenario: field_read_proto2 - - Given container is "google.api.expr.test.v1.proto2" - + Given container is 'cel.expr.conformance.proto2' When CEL expression "TestAllTypes{single_value: ['i', true]}.single_value" is evaluated - # list_value:{values:{string_value:"i"} values:{bool_value:true}} - Then value is [StringType(source='i'), BoolType(source=True)] - + Then value is [celpy.celtypes.StringType(source='i'), celpy.celtypes.BoolType(source=True)] -Scenario: field_read_proto2_empty +Scenario: value_list/field_read_proto2_empty - Given container is "google.api.expr.test.v1.proto2" - - When CEL expression "TestAllTypes{single_value: []}.single_value" is evaluated - # list_value:{} + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_value: []}.single_value' is evaluated Then value is [] +Scenario: value_list/field_assign_proto3 -Scenario: field_assign_proto3 - - Given container is "google.api.expr.test.v1.proto3" - + Given container is 'cel.expr.conformance.proto3' When CEL expression "TestAllTypes{single_value: ['un', 1.0]}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_value:{list_value:{values:{string_value:"un"} values:{number_value:1}}}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=[StringType(source='un'), DoubleType(source=1)], single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: field_assign_proto3_empty - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_value: []}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_value:{list_value:{}}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=[], single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Then value is TestAllTypes(single_value=[celpy.celtypes.StringType(source='un'), celpy.celtypes.DoubleType(source=1.0)]) +Scenario: value_list/field_assign_proto3_empty -Scenario: field_read_proto3 + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_value: []}' is evaluated + Then value is TestAllTypes(single_value=[]) - Given container is "google.api.expr.test.v1.proto3" +Scenario: value_list/field_read_proto3 + Given container is 'cel.expr.conformance.proto3' When CEL expression "TestAllTypes{single_value: ['i', true]}.single_value" is evaluated - # list_value:{values:{string_value:"i"} values:{bool_value:true}} - Then value is [StringType(source='i'), BoolType(source=True)] + Then value is [celpy.celtypes.StringType(source='i'), celpy.celtypes.BoolType(source=True)] +Scenario: value_list/field_read_proto3_empty -Scenario: field_read_proto3_empty - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_value: []}.single_value" is evaluated - # list_value:{} + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_value: []}.single_value' is evaluated Then value is [] - # any -- Tests for Any conversion. -Scenario: literal - - When CEL expression "google.protobuf.Any{type_url: 'type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes', value: b'\x08\x96\x01'}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int32:150}} - Then value is TestAllTypes(single_int32=150, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) +@wip +Scenario: any/literal + When CEL expression "google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\x08\\x96\\x01'}" is evaluated + Then value is TestAllTypes(single_int32=150) -Scenario: literal_no_field_access +Scenario: any/literal_no_field_access - When CEL expression "google.protobuf.Any{type_url: 'type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes', value: b'\x08\x96\x01'}.type_url" is evaluated - # errors:{message:"no_matching_overload"} + Given disable_check parameter is True + When CEL expression "google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\x08\\x96\\x01'}.type_url" is evaluated Then eval_error is 'no_matching_overload' +Scenario: any/literal_empty -Scenario: literal_empty - - When CEL expression "google.protobuf.Any{}" is evaluated - # errors:{message:"conversion"} + When CEL expression 'google.protobuf.Any{}' is evaluated Then eval_error is 'conversion' +Scenario: any/var -Scenario: var - - # type:{message_type:"google.protubuf.Any"} - Given type_env parameter "x" is TypeType(value='google.protubuf.Any') + Given type_env parameter "x" is celpy.celtypes.MessageType + and bindings parameter "x" is TestAllTypes(single_int32=150) + When CEL expression 'x' is evaluated + Then value is TestAllTypes(single_int32=150) - # object_value:{[type.googleapis.com/google.protobuf.Any]:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int32:150}}} - Given bindings parameter "x" is TestAllTypes(single_int32=150, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) +Scenario: any/field_assign_proto2 - When CEL expression "x" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int32:150}} - Then value is TestAllTypes(single_int32=150, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_any: TestAllTypes{single_int32: 150}}' is evaluated + Then value is TestAllTypes(single_any=TestAllTypes(single_int32=150)) +Scenario: any/field_read_proto2 -Scenario: field_assign_proto2 + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_any: TestAllTypes{single_int32: 150}}.single_any' is evaluated + Then value is TestAllTypes(single_int32=150) - Given container is "google.api.expr.test.v1.proto2" +Scenario: any/field_assign_proto3 - When CEL expression "TestAllTypes{single_any: TestAllTypes{single_int32: 150}}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_any:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int32:150}}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=TestAllTypes(single_int32=150, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]), single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_any: TestAllTypes{single_int32: 150}}' is evaluated + Then value is TestAllTypes(single_any=TestAllTypes(single_int32=150)) +Scenario: any/field_read_proto3 -Scenario: field_read_proto2 - - Given container is "google.api.expr.test.v1.proto2" - - When CEL expression "TestAllTypes{single_any: TestAllTypes{single_int32: 150}}.single_any" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int32:150}} - Then value is TestAllTypes(single_int32=150, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: field_assign_proto3 - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_any: TestAllTypes{single_int32: 150}}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_any:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_int32:150}}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=TestAllTypes(single_int32=150, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]), single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: field_read_proto3 - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_any: TestAllTypes{single_int32: 150}}.single_any" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_int32:150}} - Then value is TestAllTypes(single_int32=150, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_any: TestAllTypes{single_int32: 150}}.single_any' is evaluated + Then value is TestAllTypes(single_int32=150) # complex -- Tests combining various dynamic conversions. -Scenario: any_list_map - - Given container is "google.api.expr.test.v1.proto3" +Scenario: complex/any_list_map + Given container is 'cel.expr.conformance.proto3' When CEL expression "TestAllTypes{single_any: [{'almost': 'done'}]}.single_any" is evaluated - # list_value:{values:{map_value:{entries:{key:{string_value:"almost"} value:{string_value:"done"}}}}} - Then value is [MapType({StringType(source='almost'): StringType(source='done')})] + Then value is [celpy.celtypes.MapType({'almost': celpy.celtypes.StringType(source='done')})] + diff --git a/features/dynamic.textproto b/features/dynamic.textproto index 83bdd27..d0e63a9 100644 --- a/features/dynamic.textproto +++ b/features/dynamic.textproto @@ -1,3 +1,6 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: cel.expr.conformance.test.SimpleTestFile + name: "dynamic" description: "Tests for 'dynamic' proto behavior, including JSON, wrapper, and Any messages." section { @@ -39,29 +42,51 @@ section { } test { name: "field_assign_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_int32_wrapper: 432}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_int32_wrapper { value: 432 } } } } } test { name: "field_assign_proto2_zero" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_int32_wrapper: 0}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_int32_wrapper { } } } } } + test { + name: "field_assign_proto2_max" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{single_int32_wrapper: 2147483647}" + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] + { single_int32_wrapper { value: 2147483647 } } + } + } + } + test { + name: "field_assign_proto2_min" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{single_int32_wrapper: -2147483648}" + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] + { single_int32_wrapper { value: -2147483648 } } + } + } + } test { name: "field_assign_proto2_range" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_int32_wrapper: 12345678900}" eval_error { errors { message: "range error" } @@ -69,47 +94,69 @@ section { } test { name: "field_read_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_int32_wrapper: 642}.single_int32_wrapper" value { int64_value: 642 } } test { name: "field_read_proto2_zero" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_int32_wrapper: 0}.single_int32_wrapper" value { int64_value: 0 } } test { name: "field_read_proto2_unset" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{}.single_int32_wrapper" value { null_value: NULL_VALUE } } test { name: "field_assign_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_int32_wrapper: -975}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_int32_wrapper { value: -975 } } } } } test { name: "field_assign_proto3_zero" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_int32_wrapper: 0}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_int32_wrapper { } } } } } + test { + name: "field_assign_proto3_max" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_int32_wrapper: 2147483647}" + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] + { single_int32_wrapper { value: 2147483647 } } + } + } + } + test { + name: "field_assign_proto3_min" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_int32_wrapper: -2147483648}" + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] + { single_int32_wrapper { value: -2147483648 } } + } + } + } test { name: "field_assign_proto3_range" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_int32_wrapper: -998877665544332211}" eval_error { errors { message: "range error" } @@ -117,19 +164,19 @@ section { } test { name: "field_read_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_int32_wrapper: 642}.single_int32_wrapper" value { int64_value: 642 } } test { name: "field_read_proto3_zero" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_int32_wrapper: 0}.single_int32_wrapper" value { int64_value: 0 } } test { name: "field_read_proto3_unset" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{}.single_int32_wrapper" value { null_value: NULL_VALUE } } @@ -173,44 +220,44 @@ section { } test { name: "field_assign_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_int64_wrapper: 432}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_int64_wrapper { value: 432 } } } } } test { name: "field_assign_proto2_zero" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_int64_wrapper: 0}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_int64_wrapper { } } } } } test { name: "field_assign_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_int64_wrapper: -975}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_int64_wrapper { value: -975 } } } } } test { name: "field_assign_proto3_zero" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_int64_wrapper: 0}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_int64_wrapper { } } } } @@ -255,29 +302,40 @@ section { } test { name: "field_assign_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_uint32_wrapper: 432u}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_uint32_wrapper { value: 432 } } } } } test { name: "field_assign_proto2_zero" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_uint32_wrapper: 0u}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_uint32_wrapper { } } } } } + test { + name: "field_assign_proto2_max" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{single_uint32_wrapper: 4294967295u}" + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] + { single_uint32_wrapper { value: 4294967295} } + } + } + } test { name: "field_assign_proto2_range" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_uint32_wrapper: 6111222333u}" eval_error { errors { message: "range error" } @@ -285,29 +343,40 @@ section { } test { name: "field_assign_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_uint32_wrapper: 975u}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_uint32_wrapper { value: 975 } } } } } test { name: "field_assign_proto3_zero" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_uint32_wrapper: 0u}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_uint32_wrapper { } } } } } + test { + name: "field_assign_proto3_max" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_uint32_wrapper: 4294967295u}" + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] + { single_uint32_wrapper { value: 4294967295 } } + } + } + } test { name: "field_assign_proto3_range" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_uint32_wrapper: 6111222333u}" eval_error { errors { message: "range error" } @@ -315,19 +384,19 @@ section { } test { name: "field_read_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_uint32_wrapper: 258u}.single_uint32_wrapper" value { uint64_value: 258 } } test { name: "field_read_proto2_zero" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_uint32_wrapper: 0u}.single_uint32_wrapper" value { uint64_value: 0 } } test { name: "field_read_proto2_unset" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{}.single_uint32_wrapper" value { null_value: NULL_VALUE } } @@ -371,63 +440,63 @@ section { } test { name: "field_assign_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_uint64_wrapper: 432u}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_uint64_wrapper { value: 432 } } } } } test { name: "field_assign_proto2_zero" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_uint64_wrapper: 0u}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_uint64_wrapper { } } } } } test { name: "field_assign_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_uint64_wrapper: 975u}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_uint64_wrapper { value: 975 } } } } } test { name: "field_assign_proto3_zero" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_uint64_wrapper: 0u}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_uint64_wrapper { } } } } } test { name: "field_read_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_uint64_wrapper: 5123123123u}.single_uint64_wrapper" value { uint64_value: 5123123123 } } test { name: "field_read_proto2_zero" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_uint64_wrapper: 0u}.single_uint64_wrapper" value { uint64_value: 0 } } test { name: "field_read_proto2_unset" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{}.single_uint64_wrapper" value { null_value: NULL_VALUE } } @@ -477,97 +546,152 @@ section { } test { name: "field_assign_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_float_wrapper: 86.75}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_float_wrapper { value: 86.75 } } } } } test { name: "field_assign_proto2_zero" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_float_wrapper: 0.0}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] + { single_float_wrapper { } } + } + } + } + test { + name: "field_assign_proto2_subnorm" + description: "Subnormal single floats range from ~1e-38 to ~1e-45." + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{single_float_wrapper: 1e-40}" + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] + { single_float_wrapper { value: 1e-40 } } + } + } + } + test { + name: "field_assign_proto2_round_to_zero" + description: "Subnormal single floats range from ~1e-38 to ~1e-45." + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{single_float_wrapper: 1e-50}" + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_float_wrapper { } } } } } test { name: "field_assign_proto2_range" - container: "google.api.expr.test.v1.proto2" + description: "Single float max is about 3.4e38" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_float_wrapper: 1.4e55}" - eval_error { - errors { message: "range error" } + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] + { single_float_wrapper { value: inf } } + } } } test { name: "field_read_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_float_wrapper: -12.375}.single_float_wrapper" value { double_value: -12.375 } } test { name: "field_read_proto2_zero" - container: "google.api.expr.test.v1.proto2" - expr: "TestAllTypes{single_int32_wrapper: 0}.single_int32_wrapper" - value { int64_value: 0 } + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{single_float_wrapper: 0.0}.single_float_wrapper" + value { double_value: 0.0 } } test { name: "field_read_proto2_unset" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{}.single_float_wrapper" value { null_value: NULL_VALUE } } test { name: "field_assign_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_float_wrapper: -9.75}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_float_wrapper { value: -9.75 } } } } } test { name: "field_assign_proto3_zero" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_float_wrapper: 0.0}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_float_wrapper { } } } } } test { - name: "field_assign_proto3_range" - container: "google.api.expr.test.v1.proto3" + name: "field_assign_proto2_subnorm" + description: "Subnormal single floats range from ~1e-38 to ~1e-45." + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{single_float_wrapper: 1e-40}" + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] + { single_float_wrapper { value: 1e-40 } } + } + } + } + test { + name: "field_assign_proto3_round_to_zero" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_float_wrapper: -9.9e-100}" - eval_error { - errors { message: "range error" } + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] + { single_float_wrapper { value: -0 } } + } + } + } + test { + name: "field_assign_proto3_range" + description: "Single float min is about -3.4e38" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_float_wrapper: -9.9e100}" + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] + { single_float_wrapper { value: -inf } } + } } } test { name: "field_read_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_float_wrapper: 64.25}.single_float_wrapper" value { double_value: 64.25 } } test { name: "field_read_proto3_zero" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_float_wrapper: 0.0}.single_float_wrapper" value { double_value: 0.0 } } test { name: "field_read_proto3_unset" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{}.single_float_wrapper" value { null_value: NULL_VALUE } } @@ -611,103 +735,103 @@ section { } test { name: "field_assign_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_double_wrapper: 86.75}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_double_wrapper { value: 86.75 } } } } } test { name: "field_assign_proto2_zero" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_double_wrapper: 0.0}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_double_wrapper { } } } } } test { name: "field_assign_proto2_range" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_double_wrapper: 1.4e55}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_double_wrapper { value: 1.4e55 } } } } } test { name: "field_read_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_double_wrapper: -12.375}.single_double_wrapper" value { double_value: -12.375 } } test { name: "field_read_proto2_zero" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_int32_wrapper: 0}.single_int32_wrapper" value { int64_value: 0 } } test { name: "field_read_proto2_unset" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{}.single_double_wrapper" value { null_value: NULL_VALUE } } test { name: "field_assign_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_double_wrapper: -9.75}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_double_wrapper { value: -9.75 } } } } } test { name: "field_assign_proto3_zero" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_double_wrapper: 0.0}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_double_wrapper { } } } } } test { name: "field_assign_proto3_range" - container: "google.api.expr.test.v1.proto3" - expr: "TestAllTypes{single_double_wrapper: -9.9e-100}" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_double_wrapper: -9.9e100}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] - { single_double_wrapper { value: -9.9e-100 } } + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] + { single_double_wrapper { value: -9.9e100 } } } } } test { name: "field_read_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_double_wrapper: 64.25}.single_double_wrapper" value { double_value: 64.25 } } test { name: "field_read_proto3_zero" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_double_wrapper: 0.0}.single_double_wrapper" value { double_value: 0.0 } } test { name: "field_read_proto3_unset" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{}.single_double_wrapper" value { null_value: NULL_VALUE } } @@ -751,44 +875,44 @@ section { } test { name: "field_assign_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_bool_wrapper: true}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_bool_wrapper { value: true } } } } } test { name: "field_assign_proto2_false" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_bool_wrapper: false}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_bool_wrapper { } } } } } test { name: "field_assign_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_bool_wrapper: true}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_bool_wrapper { value: true } } } } } test { name: "field_assign_proto3_false" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_bool_wrapper: false}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_bool_wrapper { } } } } @@ -838,44 +962,44 @@ section { } test { name: "field_assign_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_string_wrapper: 'baz'}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_string_wrapper { value: "baz" } } } } } test { name: "field_assign_proto2_empty" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_string_wrapper: ''}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_string_wrapper { } } } } } test { name: "field_assign_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_string_wrapper: 'bletch'}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_string_wrapper { value: "bletch" } } } } } test { name: "field_assign_proto3_empty" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_string_wrapper: ''}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_string_wrapper { } } } } @@ -925,44 +1049,44 @@ section { } test { name: "field_assign_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_bytes_wrapper: b'baz'}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_bytes_wrapper { value: "baz" } } } } } test { name: "field_assign_proto2_empty" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_bytes_wrapper: b''}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_bytes_wrapper { } } } } } test { name: "field_assign_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_bytes_wrapper: b'bletch'}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_bytes_wrapper { value: "bletch" } } } } } test { name: "field_assign_proto3_empty" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_bytes_wrapper: b''}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_bytes_wrapper { } } } } @@ -1029,11 +1153,11 @@ section { } test { name: "field_assign_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{list_value: [1.0, 'one']}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { list_value { values: { number_value: 1.0 } values: { string_value: "one" } @@ -1043,18 +1167,18 @@ section { } test { name: "field_assign_proto2_empty" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{list_value: []}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { list_value { } } } } } test { name: "field_read_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{list_value: [1.0, 'one']}.list_value" value { list_value { @@ -1065,24 +1189,24 @@ section { } test { name: "field_read_proto2_empty" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{list_value: []}.list_value" value { list_value { } } } test { name: "field_read_proto2_unset" description: "Not a wrapper type, so doesn't convert to null." - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{}.list_value" value { list_value { } } } test { name: "field_assign_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{list_value: [1.0, 'one']}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { list_value { values: { number_value: 1.0 } values: { string_value: "one" } @@ -1092,18 +1216,18 @@ section { } test { name: "field_assign_proto3_empty" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{list_value: []}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { list_value { } } } } } test { name: "field_read_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{list_value: [1.0, 'one']}.list_value" value { list_value { @@ -1114,14 +1238,14 @@ section { } test { name: "field_read_proto3_empty" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{list_value: []}.list_value" value { list_value { } } } test { name: "field_read_proto3_unset" description: "Not a wrapper type, so doesn't convert to null." - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{}.list_value" value { list_value { } } } @@ -1196,11 +1320,11 @@ section { } test { name: "field_assign_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_struct: {'un': 1.0, 'deux': 2.0}}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_struct { fields { key: "un" @@ -1216,18 +1340,18 @@ section { } test { name: "field_assign_proto2_empty" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_struct: {}}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_struct { } } } } } test { name: "field_assign_proto2_bad" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_struct: {1: 'uno'}}" disable_check: true eval_error { @@ -1236,7 +1360,7 @@ section { } test { name: "field_read_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_struct: {'one': 1.0}}.single_struct" value { map_value { @@ -1249,24 +1373,24 @@ section { } test { name: "field_read_proto2_empty" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_struct: {}}.single_struct" value { map_value { } } } test { name: "field_read_proto2_unset" description: "Not a wrapper type, so doesn't convert to null." - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{}.single_struct" value { map_value { } } } test { name: "field_assign_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_struct: {'un': 1.0, 'deux': 2.0}}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_struct { fields { key: "un" @@ -1282,18 +1406,18 @@ section { } test { name: "field_assign_proto3_empty" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_struct: {}}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_struct { } } } } } test { name: "field_assign_proto3_bad" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_struct: {1: 'uno'}}" disable_check: true eval_error { @@ -1302,7 +1426,7 @@ section { } test { name: "field_read_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_struct: {'one': 1.0}}.single_struct" value { map_value { @@ -1315,14 +1439,14 @@ section { } test { name: "field_read_proto3_empty" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_struct: {}}.single_struct" value { map_value { } } } test { name: "field_read_proto3_unset" description: "Not a wrapper type, so doesn't convert to null." - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{}.single_struct" value { map_value { } } } @@ -1368,47 +1492,47 @@ section { } test { name: "field_assign_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_value: null}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_value { null_value: NULL_VALUE } } } } } test { name: "field_read_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_value: null}.single_value" value { null_value: NULL_VALUE } } test { name: "field_read_proto2_unset" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{}.single_value" value { null_value: NULL_VALUE } } test { name: "field_assign_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_value: null}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_value { null_value: NULL_VALUE } } } } } test { name: "field_read_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_value: null}.single_value" value { null_value: NULL_VALUE } } test { name: "field_read_proto3_unset" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{}.single_value" value { null_value: NULL_VALUE } } @@ -1452,69 +1576,69 @@ section { } test { name: "field_assign_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_value: 7e23}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_value { number_value: 7e23 } } } } } test { name: "field_assign_proto2_zero" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_value: 0.0}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_value { number_value: 0.0 } } } } } test { name: "field_read_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_value: 7e23}.single_value" value { double_value: 7e23 } } test { name: "field_read_proto2_zero" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_value: 0.0}.single_value" value { double_value: 0.0 } } test { name: "field_assign_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_value: 7e23}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_value { number_value: 7e23 } } } } } test { name: "field_assign_proto3_zero" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_value: 0.0}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_value { number_value: 0.0 } } } } } test { name: "field_read_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_value: 7e23}.single_value" value { double_value: 7e23 } } test { name: "field_read_proto3_zero" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_value: 0.0}.single_value" value { double_value: 0.0 } } @@ -1558,69 +1682,69 @@ section { } test { name: "field_assign_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_value: 'baz'}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_value { string_value: "baz" } } } } } test { name: "field_assign_proto2_empty" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_value: ''}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_value { string_value: "" } } } } } test { name: "field_read_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_value: 'bletch'}.single_value" value { string_value: "bletch" } } test { name: "field_read_proto2_zero" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_value: ''}.single_value" value { string_value: "" } } test { name: "field_assign_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_value: 'baz'}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_value { string_value: "baz" } } } } } test { name: "field_assign_proto3_empty" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_value: ''}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_value { string_value: "" } } } } } test { name: "field_read_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_value: 'bletch'}.single_value" value { string_value: "bletch" } } test { name: "field_read_proto3_zero" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_value: ''}.single_value" value { string_value: "" } } @@ -1664,69 +1788,69 @@ section { } test { name: "field_assign_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_value: true}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_value { bool_value: true } } } } } test { name: "field_assign_proto2_false" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_value: false}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_value { bool_value: false } } } } } test { name: "field_read_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_value: true}.single_value" value { bool_value: true } } test { name: "field_read_proto2_false" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_value: false}.single_value" value { bool_value: false } } test { name: "field_assign_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_value: true}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_value { bool_value: true } } } } } test { name: "field_assign_proto3_false" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_value: false}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_value { bool_value: false } } } } } test { name: "field_read_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_value: true}.single_value" value { bool_value: true } } test { name: "field_read_proto3_false" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_value: false}.single_value" value { bool_value: false } } @@ -1801,11 +1925,11 @@ section { } test { name: "field_assign_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_value: {'un': 1.0, 'deux': 2.0}}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_value { struct_value { fields { key: "un" @@ -1821,18 +1945,18 @@ section { } test { name: "field_assign_proto2_empty" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_value: {}}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_value { struct_value: { } } } } } } test { name: "field_read_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_value: {'i': true}}.single_value" value { map_value { @@ -1845,17 +1969,17 @@ section { } test { name: "field_read_proto2_empty" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_value: {}}.single_value" value { map_value: { } } } test { name: "field_assign_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_value: {'un': 1.0, 'deux': 2.0}}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_value { struct_value { fields { key: "un" @@ -1871,18 +1995,18 @@ section { } test { name: "field_assign_proto3_empty" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_value: {}}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_value { struct_value: { } } } } } } test { name: "field_read_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_value: {'i': true}}.single_value" value { map_value { @@ -1895,7 +2019,7 @@ section { } test { name: "field_read_proto3_empty" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_value: {}}.single_value" value { map_value: { } } } @@ -1954,11 +2078,11 @@ section { } test { name: "field_assign_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_value: ['un', 1.0]}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_value { list_value { values { string_value: "un" } values { number_value: 1.0 } @@ -1968,18 +2092,18 @@ section { } test { name: "field_assign_proto2_empty" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_value: []}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_value { list_value: { } } } } } } test { name: "field_read_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_value: ['i', true]}.single_value" value { list_value { @@ -1990,17 +2114,17 @@ section { } test { name: "field_read_proto2_empty" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_value: []}.single_value" value { list_value: { } } } test { name: "field_assign_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_value: ['un', 1.0]}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_value { list_value { values { string_value: "un" } values { number_value: 1.0 } @@ -2010,18 +2134,18 @@ section { } test { name: "field_assign_proto3_empty" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_value: []}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_value { list_value: { } } } } } } test { name: "field_read_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_value: ['i', true]}.single_value" value { list_value { @@ -2032,7 +2156,7 @@ section { } test { name: "field_read_proto3_empty" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_value: []}.single_value" value { list_value: { } } } @@ -2042,17 +2166,17 @@ section { description: "Tests for Any conversion." test { name: "literal" - expr: "google.protobuf.Any{type_url: 'type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes', value: b'\\x08\\x96\\x01'}" + expr: "google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\x08\\x96\\x01'}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_int32: 150 } } } } test { name: "literal_no_field_access" - expr: "google.protobuf.Any{type_url: 'type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes', value: b'\\x08\\x96\\x01'}.type_url" + expr: "google.protobuf.Any{type_url: 'type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes', value: b'\\x08\\x96\\x01'}.type_url" disable_check: true eval_error { errors { message: "no_matching_overload" } @@ -2070,35 +2194,35 @@ section { expr: "x" type_env { name: "x" - ident { type { message_type: "google.protubuf.Any" } } + ident { type { message_type: "google.protobuf.Any" } } } bindings { key: "x" value { value { object_value { [type.googleapis.com/google.protobuf.Any] { - type_url: "type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes" + type_url: "type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes" value: "\x08\x96\x01" } } } } } value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_int32: 150 } } } } test { name: "field_assign_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_any: TestAllTypes{single_int32: 150}}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_any { - type_url: "type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes" + type_url: "type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes" value: "\x08\x96\x01" } } @@ -2107,25 +2231,25 @@ section { } test { name: "field_read_proto2" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_any: TestAllTypes{single_int32: 150}}.single_any" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_int32: 150 } } } } test { name: "field_assign_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_any: TestAllTypes{single_int32: 150}}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_any { - type_url: "type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes" + type_url: "type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes" value: "\x08\x96\x01" } } @@ -2134,11 +2258,11 @@ section { } test { name: "field_read_proto3" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_any: TestAllTypes{single_int32: 150}}.single_any" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_int32: 150 } } } @@ -2149,7 +2273,7 @@ section { description: "Tests combining various dynamic conversions." test { name: "any_list_map" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_any: [{'almost': 'done'}]}.single_any" value { list_value { diff --git a/features/encoders_ext.feature b/features/encoders_ext.feature new file mode 100644 index 0000000..f7cfb54 --- /dev/null +++ b/features/encoders_ext.feature @@ -0,0 +1,37 @@ +@conformance +Feature: encoders_ext + Tests for the encoders extension library. + + +# encode -- + +@wip +Scenario: encode/hello + + When CEL expression "base64.encode(b'hello')" is evaluated + Then value is celpy.celtypes.StringType(source='aGVsbG8=') + + +# decode -- + +@wip +Scenario: decode/hello + + When CEL expression "base64.decode('aGVsbG8=')" is evaluated + Then value is celpy.celtypes.BytesType(source=b'hello') + +@wip +Scenario: decode/hello_without_padding + + When CEL expression "base64.decode('aGVsbG8')" is evaluated + Then value is celpy.celtypes.BytesType(source=b'hello') + + +# round_trip -- + +@wip +Scenario: round_trip/hello + + When CEL expression "base64.decode(base64.encode(b'Hello World!'))" is evaluated + Then value is celpy.celtypes.BytesType(source=b'Hello World!') + diff --git a/features/encoders_ext.textproto b/features/encoders_ext.textproto new file mode 100644 index 0000000..07cf11d --- /dev/null +++ b/features/encoders_ext.textproto @@ -0,0 +1,44 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: cel.expr.conformance.test.SimpleTestFile + +name: "encoders_ext" +description: "Tests for the encoders extension library." +section: { + name: "encode" + test: { + name: "hello" + expr: "base64.encode(b'hello')" + value: { + string_value: "aGVsbG8=" + } + } +} + +section: { + name: "decode" + test: { + name: "hello" + expr: "base64.decode('aGVsbG8=')" + value: { + bytes_value: "hello" + } + } + test: { + name: "hello_without_padding" + expr: "base64.decode('aGVsbG8')" + value: { + bytes_value: "hello" + } + } +} + +section: { + name: "round_trip" + test: { + name: "hello" + expr: "base64.decode(base64.encode(b'Hello World!'))" + value: { + bytes_value: "Hello World!" + } + } +} diff --git a/features/enums.feature b/features/enums.feature index 1df5da6..78a68f5 100644 --- a/features/enums.feature +++ b/features/enums.feature @@ -1,3 +1,415 @@ - +@conformance Feature: enums - Tests for strong enum types. + Tests for enum types. + + +# legacy_proto2 -- Legacy semantics where all enums are ints, proto2. + +@wip +Scenario: legacy_proto2/literal_global + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'GlobalEnum.GAZ' is evaluated + Then value is celpy.celtypes.IntType(source=2) + +@wip +Scenario: legacy_proto2/literal_nested + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes.NestedEnum.BAR' is evaluated + Then value is celpy.celtypes.IntType(source=1) + +@wip +Scenario: legacy_proto2/literal_zero + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'GlobalEnum.GOO' is evaluated + Then value is celpy.celtypes.IntType(source=0) + +@wip +Scenario: legacy_proto2/comparison + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'GlobalEnum.GAR == 1' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: legacy_proto2/arithmetic + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes.NestedEnum.BAR + 3' is evaluated + Then value is celpy.celtypes.IntType(source=4) + +@wip +Scenario: legacy_proto2/type_global + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'type(GlobalEnum.GOO)' is evaluated + Then value is celpy.celtypes.IntType + +@wip +Scenario: legacy_proto2/type_nested + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'type(TestAllTypes.NestedEnum.BAZ)' is evaluated + Then value is celpy.celtypes.IntType + +@wip +Scenario: legacy_proto2/select_default + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.standalone_enum' is evaluated + Then value is celpy.celtypes.IntType(source=0) + +@wip +Scenario: legacy_proto2/field_type + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'type(TestAllTypes{}.standalone_enum)' is evaluated + Then value is celpy.celtypes.IntType + +@wip +Scenario: legacy_proto2/assign_standalone_name + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.BAZ}' is evaluated + Then value is TestAllTypes(standalone_enum=2) + +Scenario: legacy_proto2/assign_standalone_int + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{standalone_enum: 1}' is evaluated + Then value is TestAllTypes(standalone_enum=1) + +@wip +Scenario: legacy_proto2/assign_standalone_int_too_big + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{standalone_enum: 5000000000}' is evaluated + Then eval_error is 'range' + +@wip +Scenario: legacy_proto2/assign_standalone_int_too_neg + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{standalone_enum: -7000000000}' is evaluated + Then eval_error is 'range' + +@wip +Scenario: legacy_proto2/access_repeated_enum + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.repeated_nested_enum' is evaluated + Then value is [] + +@wip +Scenario: legacy_proto2/assign_repeated_enum + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{ repeated_nested_enum: [ TestAllTypes.NestedEnum.FOO, TestAllTypes.NestedEnum.BAR]}' is evaluated + Then value is TestAllTypes(repeated_nested_enum=[0, 1]) + +@wip +Scenario: legacy_proto2/list_enum_as_list_int + + Given container is 'cel.expr.conformance.proto2' + When CEL expression '0 in TestAllTypes{ repeated_nested_enum: [ TestAllTypes.NestedEnum.FOO, TestAllTypes.NestedEnum.BAR]}.repeated_nested_enum' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: legacy_proto2/enum_as_int + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.FOO}.standalone_enum in [0]' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + + +# legacy_proto3 -- Legacy semantics where all enums are ints, proto3 + +@wip +Scenario: legacy_proto3/literal_global + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'GlobalEnum.GAZ' is evaluated + Then value is celpy.celtypes.IntType(source=2) + +@wip +Scenario: legacy_proto3/literal_nested + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes.NestedEnum.BAR' is evaluated + Then value is celpy.celtypes.IntType(source=1) + +@wip +Scenario: legacy_proto3/literal_zero + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'GlobalEnum.GOO' is evaluated + Then value is celpy.celtypes.IntType(source=0) + +@wip +Scenario: legacy_proto3/comparison + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'GlobalEnum.GAR == 1' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: legacy_proto3/arithmetic + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes.NestedEnum.BAR + 3' is evaluated + Then value is celpy.celtypes.IntType(source=4) + +@wip +Scenario: legacy_proto3/type_global + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'type(GlobalEnum.GOO)' is evaluated + Then value is celpy.celtypes.IntType + +@wip +Scenario: legacy_proto3/type_nested + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'type(TestAllTypes.NestedEnum.BAZ)' is evaluated + Then value is celpy.celtypes.IntType + +@wip +Scenario: legacy_proto3/select_default + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{}.standalone_enum' is evaluated + Then value is celpy.celtypes.IntType(source=0) + +Scenario: legacy_proto3/select + + Given type_env parameter "x" is celpy.celtypes.MessageType + and bindings parameter "x" is TestAllTypes(standalone_enum=2) + and container is 'cel.expr.conformance.proto3' + When CEL expression 'x.standalone_enum' is evaluated + Then value is celpy.celtypes.IntType(source=2) + +Scenario: legacy_proto3/select_big + + Given type_env parameter "x" is celpy.celtypes.MessageType + and bindings parameter "x" is TestAllTypes(standalone_enum=108) + and container is 'cel.expr.conformance.proto3' + When CEL expression 'x.standalone_enum' is evaluated + Then value is celpy.celtypes.IntType(source=108) + +Scenario: legacy_proto3/select_neg + + Given type_env parameter "x" is celpy.celtypes.MessageType + and bindings parameter "x" is TestAllTypes(standalone_enum=-3) + and container is 'cel.expr.conformance.proto3' + When CEL expression 'x.standalone_enum' is evaluated + Then value is celpy.celtypes.IntType(source=-3) + +@wip +Scenario: legacy_proto3/field_type + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'type(TestAllTypes{}.standalone_enum)' is evaluated + Then value is celpy.celtypes.IntType + +@wip +Scenario: legacy_proto3/assign_standalone_name + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.BAZ}' is evaluated + Then value is TestAllTypes(standalone_enum=2) + +Scenario: legacy_proto3/assign_standalone_int + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{standalone_enum: 1}' is evaluated + Then value is TestAllTypes(standalone_enum=1) + +Scenario: legacy_proto3/assign_standalone_int_big + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{standalone_enum: 99}' is evaluated + Then value is TestAllTypes(standalone_enum=99) + +Scenario: legacy_proto3/assign_standalone_int_neg + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{standalone_enum: -1}' is evaluated + Then value is TestAllTypes(standalone_enum=-1) + +@wip +Scenario: legacy_proto3/assign_standalone_int_too_big + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{standalone_enum: 5000000000}' is evaluated + Then eval_error is 'range' + +@wip +Scenario: legacy_proto3/assign_standalone_int_too_neg + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{standalone_enum: -7000000000}' is evaluated + Then eval_error is 'range' + +@wip +Scenario: legacy_proto3/access_repeated_enum + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.repeated_nested_enum' is evaluated + Then value is [] + +@wip +Scenario: legacy_proto3/assign_repeated_enum + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{ repeated_nested_enum: [ TestAllTypes.NestedEnum.FOO, TestAllTypes.NestedEnum.BAR]}' is evaluated + Then value is TestAllTypes(repeated_nested_enum=[0, 1]) + +@wip +Scenario: legacy_proto3/list_enum_as_list_int + + Given container is 'cel.expr.conformance.proto2' + When CEL expression '0 in TestAllTypes{ repeated_nested_enum: [ TestAllTypes.NestedEnum.FOO, TestAllTypes.NestedEnum.BAR]}.repeated_nested_enum' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: legacy_proto3/enum_as_int + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.FOO}.standalone_enum in [0]' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + + +# strong_proto2 -- String semantics where enums are distinct types, proto2. + +@wip +Scenario: strong_proto2/comparison_true + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'GlobalEnum.GAR == GlobalEnum.GAR' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: strong_proto2/comparison_false + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'GlobalEnum.GAR == GlobalEnum.GAZ' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: strong_proto2/assign_standalone_name + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.BAZ}' is evaluated + Then value is TestAllTypes(standalone_enum=2) + +@wip +Scenario: strong_proto2/assign_standalone_int + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{standalone_enum: TestAllTypes.NestedEnum(1)}' is evaluated + Then value is TestAllTypes(standalone_enum=1) + +@wip +Scenario: strong_proto2/convert_symbol_to_int + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'int(GlobalEnum.GAZ)' is evaluated + Then value is celpy.celtypes.IntType(source=2) + +Scenario: strong_proto2/convert_int_too_big + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes.NestedEnum(5000000000)' is evaluated + Then eval_error is 'range' + +Scenario: strong_proto2/convert_int_too_neg + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes.NestedEnum(-7000000000)' is evaluated + Then eval_error is 'range' + +Scenario: strong_proto2/convert_string_bad + + Given container is 'cel.expr.conformance.proto2' + When CEL expression "TestAllTypes.NestedEnum('BLETCH')" is evaluated + Then eval_error is 'invalid' + + +# strong_proto3 -- String semantics where enums are distinct types, proto3. + +@wip +Scenario: strong_proto3/comparison_true + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'GlobalEnum.GAR == GlobalEnum.GAR' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: strong_proto3/comparison_false + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'GlobalEnum.GAR == GlobalEnum.GAZ' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: strong_proto3/assign_standalone_name + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.BAZ}' is evaluated + Then value is TestAllTypes(standalone_enum=2) + +@wip +Scenario: strong_proto3/assign_standalone_int + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{standalone_enum: TestAllTypes.NestedEnum(1)}' is evaluated + Then value is TestAllTypes(standalone_enum=1) + +@wip +Scenario: strong_proto3/assign_standalone_int_big + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{standalone_enum: TestAllTypes.NestedEnum(99)}' is evaluated + Then value is TestAllTypes(standalone_enum=99) + +@wip +Scenario: strong_proto3/assign_standalone_int_neg + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{standalone_enum: TestAllTypes.NestedEnum(-1)}' is evaluated + Then value is TestAllTypes(standalone_enum=-1) + +@wip +Scenario: strong_proto3/convert_symbol_to_int + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'int(GlobalEnum.GAZ)' is evaluated + Then value is celpy.celtypes.IntType(source=2) + +Scenario: strong_proto3/convert_unnamed_to_int_select + + Given type_env parameter "x" is celpy.celtypes.MessageType + and bindings parameter "x" is TestAllTypes(standalone_enum=-987) + When CEL expression 'int(x.standalone_enum)' is evaluated + Then value is celpy.celtypes.IntType(source=-987) + +Scenario: strong_proto3/convert_int_too_big + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes.NestedEnum(5000000000)' is evaluated + Then eval_error is 'range' + +Scenario: strong_proto3/convert_int_too_neg + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes.NestedEnum(-7000000000)' is evaluated + Then eval_error is 'range' + +Scenario: strong_proto3/convert_string_bad + + Given container is 'cel.expr.conformance.proto3' + When CEL expression "TestAllTypes.NestedEnum('BLETCH')" is evaluated + Then eval_error is 'invalid' + diff --git a/features/enums.textproto b/features/enums.textproto index a3d84b5..558e929 100644 --- a/features/enums.textproto +++ b/features/enums.textproto @@ -1,2 +1,933 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: cel.expr.conformance.test.SimpleTestFile + name: "enums" -description: "Tests for strong enum types." +description: "Tests for enum types." +section { + name: "legacy_proto2" + description: "Legacy semantics where all enums are ints, proto2." + test { + name: "literal_global" + container: "cel.expr.conformance.proto2" + expr: "GlobalEnum.GAZ" + value { int64_value: 2 } + } + test { + name: "literal_nested" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes.NestedEnum.BAR" + value { int64_value: 1 } + } + test { + name: "literal_zero" + container: "cel.expr.conformance.proto2" + expr: "GlobalEnum.GOO" + value { int64_value: 0 } + } + test { + name: "comparison" + container: "cel.expr.conformance.proto2" + expr: "GlobalEnum.GAR == 1" + value { bool_value: true } + } + test { + name: "arithmetic" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes.NestedEnum.BAR + 3" + value { int64_value: 4 } + } + test { + name: "type_global" + container: "cel.expr.conformance.proto2" + expr: "type(GlobalEnum.GOO)" + value { type_value: "int" } + } + test { + name: "type_nested" + container: "cel.expr.conformance.proto2" + expr: "type(TestAllTypes.NestedEnum.BAZ)" + value { type_value: "int" } + } + test { + name: "select_default" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{}.standalone_enum" + value { int64_value: 0 } + } + test { + name: "field_type" + container: "cel.expr.conformance.proto2" + expr: "type(TestAllTypes{}.standalone_enum)" + value { type_value: "int" } + } + test { + name: "assign_standalone_name" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.BAZ}" + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { + standalone_enum: BAZ + } + } + } + } + test { + name: "assign_standalone_int" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{standalone_enum: 1}" + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { + standalone_enum: BAR + } + } + } + } + test { + name: "assign_standalone_int_too_big" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{standalone_enum: 5000000000}" + eval_error { + errors { + message: "range" + } + } + } + test { + name: "assign_standalone_int_too_neg" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{standalone_enum: -7000000000}" + eval_error { + errors { + message: "range" + } + } + } + test { + name: "access_repeated_enum" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{}.repeated_nested_enum" + value { + list_value {} + } + } + test { + name: "assign_repeated_enum" + container: "cel.expr.conformance.proto2" + expr: + "TestAllTypes{" + " repeated_nested_enum: [" + " TestAllTypes.NestedEnum.FOO," + " TestAllTypes.NestedEnum.BAR]}" + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { + repeated_nested_enum: FOO + repeated_nested_enum: BAR + } + } + } + } + test { + name: "list_enum_as_list_int" + container: "cel.expr.conformance.proto2" + expr: + "0 in " + "TestAllTypes{" + " repeated_nested_enum: [" + " TestAllTypes.NestedEnum.FOO," + " TestAllTypes.NestedEnum.BAR]}" + ".repeated_nested_enum" + value: { bool_value: true } + } + test { + name: "enum_as_int" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.FOO}.standalone_enum in [0]" + value: { bool_value: true } + } +} +section { + name: "legacy_proto3" + description: "Legacy semantics where all enums are ints, proto3" + test { + name: "literal_global" + container: "cel.expr.conformance.proto3" + expr: "GlobalEnum.GAZ" + value { int64_value: 2 } + } + test { + name: "literal_nested" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes.NestedEnum.BAR" + value { int64_value: 1 } + } + test { + name: "literal_zero" + container: "cel.expr.conformance.proto3" + expr: "GlobalEnum.GOO" + value { int64_value: 0 } + } + test { + name: "comparison" + container: "cel.expr.conformance.proto3" + expr: "GlobalEnum.GAR == 1" + value { bool_value: true } + } + test { + name: "arithmetic" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes.NestedEnum.BAR + 3" + value { int64_value: 4 } + } + test { + name: "type_global" + container: "cel.expr.conformance.proto3" + expr: "type(GlobalEnum.GOO)" + value { type_value: "int" } + } + test { + name: "type_nested" + container: "cel.expr.conformance.proto3" + expr: "type(TestAllTypes.NestedEnum.BAZ)" + value { type_value: "int" } + } + test { + name: "select_default" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{}.standalone_enum" + value { int64_value: 0 } + } + test { + name: "select" + container: "cel.expr.conformance.proto3" + expr: "x.standalone_enum" + type_env { + name: "x" + ident { + type { message_type: "cel.expr.conformance.proto3.TestAllTypes" } + } + } + bindings { + key: "x" + value { + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + standalone_enum: 2 + } + } + } + } + } + value { int64_value: 2 } + } + test { + name: "select_big" + container: "cel.expr.conformance.proto3" + expr: "x.standalone_enum" + type_env { + name: "x" + ident { + type { message_type: "cel.expr.conformance.proto3.TestAllTypes" } + } + } + bindings { + key: "x" + value { + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + standalone_enum: 108 + } + } + } + } + } + value { int64_value: 108 } + } + test { + name: "select_neg" + container: "cel.expr.conformance.proto3" + expr: "x.standalone_enum" + type_env { + name: "x" + ident { + type { message_type: "cel.expr.conformance.proto3.TestAllTypes" } + } + } + bindings { + key: "x" + value { + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + standalone_enum: -3 + } + } + } + } + } + value { int64_value: -3 } + } + test { + name: "field_type" + container: "cel.expr.conformance.proto3" + expr: "type(TestAllTypes{}.standalone_enum)" + value { type_value: "int" } + } + test { + name: "assign_standalone_name" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.BAZ}" + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + standalone_enum: BAZ + } + } + } + } + test { + name: "assign_standalone_int" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{standalone_enum: 1}" + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + standalone_enum: BAR + } + } + } + } + test { + name: "assign_standalone_int_big" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{standalone_enum: 99}" + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + standalone_enum: 99 + } + } + } + } + test { + name: "assign_standalone_int_neg" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{standalone_enum: -1}" + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + standalone_enum: -1 + } + } + } + } + test { + name: "assign_standalone_int_too_big" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{standalone_enum: 5000000000}" + eval_error { + errors { + message: "range" + } + } + } + test { + name: "assign_standalone_int_too_neg" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{standalone_enum: -7000000000}" + eval_error { + errors { + message: "range" + } + } + } + test { + name: "access_repeated_enum" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{}.repeated_nested_enum" + value { + list_value {} + } + } + test { + name: "assign_repeated_enum" + container: "cel.expr.conformance.proto2" + expr: + "TestAllTypes{" + " repeated_nested_enum: [" + " TestAllTypes.NestedEnum.FOO," + " TestAllTypes.NestedEnum.BAR]}" + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { + repeated_nested_enum: FOO + repeated_nested_enum: BAR + } + } + } + } + test { + name: "list_enum_as_list_int" + container: "cel.expr.conformance.proto2" + expr: + "0 in " + "TestAllTypes{" + " repeated_nested_enum: [" + " TestAllTypes.NestedEnum.FOO," + " TestAllTypes.NestedEnum.BAR]}" + ".repeated_nested_enum" + value: { bool_value: true } + } + test { + name: "enum_as_int" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.FOO}.standalone_enum in [0]" + value: { bool_value: true } + } +} +section { + name: "strong_proto2" + description: "String semantics where enums are distinct types, proto2." + test { + name: "literal_global" + container: "cel.expr.conformance.proto2" + expr: "GlobalEnum.GAZ" + value { + enum_value { + type: "cel.expr.conformance.proto2.GlobalEnum" + value: 2 + } + } + } + test { + name: "literal_nested" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes.NestedEnum.BAR" + value { + enum_value { + type: "cel.expr.conformance.proto2.TestAllTypes.NestedEnum" + value: 1 + } + } + } + test { + name: "literal_zero" + container: "cel.expr.conformance.proto2" + expr: "GlobalEnum.GOO" + value { + enum_value { + type: "cel.expr.conformance.proto2.GlobalEnum" + value: 0 + } + } + } + test { + name: "comparison_true" + container: "cel.expr.conformance.proto2" + expr: "GlobalEnum.GAR == GlobalEnum.GAR" + value { bool_value: true } + } + test { + name: "comparison_false" + container: "cel.expr.conformance.proto2" + expr: "GlobalEnum.GAR == GlobalEnum.GAZ" + value { bool_value: false } + } + test { + name: "type_global" + container: "cel.expr.conformance.proto2" + expr: "type(GlobalEnum.GOO)" + value { type_value: "cel.expr.conformance.proto2.GlobalEnum" } + } + test { + name: "type_nested" + container: "cel.expr.conformance.proto2" + expr: "type(TestAllTypes.NestedEnum.BAZ)" + value { + type_value: "cel.expr.conformance.proto2.TestAllTypes.NestedEnum" + } + } + test { + name: "select_default" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{}.standalone_enum" + value { + enum_value { + type: "cel.expr.conformance.proto2.TestAllTypes.NestedEnum" + value: 0 + } + } + } + test { + name: "field_type" + container: "cel.expr.conformance.proto2" + expr: "type(TestAllTypes{}.standalone_enum)" + value { + type_value: "cel.expr.conformance.proto2.TestAllTypes.NestedEnum" + } + } + test { + name: "assign_standalone_name" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.BAZ}" + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { + standalone_enum: BAZ + } + } + } + } + test { + name: "assign_standalone_int" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{standalone_enum: TestAllTypes.NestedEnum(1)}" + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { + standalone_enum: BAR + } + } + } + } + test { + name: "convert_symbol_to_int" + container: "cel.expr.conformance.proto2" + expr: "int(GlobalEnum.GAZ)" + value { int64_value: 2 } + } + test { + name: "convert_unnamed_to_int" + description: "Disable check - missing way to declare enums." + expr: "int(x)" + disable_check: true + bindings { + key: "x" + value { + value { + enum_value { + type: "cel.expr.conformance.proto2.GlobalEnum" + value: 444 + } + } + } + } + value { int64_value: 444 } + } + test { + name: "convert_int_inrange" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes.NestedEnum(2)" + value { + enum_value { + type: "cel.expr.conformance.proto2.TestAllTypes.NestedEnum" + value: 2 + } + } + } + test { + name: "convert_int_big" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes.NestedEnum(20000)" + value { + enum_value { + type: "cel.expr.conformance.proto2.TestAllTypes.NestedEnum" + value: 20000 + } + } + } + test { + name: "convert_int_neg" + container: "cel.expr.conformance.proto2" + expr: "GlobalEnum(-33)" + value { + enum_value { + type: "cel.expr.conformance.proto2.GlobalEnum" + value: -33 + } + } + } + test { + name: "convert_int_too_big" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes.NestedEnum(5000000000)" + eval_error { + errors { + message: "range" + } + } + } + test { + name: "convert_int_too_neg" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes.NestedEnum(-7000000000)" + eval_error { + errors { + message: "range" + } + } + } + test { + name: "convert_string" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes.NestedEnum('BAZ')" + value { + enum_value { + type: "cel.expr.conformance.proto2.TestAllTypes.NestedEnum" + value: 2 + } + } + } + test { + name: "convert_string_bad" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes.NestedEnum('BLETCH')" + eval_error { + errors { + message: "invalid" + } + } + } +} +section { + name: "strong_proto3" + description: "String semantics where enums are distinct types, proto3." + test { + name: "literal_global" + container: "cel.expr.conformance.proto3" + expr: "GlobalEnum.GAZ" + value { + enum_value { + type: "cel.expr.conformance.proto3.GlobalEnum" + value: 2 + } + } + } + test { + name: "literal_nested" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes.NestedEnum.BAR" + value { + enum_value { + type: "cel.expr.conformance.proto3.TestAllTypes.NestedEnum" + value: 1 + } + } + } + test { + name: "literal_zero" + container: "cel.expr.conformance.proto3" + expr: "GlobalEnum.GOO" + value { + enum_value { + type: "cel.expr.conformance.proto3.GlobalEnum" + value: 0 + } + } + } + test { + name: "comparison_true" + container: "cel.expr.conformance.proto3" + expr: "GlobalEnum.GAR == GlobalEnum.GAR" + value { bool_value: true } + } + test { + name: "comparison_false" + container: "cel.expr.conformance.proto3" + expr: "GlobalEnum.GAR == GlobalEnum.GAZ" + value { bool_value: false } + } + test { + name: "type_global" + container: "cel.expr.conformance.proto3" + expr: "type(GlobalEnum.GOO)" + value { type_value: "cel.expr.conformance.proto3.GlobalEnum" } + } + test { + name: "type_nested" + container: "cel.expr.conformance.proto3" + expr: "type(TestAllTypes.NestedEnum.BAZ)" + value { + type_value: "cel.expr.conformance.proto3.TestAllTypes.NestedEnum" + } + } + test { + name: "select_default" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{}.standalone_enum" + value { + enum_value { + type: "cel.expr.conformance.proto3.TestAllTypes.NestedEnum" + value: 0 + } + } + } + test { + name: "select" + container: "cel.expr.conformance.proto3" + expr: "x.standalone_enum" + type_env { + name: "x" + ident { + type { message_type: "cel.expr.conformance.proto3.TestAllTypes" } + } + } + bindings { + key: "x" + value { + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + standalone_enum: 2 + } + } + } + } + } + value { + enum_value { + type: "cel.expr.conformance.proto3.TestAllTypes.NestedEnum" + value: 2 + } + } + } + test { + name: "select_big" + container: "cel.expr.conformance.proto3" + expr: "x.standalone_enum" + type_env { + name: "x" + ident { + type { message_type: "cel.expr.conformance.proto3.TestAllTypes" } + } + } + bindings { + key: "x" + value { + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + standalone_enum: 108 + } + } + } + } + } + value { + enum_value { + type: "cel.expr.conformance.proto3.TestAllTypes.NestedEnum" + value: 108 + } + } + } + test { + name: "select_neg" + container: "cel.expr.conformance.proto3" + expr: "x.standalone_enum" + type_env { + name: "x" + ident { + type { message_type: "cel.expr.conformance.proto3.TestAllTypes" } + } + } + bindings { + key: "x" + value { + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + standalone_enum: -3 + } + } + } + } + } + value { + enum_value { + type: "cel.expr.conformance.proto3.TestAllTypes.NestedEnum" + value: -3 + } + } + } + test { + name: "field_type" + container: "cel.expr.conformance.proto3" + expr: "type(TestAllTypes{}.standalone_enum)" + value { + type_value: "cel.expr.conformance.proto3.TestAllTypes.NestedEnum" + } + } + test { + name: "assign_standalone_name" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.BAZ}" + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + standalone_enum: BAZ + } + } + } + } + test { + name: "assign_standalone_int" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{standalone_enum: TestAllTypes.NestedEnum(1)}" + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + standalone_enum: BAR + } + } + } + } + test { + name: "assign_standalone_int_big" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{standalone_enum: TestAllTypes.NestedEnum(99)}" + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + standalone_enum: 99 + } + } + } + } + test { + name: "assign_standalone_int_neg" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{standalone_enum: TestAllTypes.NestedEnum(-1)}" + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + standalone_enum: -1 + } + } + } + } + test { + name: "convert_symbol_to_int" + container: "cel.expr.conformance.proto3" + expr: "int(GlobalEnum.GAZ)" + value { int64_value: 2 } + } + test { + name: "convert_unnamed_to_int" + description: "Disable check - missing way to declare enums." + expr: "int(x)" + disable_check: true + bindings { + key: "x" + value { + value { + enum_value { + type: "cel.expr.conformance.proto3.GlobalEnum" + value: 444 + } + } + } + } + value { int64_value: 444 } + } + test { + name: "convert_unnamed_to_int_select" + expr: "int(x.standalone_enum)" + type_env { + name: "x" + ident { + type { message_type: "cel.expr.conformance.proto3.TestAllTypes" } + } + } + bindings { + key: "x" + value { + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + standalone_enum: -987 + } + } + } + } + } + value { int64_value: -987 } + } + test { + name: "convert_int_inrange" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes.NestedEnum(2)" + value { + enum_value { + type: "cel.expr.conformance.proto3.TestAllTypes.NestedEnum" + value: 2 + } + } + } + test { + name: "convert_int_big" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes.NestedEnum(20000)" + value { + enum_value { + type: "cel.expr.conformance.proto3.TestAllTypes.NestedEnum" + value: 20000 + } + } + } + test { + name: "convert_int_neg" + container: "cel.expr.conformance.proto3" + expr: "GlobalEnum(-33)" + value { + enum_value { + type: "cel.expr.conformance.proto3.GlobalEnum" + value: -33 + } + } + } + test { + name: "convert_int_too_big" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes.NestedEnum(5000000000)" + eval_error { + errors { + message: "range" + } + } + } + test { + name: "convert_int_too_neg" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes.NestedEnum(-7000000000)" + eval_error { + errors { + message: "range" + } + } + } + test { + name: "convert_string" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes.NestedEnum('BAZ')" + value { + enum_value { + type: "cel.expr.conformance.proto3.TestAllTypes.NestedEnum" + value: 2 + } + } + } + test { + name: "convert_string_bad" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes.NestedEnum('BLETCH')" + eval_error { + errors { + message: "invalid" + } + } + } +} diff --git a/features/fields.feature b/features/fields.feature index 2d47f9b..9338119 100644 --- a/features/fields.feature +++ b/features/fields.feature @@ -1,321 +1,371 @@ - +@conformance Feature: fields Tests for field access in maps. -# map_fields -- select an element in a map -Scenario: map_key_int64 +# map_fields -- select an element in a map - When CEL expression "{0:1,2:2,5:true}[5]" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: map_fields/map_key_int64 + When CEL expression '{0:1,2:2,5:true}[5]' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: map_key_uint64 +Scenario: map_fields/map_key_uint64 When CEL expression "{0u:1u,2u:'happy',5u:3u}[2u]" is evaluated - # string_value:"happy" - Then value is StringType(source='happy') - + Then value is celpy.celtypes.StringType(source='happy') -Scenario: map_key_string +Scenario: map_fields/map_key_string When CEL expression "{'name':100u}['name']" is evaluated - # uint64_value:100 - Then value is UintType(source=100) + Then value is celpy.celtypes.UintType(source=100) +Scenario: map_fields/map_key_bool -Scenario: map_key_bool + When CEL expression '{true:5}[true]' is evaluated + Then value is celpy.celtypes.IntType(source=5) - When CEL expression "{true:5}[true]" is evaluated - # int64_value:5 - Then value is IntType(source=5) +Scenario: map_fields/map_key_mixed_type + When CEL expression '{true:1,2:2,5u:3}[true]' is evaluated + Then value is celpy.celtypes.IntType(source=1) -Scenario: map_key_mix_type +@wip +Scenario: map_fields/map_key_mixed_numbers_double_key - When CEL expression "{true:1,2:2,5u:3}[true]" is evaluated - # int64_value:1 - Then value is IntType(source=1) + When CEL expression '{1u: 1.0, 2: 2.0, 3u: 3.0}[3.0]' is evaluated + Then value is celpy.celtypes.DoubleType(source=3.0) + +Scenario: map_fields/map_key_mixed_numbers_lossy_double_key + + When CEL expression '{1u: 1.0, 2: 2.0, 3u: 3.0}[3.1]' is evaluated + Then eval_error is 'no such key' +@wip +Scenario: map_fields/map_key_mixed_numbers_uint_key -Scenario: map_field_access + When CEL expression '{1u: 1.0, 2: 2.0, 3u: 3.0}[2u]' is evaluated + Then value is celpy.celtypes.DoubleType(source=2.0) - # type:{map_type:{key_type:{primitive:STRING} value_type:{primitive:INT64}}} - # Given type_env parameter "x" is TypeType(value='map_type') - Given type_env parameter "x" is map_type +@wip +Scenario: map_fields/map_key_mixed_numbers_int_key - # map_value:{entries:{key:{string_value:"name"} value:{int64_value:1024}}} - Given bindings parameter "x" is MapType({StringType(source='name'): IntType(source=1024)}) + When CEL expression '{1u: 1.0, 2: 2.0, 3u: 3.0}[1]' is evaluated + Then value is celpy.celtypes.DoubleType(source=1.0) - When CEL expression "x.name" is evaluated - # int64_value:1024 - Then value is IntType(source=1024) +Scenario: map_fields/map_field_access + Given type_env parameter "x" is celpy.celtypes.MapType + and bindings parameter "x" is celpy.celtypes.MapType({'name': celpy.celtypes.IntType(source=1024)}) + When CEL expression 'x.name' is evaluated + Then value is celpy.celtypes.IntType(source=1024) -Scenario: map_no_such_key +Scenario: map_fields/map_no_such_key - When CEL expression "{0:1,2:2,5:3}[1]" is evaluated - # errors:{message:"no such key"} + When CEL expression '{0:1,2:2,5:3}[1]' is evaluated Then eval_error is 'no such key' +Scenario: map_fields/map_no_such_key_or_false -Scenario: map_field_select_no_such_key + When CEL expression 'dyn({0:1,2:2,5:3}[1]) || false' is evaluated + Then eval_error is 'no such key' - # type:{map_type:{key_type:{primitive:STRING} value_type:{primitive:STRING}}} - # Given type_env parameter "x" is TypeType(value='map_type') - Given type_env parameter "x" is map_type +Scenario: map_fields/map_no_such_key_or_true - # map_value:{entries:{key:{string_value:"holiday"} value:{string_value:"field"}}} - Given bindings parameter "x" is MapType({StringType(source='holiday'): StringType(source='field')}) + When CEL expression 'dyn({0:1,2:2,5:3}[1]) || true' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "x.name" is evaluated - # errors:{message:"no such key: 'name'"} - Then eval_error is "no such key: 'name'" +Scenario: map_fields/map_no_such_key_and_false + When CEL expression 'dyn({0:1,2:2,5:3}[1]) && false' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: map_value_null +Scenario: map_fields/map_no_such_key_and_true - When CEL expression "{true:null}[true]" is evaluated - # null_value:NULL_VALUE - Then value is None + When CEL expression 'dyn({0:1,2:2,5:3}[1]) && true' is evaluated + Then eval_error is 'no such key' +Scenario: map_fields/map_bad_key_type -Scenario: map_value_bool + When CEL expression "{0:1,2:2,5:3}[dyn(b'')]" is evaluated + Then eval_error is 'no such key' - When CEL expression "{27:false}[27]" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: map_fields/map_bad_key_type_or_false + When CEL expression "dyn({0:1,2:2,5:3}[dyn(b'')]) || false" is evaluated + Then eval_error is 'no such key' -Scenario: map_value_string +Scenario: map_fields/map_bad_key_type_or_true - When CEL expression "{'n':'x'}['n']" is evaluated - # string_value:"x" - Then value is StringType(source='x') + When CEL expression "dyn({0:1,2:2,5:3}[dyn(b'')]) || true" is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: map_fields/map_bad_key_type_and_false -Scenario: map_value_float + When CEL expression "dyn({0:1,2:2,5:3}[dyn(b'')]) && false" is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "{3:15.15}[3]" is evaluated - # double_value:15.15 - Then value is DoubleType(source=15.15) +Scenario: map_fields/map_bad_key_type_and_true + When CEL expression "dyn({0:1,2:2,5:3}[dyn(b'')]) && true" is evaluated + Then eval_error is 'no such key' -Scenario: map_value_uint64 +Scenario: map_fields/map_field_select_no_such_key - When CEL expression "{0u:1u,2u:2u,5u:3u}[0u]" is evaluated - # uint64_value:1 - Then value is UintType(source=1) + Given type_env parameter "x" is celpy.celtypes.MapType + and bindings parameter "x" is celpy.celtypes.MapType({'holiday': celpy.celtypes.StringType(source='field')}) + When CEL expression 'x.name' is evaluated + Then eval_error is "no such key: 'name'" +Scenario: map_fields/map_field_select_no_such_key_or_false -Scenario: map_value_int64 + Given type_env parameter "x" is celpy.celtypes.MapType + and bindings parameter "x" is celpy.celtypes.MapType({'holiday': celpy.celtypes.StringType(source='field')}) + When CEL expression 'dyn(x.name) || false' is evaluated + Then eval_error is "no such key: 'name'" - When CEL expression "{true:1,false:2}[true]" is evaluated - # int64_value:1 - Then value is IntType(source=1) +Scenario: map_fields/map_field_select_no_such_key_or_true + Given type_env parameter "x" is celpy.celtypes.MapType + and bindings parameter "x" is celpy.celtypes.MapType({'holiday': celpy.celtypes.StringType(source='field')}) + When CEL expression 'dyn(x.name) || true' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: map_value_bytes +Scenario: map_fields/map_field_select_no_such_key_and_false - When CEL expression '{0:b""}[0]' is evaluated - # bytes_value:"" - Then value is BytesType(source=b'') + Given type_env parameter "x" is celpy.celtypes.MapType + and bindings parameter "x" is celpy.celtypes.MapType({'holiday': celpy.celtypes.StringType(source='field')}) + When CEL expression 'dyn(x.name) && false' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: map_fields/map_field_select_no_such_key_and_true -Scenario: map_value_list + Given type_env parameter "x" is celpy.celtypes.MapType + and bindings parameter "x" is celpy.celtypes.MapType({'holiday': celpy.celtypes.StringType(source='field')}) + When CEL expression 'dyn(x.name) && true' is evaluated + Then eval_error is "no such key: 'name'" - When CEL expression "{0u:[1]}[0u]" is evaluated - # list_value:{values:{int64_value:1}} - Then value is [IntType(source=1)] +Scenario: map_fields/map_value_null + When CEL expression '{true:null}[true]' is evaluated + Then value is None -Scenario: map_value_map +Scenario: map_fields/map_value_bool - When CEL expression '{"map": {"k": "v"}}["map"]' is evaluated - # map_value:{entries:{key:{string_value:"k"} value:{string_value:"v"}}} - Then value is MapType({StringType(source='k'): StringType(source='v')}) + When CEL expression '{27:false}[27]' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: map_fields/map_value_string -Scenario: map_value_mix_type + When CEL expression "{'n':'x'}['n']" is evaluated + Then value is celpy.celtypes.StringType(source='x') - When CEL expression '{"map": {"k": "v"}, "list": [1]}["map"]' is evaluated - # map_value:{entries:{key:{string_value:"k"} value:{string_value:"v"}}} - Then value is MapType({StringType(source='k'): StringType(source='v')}) +Scenario: map_fields/map_value_float + When CEL expression '{3:15.15}[3]' is evaluated + Then value is celpy.celtypes.DoubleType(source=15.15) +Scenario: map_fields/map_value_uint64 -# map_has -- Has macro for map entries. + When CEL expression '{0u:1u,2u:2u,5u:3u}[0u]' is evaluated + Then value is celpy.celtypes.UintType(source=1) -Scenario: has +Scenario: map_fields/map_value_int64 - When CEL expression "has({'a': 1, 'b': 2}.a)" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression '{true:1,false:2}[true]' is evaluated + Then value is celpy.celtypes.IntType(source=1) +Scenario: map_fields/map_value_bytes -Scenario: has_not + When CEL expression "{0:b''}[0]" is evaluated + Then value is celpy.celtypes.BytesType(source=b'') - When CEL expression "has({'a': 1, 'b': 2}.c)" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: map_fields/map_value_list + When CEL expression '{0u:[1]}[0u]' is evaluated + Then value is [celpy.celtypes.IntType(source=1)] -Scenario: has_empty +Scenario: map_fields/map_value_map - When CEL expression "has({}.a)" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression "{'map': {'k': 'v'}}['map']" is evaluated + Then value is celpy.celtypes.MapType({'k': celpy.celtypes.StringType(source='v')}) +Scenario: map_fields/map_value_mix_type + When CEL expression "{'map': {'k': 'v'}, 'list': [1]}['map']" is evaluated + Then value is celpy.celtypes.MapType({'k': celpy.celtypes.StringType(source='v')}) -# qualified_identifier_resolution -- Tests for qualified identifier resolution. -Scenario: qualified_ident +# map_has -- Has macro for map entries. - # type:{primitive:STRING} - # Given type_env parameter "a.b.c" is TypeType(value='STRING') - Given type_env parameter "a.b.c" is STRING +Scenario: map_has/has - # string_value:"yeah" - Given bindings parameter "a.b.c" is StringType(source='yeah') + When CEL expression "has({'a': 1, 'b': 2}.a)" is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "a.b.c" is evaluated - # string_value:"yeah" - Then value is StringType(source='yeah') +Scenario: map_has/has_not + When CEL expression "has({'a': 1, 'b': 2}.c)" is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: map_field_select +Scenario: map_has/has_empty - # type:{map_type:{key_type:{primitive:STRING} value_type:{primitive:STRING}}} - # Given type_env parameter "a.b" is TypeType(value='map_type') - Given type_env parameter "a.b" is map_type + When CEL expression 'has({}.a)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - # map_value:{entries:{key:{string_value:"c"} value:{string_value:"yeah"}}} - Given bindings parameter "a.b" is MapType({StringType(source='c'): StringType(source='yeah')}) - When CEL expression "a.b.c" is evaluated - # string_value:"yeah" - Then value is StringType(source='yeah') +# quoted_map_fields -- Field accesses using the quote syntax +@wip +Scenario: quoted_map_fields/field_access_slash -Scenario: qualified_identifier_resolution_unchecked - namespace resolution should try to find the longest prefix for the evaluator. - # type:{primitive:STRING} - # Given type_env parameter "a.b.c" is TypeType(value='STRING') - Given type_env parameter "a.b.c" is STRING + When CEL expression "{'/api/v1': true, '/api/v2': false}.`/api/v1`" is evaluated + Then value is celpy.celtypes.BoolType(source=True) - # type:{map_type:{key_type:{primitive:STRING} value_type:{primitive:STRING}}} - # Given type_env parameter "a.b" is TypeType(value='map_type') - Given type_env parameter "a.b" is map_type +@wip +Scenario: quoted_map_fields/field_access_dash - # map_value:{entries:{key:{string_value:"c"} value:{string_value:"oops"}}} - Given bindings parameter "a.b" is MapType({StringType(source='c'): StringType(source='oops')}) + When CEL expression "{'content-type': 'application/json', 'content-length': 145}.`content-type` == 'application/json'" is evaluated + Then value is celpy.celtypes.BoolType(source=True) - # string_value:"yeah" - Given bindings parameter "a.b.c" is StringType(source='yeah') +@wip +Scenario: quoted_map_fields/field_access_dot - When CEL expression "a.b.c" is evaluated - # string_value:"yeah" - Then value is StringType(source='yeah') + When CEL expression "{'foo.txt': 32, 'bar.csv': 1024}.`foo.txt`" is evaluated + Then value is celpy.celtypes.IntType(source=32) +@wip +Scenario: quoted_map_fields/has_field_slash -Scenario: list_field_select_unsupported + When CEL expression "has({'/api/v1': true, '/api/v2': false}.`/api/v3`)" is evaluated + Then value is celpy.celtypes.BoolType(source=False) - # type:{list_type:{elem_type:{primitive:STRING}}} - # Given type_env parameter "a.b" is TypeType(value='list_type') - Given type_env parameter "a.b" is list_type +@wip +Scenario: quoted_map_fields/has_field_dash - # list_value:{values:{string_value:"pancakes"}} - Given bindings parameter "a.b" is [StringType(source='pancakes')] + When CEL expression "has({'content-type': 'application/json', 'content-length': 145}.`content-type`)" is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "a.b.pancakes" is evaluated - # errors:{message:"type 'list_type: > ' does not support field selection"} - Then eval_error is "type 'list_type: > ' does not support field selection" +@wip +Scenario: quoted_map_fields/has_field_dot + When CEL expression "has({'foo.txt': 32, 'bar.csv': 1024}.`foo.txt`)" is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: int64_field_select_unsupported - # type:{primitive:INT64} - # Given type_env parameter "a" is TypeType(value='INT64') - Given type_env parameter "a" is INT64 +# qualified_identifier_resolution -- Tests for qualified identifier resolution. - # int64_value:15 - Given bindings parameter "a" is IntType(source=15) +Scenario: qualified_identifier_resolution/qualified_ident - When CEL expression "a.pancakes" is evaluated - # errors:{message:"type 'int64_type' does not support field selection"} - Then eval_error is "type 'int64_type' does not support field selection" + Given type_env parameter "a.b.c" is celpy.celtypes.StringType + and bindings parameter "a.b.c" is celpy.celtypes.StringType(source='yeah') + When CEL expression 'a.b.c' is evaluated + Then value is celpy.celtypes.StringType(source='yeah') + +Scenario: qualified_identifier_resolution/map_field_select + Given type_env parameter "a.b" is celpy.celtypes.MapType + and bindings parameter "a.b" is celpy.celtypes.MapType({'c': celpy.celtypes.StringType(source='yeah')}) + When CEL expression 'a.b.c' is evaluated + Then value is celpy.celtypes.StringType(source='yeah') -Scenario: ident_with_longest_prefix_check - namespace resolution should try to find the longest prefix for the checker. - # type:{primitive:STRING} - # Given type_env parameter "a.b.c" is TypeType(value='STRING') - Given type_env parameter "a.b.c" is STRING +Scenario: qualified_identifier_resolution/qualified_identifier_resolution_unchecked + namespace resolution should try to find the longest prefix for the + evaluator. - # type:{map_type:{key_type:{primitive:STRING} value_type:{primitive:STRING}}} - # Given type_env parameter "a.b" is TypeType(value='map_type') - Given type_env parameter "a.b" is map_type + Given disable_check parameter is True + and type_env parameter "a.b.c" is celpy.celtypes.StringType + and type_env parameter "a.b" is celpy.celtypes.MapType + and bindings parameter "a.b.c" is celpy.celtypes.StringType(source='yeah') + and bindings parameter "a.b" is celpy.celtypes.MapType({'c': celpy.celtypes.StringType(source='oops')}) + When CEL expression 'a.b.c' is evaluated + Then value is celpy.celtypes.StringType(source='yeah') - # map_value:{entries:{key:{string_value:"c"} value:{string_value:"oops"}}} - Given bindings parameter "a.b" is MapType({StringType(source='c'): StringType(source='oops')}) +Scenario: qualified_identifier_resolution/list_field_select_unsupported - # string_value:"yeah" - Given bindings parameter "a.b.c" is StringType(source='yeah') + Given disable_check parameter is True + and type_env parameter "a.b" is celpy.celtypes.ListType + and bindings parameter "a.b" is [celpy.celtypes.StringType(source='pancakes')] + When CEL expression 'a.b.pancakes' is evaluated + Then eval_error is "type 'list_type: > ' does not support field selection" + +Scenario: qualified_identifier_resolution/int64_field_select_unsupported + + Given disable_check parameter is True + and type_env parameter "a" is celpy.celtypes.IntType + and bindings parameter "a" is celpy.celtypes.IntType(source=15) + When CEL expression 'a.pancakes' is evaluated + Then eval_error is "type 'int64_type' does not support field selection" - When CEL expression "a.b.c" is evaluated - # string_value:"yeah" - Then value is StringType(source='yeah') +Scenario: qualified_identifier_resolution/ident_with_longest_prefix_check + namespace resolution should try to find the longest prefix for the + checker. + Given type_env parameter "a.b.c" is celpy.celtypes.StringType + and type_env parameter "a.b" is celpy.celtypes.MapType + and bindings parameter "a.b.c" is celpy.celtypes.StringType(source='yeah') + and bindings parameter "a.b" is celpy.celtypes.MapType({'c': celpy.celtypes.StringType(source='oops')}) + When CEL expression 'a.b.c' is evaluated + Then value is celpy.celtypes.StringType(source='yeah') -Scenario: map_key_float +Scenario: qualified_identifier_resolution/map_key_float map should not support float as the key. - When CEL expression "{3.3:15.15, 1.0: 5}[1.0]" is evaluated - # errors:{message:"unsupported key type"} - Then eval_error is 'unsupported key type' + Given disable_check parameter is True + When CEL expression '{3.3:15.15, 1.0: 5}[1.0]' is evaluated + Then eval_error is 'unsupported key type' -Scenario: map_key_null +Scenario: qualified_identifier_resolution/map_key_null map should not support null as the key. - When CEL expression "{null:false}[null]" is evaluated - # errors:{message:"unsupported key type"} - Then eval_error is 'unsupported key type' + Given disable_check parameter is True + When CEL expression '{null:false}[null]' is evaluated + Then eval_error is 'unsupported key type' -Scenario: map_value_repeat_key +Scenario: qualified_identifier_resolution/map_value_repeat_key map should not support repeated key. - When CEL expression "{true:1,false:2,true:3}[true]" is evaluated - # errors:{message:"Failed with repeated key"} + + When CEL expression '{true:1,false:2,true:3}[true]' is evaluated Then eval_error is 'Failed with repeated key' +Scenario: qualified_identifier_resolution/map_value_repeat_key_heterogeneous + map should not support repeated key. + + When CEL expression '{0: 1, 0u: 2}[0.0]' is evaluated + Then eval_error is 'Failed with repeated key' # in -- Tests for 'in' operator for maps. -Scenario: empty +Scenario: in/empty - When CEL expression "7 in {}" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression '7 in {}' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: in/singleton -Scenario: singleton + When CEL expression 'true in {true: 1}' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "true in {true: 1}" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: in/present + When CEL expression "'George' in {'John': 'smart', 'Paul': 'cute', 'George': 'quiet', 'Ringo': 'funny'}" is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: present +Scenario: in/absent - When CEL expression "'George' in {'John': 'smart', 'Paul': 'cute', 'George': 'quiet', 'Ringo': 'funny'}" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression "'spider' in {'ant': 6, 'fly': 6, 'centipede': 100}" is evaluated + Then value is celpy.celtypes.BoolType(source=False) +@wip +Scenario: in/mixed_numbers_and_keys_present -Scenario: absent + When CEL expression '3.0 in {1: 1, 2: 2, 3u: 3} && 2u in {1u: 1, 2: 2} && 1 in {1u: 1, 2: 2}' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: in/mixed_numbers_and_keys_absent + + When CEL expression '3.1 in {1: 1, 2: 2, 3u: 3}' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "'spider' in {'ant': 6, 'fly': 6, 'centipede': 100}" is evaluated - # bool_value:false - Then value is BoolType(source=False) diff --git a/features/fields.textproto b/features/fields.textproto index 9652694..66eb5d4 100644 --- a/features/fields.textproto +++ b/features/fields.textproto @@ -1,3 +1,6 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: cel.expr.conformance.test.SimpleTestFile + name: "fields" description: "Tests for field access in maps." section { @@ -20,30 +23,52 @@ section { } test { name: "map_key_bool" - expr: '{true:5}[true]' + expr: "{true:5}[true]" value: { int64_value: 5 } } test { - name: "map_key_mix_type" + name: "map_key_mixed_type" expr: "{true:1,2:2,5u:3}[true]" value: { int64_value: 1 } } + test { + name: "map_key_mixed_numbers_double_key" + expr: "{1u: 1.0, 2: 2.0, 3u: 3.0}[3.0]" + value: { double_value: 3.0 } + } + test { + name: "map_key_mixed_numbers_lossy_double_key" + expr: "{1u: 1.0, 2: 2.0, 3u: 3.0}[3.1]" + eval_error: { + errors: { message: "no such key" } + } + } + test { + name: "map_key_mixed_numbers_uint_key" + expr: "{1u: 1.0, 2: 2.0, 3u: 3.0}[2u]" + value: { double_value: 2.0 } + } + test { + name: "map_key_mixed_numbers_int_key" + expr: "{1u: 1.0, 2: 2.0, 3u: 3.0}[1]" + value: { double_value: 1.0 } + } test { name: "map_field_access" expr: "x.name" type_env: { - name: "x", + name: "x" ident: { type: { map_type: { - key_type: {primitive: STRING} - value_type: {primitive: INT64} + key_type: { primitive: STRING } + value_type: { primitive: INT64 } } } } } bindings: { - key: "x", + key: "x" value: { value: { map_value: { @@ -64,22 +89,108 @@ section { errors: { message: "no such key" } } } + test { + name: "map_no_such_key_or_false" + expr: "dyn({0:1,2:2,5:3}[1]) || false" + eval_error: { + errors: { message: "no such key" } + } + } + test { + name: "map_no_such_key_or_true" + expr: "dyn({0:1,2:2,5:3}[1]) || true" + value: { bool_value: true } + } + test { + name: "map_no_such_key_and_false" + expr: "dyn({0:1,2:2,5:3}[1]) && false" + value: { bool_value: false } + } + test { + name: "map_no_such_key_and_true" + expr: "dyn({0:1,2:2,5:3}[1]) && true" + eval_error: { + errors: { message: "no such key" } + } + } + test { + name: "map_bad_key_type" + expr: "{0:1,2:2,5:3}[dyn(b'')]" + eval_error: { + errors: { message: "no such key" } + } + } + test { + name: "map_bad_key_type_or_false" + expr: "dyn({0:1,2:2,5:3}[dyn(b'')]) || false" + eval_error: { + errors: { message: "no such key" } + } + } + test { + name: "map_bad_key_type_or_true" + expr: "dyn({0:1,2:2,5:3}[dyn(b'')]) || true" + value: { bool_value: true } + } + test { + name: "map_bad_key_type_and_false" + expr: "dyn({0:1,2:2,5:3}[dyn(b'')]) && false" + value: { bool_value: false } + } + test { + name: "map_bad_key_type_and_true" + expr: "dyn({0:1,2:2,5:3}[dyn(b'')]) && true" + eval_error: { + errors: { message: "no such key" } + } + } test { name: "map_field_select_no_such_key" expr: "x.name" type_env: { - name: "x", + name: "x" + ident: { + type: { + map_type: { + key_type: { primitive: STRING } + value_type: { primitive: STRING } + } + } + } + } + bindings: { + key: "x" + value: { + value: { + map_value: { + entries { + key: { string_value: "holiday" } + value: { string_value: "field" } + } + } + } + } + } + eval_error: { + errors: { message: "no such key: 'name'" } + } + } + test { + name: "map_field_select_no_such_key_or_false" + expr: "dyn(x.name) || false" + type_env: { + name: "x" ident: { type: { map_type: { - key_type: {primitive: STRING} - value_type: {primitive: STRING} + key_type: { primitive: STRING } + value_type: { primitive: STRING } } } } } bindings: { - key: "x", + key: "x" value: { value: { map_value: { @@ -92,23 +203,112 @@ section { } } eval_error: { - errors: { message:"no such key: 'name'" } + errors: { message: "no such key: 'name'" } + } + } + test { + name: "map_field_select_no_such_key_or_true" + expr: "dyn(x.name) || true" + type_env: { + name: "x" + ident: { + type: { + map_type: { + key_type: { primitive: STRING } + value_type: { primitive: STRING } + } + } + } + } + bindings: { + key: "x" + value: { + value: { + map_value: { + entries { + key: { string_value: "holiday" } + value: { string_value: "field" } + } + } + } + } + } + value: { bool_value: true } + } + test { + name: "map_field_select_no_such_key_and_false" + expr: "dyn(x.name) && false" + type_env: { + name: "x" + ident: { + type: { + map_type: { + key_type: { primitive: STRING } + value_type: { primitive: STRING } + } + } + } + } + bindings: { + key: "x" + value: { + value: { + map_value: { + entries { + key: { string_value: "holiday" } + value: { string_value: "field" } + } + } + } + } + } + value: { bool_value: false } + } + test { + name: "map_field_select_no_such_key_and_true" + expr: "dyn(x.name) && true" + type_env: { + name: "x" + ident: { + type: { + map_type: { + key_type: { primitive: STRING } + value_type: { primitive: STRING } + } + } + } + } + bindings: { + key: "x" + value: { + value: { + map_value: { + entries { + key: { string_value: "holiday" } + value: { string_value: "field" } + } + } + } + } + } + eval_error: { + errors: { message: "no such key: 'name'" } } } test { name: "map_value_null" - expr: '{true:null}[true]' + expr: "{true:null}[true]" value: { null_value: NULL_VALUE } } test { name: "map_value_bool" - expr: '{27:false}[27]' + expr: "{27:false}[27]" value: { bool_value: false } } test { name: "map_value_string" expr: "{'n':'x'}['n']" - value: { string_value: 'x' } + value: { string_value: "x" } } test { name: "map_value_float" @@ -127,12 +327,12 @@ section { } test { name: "map_value_bytes" - expr: '{0:b""}[0]' + expr: "{0:b''}[0]" value: { bytes_value: "" } } test { name: "map_value_list" - expr: '{0u:[1]}[0u]' + expr: "{0u:[1]}[0u]" value: { list_value: { values: { int64_value: 1 } @@ -141,7 +341,7 @@ section { } test { name: "map_value_map" - expr: '{"map": {"k": "v"}}["map"]' + expr: "{'map': {'k': 'v'}}['map']" value: { map_value { entries { @@ -153,7 +353,7 @@ section { } test { name: "map_value_mix_type" - expr: '{"map": {"k": "v"}, "list": [1]}["map"]' + expr: "{'map': {'k': 'v'}, 'list': [1]}['map']" value: { map_value { entries { @@ -183,6 +383,40 @@ section { value: { bool_value: false } } } +section { + name: "quoted_map_fields" + description: "Field accesses using the quote syntax" + test { + name: "field_access_slash" + expr: "{'/api/v1': true, '/api/v2': false}.`/api/v1`" + value: { bool_value: true } + } + test { + name: "field_access_dash" + expr: "{'content-type': 'application/json', 'content-length': 145}.`content-type` == 'application/json'" + value: { bool_value: true } + } + test { + name: "field_access_dot" + expr: "{'foo.txt': 32, 'bar.csv': 1024}.`foo.txt`" + value: { int64_value: 32 } + } + test { + name: "has_field_slash" + expr: "has({'/api/v1': true, '/api/v2': false}.`/api/v3`)" + value: { bool_value: false } + } + test { + name: "has_field_dash" + expr: "has({'content-type': 'application/json', 'content-length': 145}.`content-type`)" + value: { bool_value: true } + } + test { + name: "has_field_dot" + expr: "has({'foo.txt': 32, 'bar.csv': 1024}.`foo.txt`)" + value: { bool_value: true } + } +} section { name: "qualified_identifier_resolution" description: "Tests for qualified identifier resolution." @@ -190,11 +424,11 @@ section { name: "qualified_ident" expr: "a.b.c" type_env: { - name: "a.b.c", + name: "a.b.c" ident: { type: { primitive: STRING } } } bindings: { - key: "a.b.c", + key: "a.b.c" value: { value: { string_value: "yeah" } } } value: { string_value: "yeah" } @@ -203,18 +437,18 @@ section { name: "map_field_select" expr: "a.b.c" type_env: { - name: "a.b", + name: "a.b" ident: { type: { map_type: { - key_type: {primitive: STRING} - value_type: {primitive: STRING} + key_type: { primitive: STRING } + value_type: { primitive: STRING } } } } } bindings: { - key: "a.b", + key: "a.b" value: { value: { map_value: { @@ -233,20 +467,20 @@ section { description: "namespace resolution should try to find the longest prefix for the evaluator." expr: "a.b.c" type_env: { - name: "a.b.c", + name: "a.b.c" ident: { type: { primitive: STRING } } } bindings: { - key: "a.b.c", + key: "a.b.c" value: { value: { string_value: "yeah" } } } type_env: { - name: "a.b", + name: "a.b" ident: { type: { map_type: { - key_type: {primitive: STRING} - value_type: {primitive: STRING} + key_type: { primitive: STRING } + value_type: { primitive: STRING } } } } @@ -264,7 +498,7 @@ section { } } } - disable_check: true ## when check is disabled, the evaluator should evaluate it in the correct order + disable_check: true ## when check is disabled, the evaluator should evaluate it in the correct order value: { string_value: "yeah" } } test { @@ -272,17 +506,17 @@ section { expr: "a.b.pancakes" disable_check: true type_env: { - name: "a.b", + name: "a.b" ident: { type: { list_type: { - elem_type: {primitive: STRING} + elem_type: { primitive: STRING } } } } } bindings: { - key: "a.b", + key: "a.b" value: { value: { list_value: { @@ -293,7 +527,7 @@ section { } eval_error: { errors: { - message:"type 'list_type: > ' does not support field selection" + message: "type 'list_type: > ' does not support field selection" } } } @@ -302,7 +536,7 @@ section { expr: "a.pancakes" disable_check: true type_env: { - name: "a", + name: "a" ident: { type: { primitive: INT64 @@ -310,7 +544,7 @@ section { } } bindings: { - key: "a", + key: "a" value: { value: { int64_value: 15 @@ -319,7 +553,7 @@ section { } eval_error: { errors: { - message:"type 'int64_type' does not support field selection" + message: "type 'int64_type' does not support field selection" } } } @@ -328,20 +562,20 @@ section { description: "namespace resolution should try to find the longest prefix for the checker." expr: "a.b.c" type_env: { - name: "a.b.c", + name: "a.b.c" ident: { type: { primitive: STRING } } } bindings: { - key: "a.b.c", + key: "a.b.c" value: { value: { string_value: "yeah" } } } type_env: { - name: "a.b", + name: "a.b" ident: { type: { map_type: { - key_type: {primitive: STRING} - value_type: {primitive: STRING} + key_type: { primitive: STRING } + value_type: { primitive: STRING } } } } @@ -365,7 +599,7 @@ section { name: "map_key_float" description: "map should not support float as the key." expr: "{3.3:15.15, 1.0: 5}[1.0]" - disable_check: true # need to make it fail in the evaluation phase + disable_check: true # need to make it fail in the evaluation phase eval_error: { errors: { message: "unsupported key type" } } @@ -376,7 +610,7 @@ section { name: "map_key_null" description: "map should not support null as the key." expr: "{null:false}[null]" - disable_check: true # need to make it fail in the evaluation phase + disable_check: true # need to make it fail in the evaluation phase eval_error: { errors: { message: "unsupported key type" } } @@ -393,6 +627,16 @@ section { ## Current behavior: ## value: { int64_value: 1 } } + test { + name: "map_value_repeat_key_heterogeneous" + description: "map should not support repeated key." + expr: "{0: 1, 0u: 2}[0.0]" + eval_error: { + errors: { message: "Failed with repeated key" } + } + ## Current behavior: + ## value: { int64_value: 1 } + } } section { name: "in" @@ -417,4 +661,14 @@ section { expr: "'spider' in {'ant': 6, 'fly': 6, 'centipede': 100}" value: { bool_value: false } } + test { + name: "mixed_numbers_and_keys_present" + expr: "3.0 in {1: 1, 2: 2, 3u: 3} && 2u in {1u: 1, 2: 2} && 1 in {1u: 1, 2: 2}" + value: { bool_value: true } + } + test { + name: "mixed_numbers_and_keys_absent" + expr: "3.1 in {1: 1, 2: 2, 3u: 3}" + value: { bool_value: false } + } } diff --git a/features/fp_math.feature b/features/fp_math.feature index 5a8961d..ada3434 100644 --- a/features/fp_math.feature +++ b/features/fp_math.feature @@ -1,214 +1,161 @@ - +@conformance Feature: fp_math Tests for floating-point math. -# fp_math -- Simple tests for floating point. - -Scenario: add_positive_positive - - When CEL expression "4.25 + 15.25" is evaluated - # double_value:19.5 - Then value is DoubleType(source=19.5) - - -Scenario: add_positive_negative - - When CEL expression "17.75 + (-7.75)" is evaluated - # double_value:10 - Then value is DoubleType(source=10) - - -Scenario: add_negative_negative - - When CEL expression "-4.125 + (-2.125)" is evaluated - # double_value:-6.25 - Then value is DoubleType(source=-6.25) - - -Scenario: sub_positive_positive - - When CEL expression "42.0 - 12.0" is evaluated - # double_value:30 - Then value is DoubleType(source=30) +# fp_math -- Simple tests for floating point. -Scenario: sub_positive_negative +Scenario: fp_math/add_positive_positive - When CEL expression "42.875 - (-22.0)" is evaluated - # double_value:64.875 - Then value is DoubleType(source=64.875) + When CEL expression '4.25 + 15.25' is evaluated + Then value is celpy.celtypes.DoubleType(source=19.5) +Scenario: fp_math/add_positive_negative -Scenario: sub_negative_negative + When CEL expression '17.75 + (-7.75)' is evaluated + Then value is celpy.celtypes.DoubleType(source=10.0) - When CEL expression "-4.875 - (-0.125)" is evaluated - # double_value:-4.75 - Then value is DoubleType(source=-4.75) +Scenario: fp_math/add_negative_negative + When CEL expression '-4.125 + (-2.125)' is evaluated + Then value is celpy.celtypes.DoubleType(source=-6.25) -Scenario: multiply_positive_positive +Scenario: fp_math/sub_positive_positive - When CEL expression "42.5 * 0.2" is evaluated - # double_value:8.5 - Then value is DoubleType(source=8.5) + When CEL expression '42.0 - 12.0' is evaluated + Then value is celpy.celtypes.DoubleType(source=30.0) +Scenario: fp_math/sub_positive_negative -Scenario: multiply_positive_negative + When CEL expression '42.875 - (-22.0)' is evaluated + Then value is celpy.celtypes.DoubleType(source=64.875) - When CEL expression "40.75 * (-2.25)" is evaluated - # double_value:-91.6875 - Then value is DoubleType(source=-91.6875) +Scenario: fp_math/sub_negative_negative + When CEL expression '-4.875 - (-0.125)' is evaluated + Then value is celpy.celtypes.DoubleType(source=-4.75) -Scenario: multiply_negative_negative +Scenario: fp_math/multiply_positive_positive - When CEL expression "-3.0 * (-2.5)" is evaluated - # double_value:7.5 - Then value is DoubleType(source=7.5) + When CEL expression '42.5 * 0.2' is evaluated + Then value is celpy.celtypes.DoubleType(source=8.5) +Scenario: fp_math/multiply_positive_negative -Scenario: divide_positive_positive + When CEL expression '40.75 * (-2.25)' is evaluated + Then value is celpy.celtypes.DoubleType(source=-91.6875) - When CEL expression "0.0625 / 0.002" is evaluated - # double_value:31.25 - Then value is DoubleType(source=31.25) +Scenario: fp_math/multiply_negative_negative + When CEL expression '-3.0 * (-2.5)' is evaluated + Then value is celpy.celtypes.DoubleType(source=7.5) -Scenario: divide_positive_negative +Scenario: fp_math/divide_positive_positive - When CEL expression "-2.0 / 2.0" is evaluated - # double_value:-1 - Then value is DoubleType(source=-1) + When CEL expression '0.0625 / 0.002' is evaluated + Then value is celpy.celtypes.DoubleType(source=31.25) +Scenario: fp_math/divide_positive_negative -Scenario: divide_negative_negative + When CEL expression '-2.0 / 2.0' is evaluated + Then value is celpy.celtypes.DoubleType(source=-1.0) - When CEL expression "-8.875 / (-0.0625)" is evaluated - # double_value:142 - Then value is DoubleType(source=142) +Scenario: fp_math/divide_negative_negative + When CEL expression '-8.875 / (-0.0625)' is evaluated + Then value is celpy.celtypes.DoubleType(source=142.0) -Scenario: mod_not_support +Scenario: fp_math/mod_not_support - When CEL expression "47.5 % 5.5" is evaluated - # errors:{message:"found no matching overload for '_%_' applied to '(double, double)'"} + Given disable_check parameter is True + When CEL expression '47.5 % 5.5' is evaluated Then eval_error is "found no matching overload for '_%_' applied to '(double, double)'" +Scenario: fp_math/negative -Scenario: negative - - When CEL expression "-(4.5)" is evaluated - # double_value:-4.5 - Then value is DoubleType(source=-4.5) - + When CEL expression '-(4.5)' is evaluated + Then value is celpy.celtypes.DoubleType(source=-4.5) -Scenario: double_negative +Scenario: fp_math/double_negative - When CEL expression "-(-1.25)" is evaluated - # double_value:1.25 - Then value is DoubleType(source=1.25) + When CEL expression '-(-1.25)' is evaluated + Then value is celpy.celtypes.DoubleType(source=1.25) +Scenario: fp_math/negative_zero -Scenario: negative_zero + When CEL expression '-(0.0)' is evaluated + Then value is celpy.celtypes.DoubleType(source=-0.0) - When CEL expression "-(0.0)" is evaluated - # double_value:-0 - Then value is DoubleType(source=0) +Scenario: fp_math/divide_zero + When CEL expression '15.75 / 0.0' is evaluated + Then value is celpy.celtypes.DoubleType(source=float('inf')) -Scenario: divide_zero +Scenario: fp_math/multiply_zero - When CEL expression "15.75 / 0.0" is evaluated - # double_value:inf - Then value is DoubleType(source='inf') + When CEL expression '15.36 * 0.0' is evaluated + Then value is celpy.celtypes.DoubleType(source=0.0) +Scenario: fp_math/add_left_identity -Scenario: multiply_zero + When CEL expression '0.0 + 1.75' is evaluated + Then value is celpy.celtypes.DoubleType(source=1.75) - When CEL expression "15.36 * 0.0" is evaluated - # double_value:0 - Then value is DoubleType(source=0) +Scenario: fp_math/add_right_identity + When CEL expression ' 2.5 + 0.0' is evaluated + Then value is celpy.celtypes.DoubleType(source=2.5) -Scenario: add_left_identity +Scenario: fp_math/add_commutative - When CEL expression "0.0 + 1.75" is evaluated - # double_value:1.75 - Then value is DoubleType(source=1.75) + When CEL expression '7.5 + 1.5 == 1.5 + 7.5' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: fp_math/add_associative -Scenario: add_right_identity + When CEL expression '5.625 + (15.75 + 2.0) == (5.625 + 15.75) + 2.0' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression " 2.5 + 0.0" is evaluated - # double_value:2.5 - Then value is DoubleType(source=2.5) +Scenario: fp_math/mul_left_identity + When CEL expression '1.0 * 45.25' is evaluated + Then value is celpy.celtypes.DoubleType(source=45.25) -Scenario: add_commutative +Scenario: fp_math/mul_right_identity - When CEL expression "7.5 + 1.5 == 1.5 + 7.5" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression '-25.25 * 1.0' is evaluated + Then value is celpy.celtypes.DoubleType(source=-25.25) +Scenario: fp_math/mul_commutative -Scenario: add_associative + When CEL expression '1.5 * 25.875 == 25.875 * 1.5' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "5.625 + (15.75 + 2.0) == (5.625 + 15.75) + 2.0" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: fp_math/mul_associative + When CEL expression '1.5 * (23.625 * 0.75) == (1.5 * 23.625) * 0.75' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: mul_left_identity +Scenario: fp_math/add_mul_distribute - When CEL expression "1.0 * 45.25" is evaluated - # double_value:45.25 - Then value is DoubleType(source=45.25) + When CEL expression '5.75 * (1.5 + 2.5) == 5.75 * 1.5 + 5.75 * 2.5' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - -Scenario: mul_right_identity - - When CEL expression "-25.25 * 1.0" is evaluated - # double_value:-25.25 - Then value is DoubleType(source=-25.25) - - -Scenario: mul_commutative - - When CEL expression "1.5 * 25.875 == 25.875 * 1.5" is evaluated - # bool_value:true - Then value is BoolType(source=True) - - -Scenario: mul_associative - - When CEL expression "1.5 * (23.625 * 0.75) == (1.5 * 23.625) * 0.75" is evaluated - # bool_value:true - Then value is BoolType(source=True) - - -Scenario: add_mul_distribute - - When CEL expression "5.75 * (1.5 + 2.5) == 5.75 * 1.5 + 5.75 * 2.5" is evaluated - # bool_value:true - Then value is BoolType(source=True) - - -Scenario: fp_overflow_positive +Scenario: fp_math/fp_overflow_positive DBL_MAX(2^1023) times two - When CEL expression "2.0 * 8.988466e+307 " is evaluated - # double_value:inf - Then value is DoubleType(source='inf') + When CEL expression '2.0 * 8.988466e+307 ' is evaluated + Then value is celpy.celtypes.DoubleType(source=float('inf')) -Scenario: fp_overflow_negative +Scenario: fp_math/fp_overflow_negative -DBL_MAX(-2^1023) times two - When CEL expression "2.0 * -8.988466e+307 " is evaluated - # double_value:-inf - Then value is DoubleType(source='-inf') + When CEL expression '2.0 * -8.988466e+307 ' is evaluated + Then value is celpy.celtypes.DoubleType(source=float('-inf')) -Scenario: fp_underflow +Scenario: fp_math/fp_underflow DBL_MIN(2^-1074) divided by two - When CEL expression "1e-324 / 2.0" is evaluated - # double_value:0 - Then value is DoubleType(source=0) + + When CEL expression '1e-324 / 2.0' is evaluated + Then value is celpy.celtypes.DoubleType(source=0.0) + diff --git a/features/fp_math.textproto b/features/fp_math.textproto index 38a3eae..72474bc 100644 --- a/features/fp_math.textproto +++ b/features/fp_math.textproto @@ -1,3 +1,6 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: cel.expr.conformance.test.SimpleTestFile + name: "fp_math" description: "Tests for floating-point math." section { diff --git a/features/integer_math.feature b/features/integer_math.feature index c35fc54..927b49b 100644 --- a/features/integer_math.feature +++ b/features/integer_math.feature @@ -1,406 +1,345 @@ - +@conformance Feature: integer_math Tests for int and uint math. -# int64_math -- Simple tests for int64. - -Scenario: add_positive_positive - - When CEL expression "40 + 2" is evaluated - # int64_value:42 - Then value is IntType(source=42) - - -Scenario: add_positive_negative - - When CEL expression "42 + (-7)" is evaluated - # int64_value:35 - Then value is IntType(source=35) - - -Scenario: add_negative_negative - - When CEL expression "-4 + (-2)" is evaluated - # int64_value:-6 - Then value is IntType(source=-6) - - -Scenario: sub_positive_positive - - When CEL expression "42 - 12" is evaluated - # int64_value:30 - Then value is IntType(source=30) - - -Scenario: sub_positive_negative - - When CEL expression "42 - (-22)" is evaluated - # int64_value:64 - Then value is IntType(source=64) - - -Scenario: sub_negative_negative - - When CEL expression "-42 - (-12)" is evaluated - # int64_value:-30 - Then value is IntType(source=-30) +# int64_math -- Simple tests for int64. -Scenario: multiply_positive_positive +Scenario: int64_math/add_positive_positive - When CEL expression "42 * 2" is evaluated - # int64_value:84 - Then value is IntType(source=84) + When CEL expression '40 + 2' is evaluated + Then value is celpy.celtypes.IntType(source=42) +Scenario: int64_math/add_positive_negative -Scenario: multiply_positive_negative + When CEL expression '42 + (-7)' is evaluated + Then value is celpy.celtypes.IntType(source=35) - When CEL expression "40 * (-2)" is evaluated - # int64_value:-80 - Then value is IntType(source=-80) +Scenario: int64_math/add_negative_negative + When CEL expression '-4 + (-2)' is evaluated + Then value is celpy.celtypes.IntType(source=-6) -Scenario: multiply_negative_negative +Scenario: int64_math/sub_positive_positive - When CEL expression "-30 * (-2)" is evaluated - # int64_value:60 - Then value is IntType(source=60) + When CEL expression '42 - 12' is evaluated + Then value is celpy.celtypes.IntType(source=30) +Scenario: int64_math/sub_positive_negative -Scenario: divide_positive_positive + When CEL expression '42 - (-22)' is evaluated + Then value is celpy.celtypes.IntType(source=64) - When CEL expression "42 / 2" is evaluated - # int64_value:21 - Then value is IntType(source=21) +Scenario: int64_math/sub_negative_negative + When CEL expression '-42 - (-12)' is evaluated + Then value is celpy.celtypes.IntType(source=-30) -Scenario: divide_positive_negative +Scenario: int64_math/multiply_positive_positive - When CEL expression "-20 / 2" is evaluated - # int64_value:-10 - Then value is IntType(source=-10) + When CEL expression '42 * 2' is evaluated + Then value is celpy.celtypes.IntType(source=84) +Scenario: int64_math/multiply_positive_negative -Scenario: divide_negative_negative + When CEL expression '40 * (-2)' is evaluated + Then value is celpy.celtypes.IntType(source=-80) - When CEL expression "-80 / (-2)" is evaluated - # int64_value:40 - Then value is IntType(source=40) +Scenario: int64_math/multiply_negative_negative + When CEL expression '-30 * (-2)' is evaluated + Then value is celpy.celtypes.IntType(source=60) -Scenario: mod_positive_positive +Scenario: int64_math/divide_positive_positive - When CEL expression "47 % 5" is evaluated - # int64_value:2 - Then value is IntType(source=2) + When CEL expression '42 / 2' is evaluated + Then value is celpy.celtypes.IntType(source=21) +Scenario: int64_math/divide_positive_negative -Scenario: mod_positive_negative + When CEL expression '-20 / 2' is evaluated + Then value is celpy.celtypes.IntType(source=-10) - When CEL expression "43 % (-5)" is evaluated - # int64_value:3 - Then value is IntType(source=3) +Scenario: int64_math/divide_negative_negative + When CEL expression '-80 / (-2)' is evaluated + Then value is celpy.celtypes.IntType(source=40) -Scenario: mod_negative_negative +Scenario: int64_math/mod_positive_positive - When CEL expression "-42 % (-5)" is evaluated - # int64_value:-2 - Then value is IntType(source=-2) + When CEL expression '47 % 5' is evaluated + Then value is celpy.celtypes.IntType(source=2) +Scenario: int64_math/mod_positive_negative -Scenario: mod_negative_positive + When CEL expression '43 % (-5)' is evaluated + Then value is celpy.celtypes.IntType(source=3) - When CEL expression "-3 % 5" is evaluated - # int64_value:-3 - Then value is IntType(source=-3) +Scenario: int64_math/mod_negative_negative + When CEL expression '-42 % (-5)' is evaluated + Then value is celpy.celtypes.IntType(source=-2) -Scenario: unary_minus_pos +Scenario: int64_math/mod_negative_positive - When CEL expression "-(42)" is evaluated - # int64_value:-42 - Then value is IntType(source=-42) + When CEL expression '-3 % 5' is evaluated + Then value is celpy.celtypes.IntType(source=-3) +Scenario: int64_math/unary_minus_pos -Scenario: unary_minus_neg + When CEL expression '-(42)' is evaluated + Then value is celpy.celtypes.IntType(source=-42) - When CEL expression "-(-42)" is evaluated - # int64_value:42 - Then value is IntType(source=42) +Scenario: int64_math/unary_minus_neg + When CEL expression '-(-42)' is evaluated + Then value is celpy.celtypes.IntType(source=42) -Scenario: unary_minus_no_overload +Scenario: int64_math/unary_minus_no_overload - When CEL expression "-(42u)" is evaluated - # errors:{message:"no_such_overload"} + Given disable_check parameter is True + When CEL expression '-(42u)' is evaluated Then eval_error is 'no_such_overload' +Scenario: int64_math/unary_minus_not_bool -Scenario: unary_minus_not_bool - - When CEL expression "-false" is evaluated - # errors:{message:"no_such_overload"} + Given disable_check parameter is True + When CEL expression '-false' is evaluated Then eval_error is 'no_such_overload' +Scenario: int64_math/mod_zero -Scenario: mod_zero - - When CEL expression "34 % 0" is evaluated - # errors:{message:"modulus by zero"} + When CEL expression '34 % 0' is evaluated Then eval_error is 'modulus by zero' +Scenario: int64_math/negative_zero -Scenario: negtive_zero + When CEL expression '-(0)' is evaluated + Then value is celpy.celtypes.IntType(source=0) - When CEL expression "-(0)" is evaluated - # int64_value:0 - Then value is IntType(source=0) +Scenario: int64_math/double_negative + When CEL expression '-(-42)' is evaluated + Then value is celpy.celtypes.IntType(source=42) -Scenario: double_negative +Scenario: int64_math/divide_zero - When CEL expression "-(-42)" is evaluated - # int64_value:42 - Then value is IntType(source=42) - - -Scenario: divide_zero - - When CEL expression "15 / 0" is evaluated - # errors:{message:"divide by zero"} + When CEL expression '15 / 0' is evaluated Then eval_error is 'divide by zero' +Scenario: int64_math/multiply_zero -Scenario: multiply_zero - - When CEL expression "15 * 0" is evaluated - # int64_value:0 - Then value is IntType(source=0) + When CEL expression '15 * 0' is evaluated + Then value is celpy.celtypes.IntType(source=0) +Scenario: int64_math/add_left_identity -Scenario: add_left_identity + When CEL expression '0 + 17' is evaluated + Then value is celpy.celtypes.IntType(source=17) - When CEL expression "0 + 17" is evaluated - # int64_value:17 - Then value is IntType(source=17) +Scenario: int64_math/add_right_identity + When CEL expression ' 29 + 0' is evaluated + Then value is celpy.celtypes.IntType(source=29) -Scenario: add_right_identity +Scenario: int64_math/add_commutative - When CEL expression " 29 + 0" is evaluated - # int64_value:29 - Then value is IntType(source=29) + When CEL expression '75 + 15 == 15 + 75' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: int64_math/add_associative -Scenario: add_commutative + When CEL expression '5 + (15 + 20) == (5 + 15) + 20' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "75 + 15 == 15 + 75" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: int64_math/mul_left_identity + When CEL expression '1 * 45' is evaluated + Then value is celpy.celtypes.IntType(source=45) -Scenario: add_associative +Scenario: int64_math/mul_right_identity - When CEL expression "5 + (15 + 20) == (5 + 15) + 20" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression '-25 * 1' is evaluated + Then value is celpy.celtypes.IntType(source=-25) +Scenario: int64_math/mul_commutative -Scenario: mul_left_identity + When CEL expression '15 * 25 == 25 * 15' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "1 * 45" is evaluated - # int64_value:45 - Then value is IntType(source=45) +Scenario: int64_math/mul_associative + When CEL expression '15 * (23 * 88) == (15 * 23) * 88' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: mul_right_identity +Scenario: int64_math/add_mul_distribute - When CEL expression "-25 * 1" is evaluated - # int64_value:-25 - Then value is IntType(source=-25) + When CEL expression '5 * (15 + 25) == 5 * 15 + 5 * 25' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: int64_math/int64_overflow_positive + LLONG_MAX plus one. -Scenario: mul_commutative - - When CEL expression "15 * 25 == 25 * 15" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression '9223372036854775807 + 1' is evaluated + Then eval_error is 'return error for overflow' +Scenario: int64_math/int64_overflow_negative + LLONG_MIN minus one. -Scenario: mul_associative + When CEL expression '-9223372036854775808 - 1' is evaluated + Then eval_error is 'return error for overflow' - When CEL expression "15 * (23 * 88) == (15 * 23) * 88" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: int64_math/int64_overflow_add_negative + negative overflow via addition + When CEL expression '-9223372036854775808 + (-1)' is evaluated + Then eval_error is 'return error for overflow' -Scenario: add_mul_distribute +Scenario: int64_math/int64_overflow_sub_positive + positive overflow via subtraction - When CEL expression "5 * (15 + 25) == 5 * 15 + 5 * 25" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression '1 - (-9223372036854775807)' is evaluated + Then eval_error is 'return error for overflow' +Scenario: int64_math/int64_min_negate + Negated LLONG_MIN is not representable. -Scenario: int64_overflow_positive - LLONG_MAX plus one. - When CEL expression "9223372036854775807 + 1" is evaluated - # errors:{message:"return error for overflow"} + When CEL expression '-(-9223372036854775808)' is evaluated Then eval_error is 'return error for overflow' +Scenario: int64_math/int64_min_negate_mul + Negate LLONG_MIN via multiplication -Scenario: int64_overflow_negative - LLONG_MIN minus one. - When CEL expression "-9223372036854775808 - 1" is evaluated - # errors:{message:"return error for overflow"} + When CEL expression '(-9223372036854775808) * -1' is evaluated Then eval_error is 'return error for overflow' +Scenario: int64_math/int64_min_negate_div + Negate LLONG_MIN via division. -Scenario: int64_min_negate - Negated LLONG_MIN is not representable. - When CEL expression "-(-9223372036854775808)" is evaluated - # errors:{message:"return error for overflow"} + When CEL expression '(-9223372036854775808)/-1' is evaluated Then eval_error is 'return error for overflow' +Scenario: int64_math/int64_overflow_mul_positive + Overflow via multiplication. -Scenario: uint64_overflow_positive - ULLONG_MAX plus one. - When CEL expression "18446744073709551615u + 1u" is evaluated - # errors:{message:"return error for overflow"} + When CEL expression '5000000000 * 5000000000' is evaluated Then eval_error is 'return error for overflow' +Scenario: int64_math/int64_overflow_mul_negative + Overflow via multiplication. -Scenario: uint64_overflow_negative - zero minus one. - When CEL expression "0u - 1u" is evaluated - # errors:{message:"return error for overflow"} + When CEL expression '(-5000000000) * 5000000000' is evaluated Then eval_error is 'return error for overflow' +Scenario: int64_math/uint64_overflow_positive + ULLONG_MAX plus one. + When CEL expression '18446744073709551615u + 1u' is evaluated + Then eval_error is 'return error for overflow' -# uint64_math -- Simple tests for uint64. +Scenario: int64_math/uint64_overflow_negative + zero minus one. -Scenario: add + When CEL expression '0u - 1u' is evaluated + Then eval_error is 'return error for overflow' - When CEL expression "42u + 2u" is evaluated - # uint64_value:44 - Then value is UintType(source=44) +Scenario: int64_math/uint64_overflow_mul_positive + Overflow via multiplication. + When CEL expression '5000000000u * 5000000000u' is evaluated + Then eval_error is 'return error for overflow' -Scenario: sub - When CEL expression "42u - 12u" is evaluated - # uint64_value:30 - Then value is UintType(source=30) +# uint64_math -- Simple tests for uint64. +Scenario: uint64_math/add -Scenario: multiply + When CEL expression '42u + 2u' is evaluated + Then value is celpy.celtypes.UintType(source=44) - When CEL expression "40u * 2u" is evaluated - # uint64_value:80 - Then value is UintType(source=80) +Scenario: uint64_math/sub + When CEL expression '42u - 12u' is evaluated + Then value is celpy.celtypes.UintType(source=30) -Scenario: divide +Scenario: uint64_math/multiply - When CEL expression "60u / 2u" is evaluated - # uint64_value:30 - Then value is UintType(source=30) + When CEL expression '40u * 2u' is evaluated + Then value is celpy.celtypes.UintType(source=80) +Scenario: uint64_math/divide -Scenario: mod + When CEL expression '60u / 2u' is evaluated + Then value is celpy.celtypes.UintType(source=30) - When CEL expression "42u % 5u" is evaluated - # uint64_value:2 - Then value is UintType(source=2) +Scenario: uint64_math/mod + When CEL expression '42u % 5u' is evaluated + Then value is celpy.celtypes.UintType(source=2) -Scenario: negtive_no_overload +Scenario: uint64_math/negative_no_overload - When CEL expression "-(5u)" is evaluated - # errors:{message:"no such overload"} + Given disable_check parameter is True + When CEL expression '-(5u)' is evaluated Then eval_error is 'no such overload' +Scenario: uint64_math/mod_zero -Scenario: mod_zero - - When CEL expression "34u % 0u" is evaluated - # errors:{message:"modulus by zero"} + When CEL expression '34u % 0u' is evaluated Then eval_error is 'modulus by zero' +Scenario: uint64_math/divide_zero -Scenario: divide_zero - - When CEL expression "15u / 0u" is evaluated - # errors:{message:"divide by zero"} + When CEL expression '15u / 0u' is evaluated Then eval_error is 'divide by zero' +Scenario: uint64_math/multiply_zero -Scenario: multiply_zero - - When CEL expression "15u * 0u" is evaluated - # uint64_value:0 - Then value is UintType(source=0) - - -Scenario: add_left_identity - - When CEL expression "0u + 17u" is evaluated - # uint64_value:17 - Then value is UintType(source=17) - - -Scenario: add_right_identity - - When CEL expression " 29u + 0u" is evaluated - # uint64_value:29 - Then value is UintType(source=29) - - -Scenario: add_commutative + When CEL expression '15u * 0u' is evaluated + Then value is celpy.celtypes.UintType(source=0) - When CEL expression "75u + 15u == 15u + 75u" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: uint64_math/add_left_identity + When CEL expression '0u + 17u' is evaluated + Then value is celpy.celtypes.UintType(source=17) -Scenario: add_associative +Scenario: uint64_math/add_right_identity - When CEL expression "5u + (15u + 20u) == (5u + 15u) + 20u" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression ' 29u + 0u' is evaluated + Then value is celpy.celtypes.UintType(source=29) +Scenario: uint64_math/add_commutative -Scenario: mul_left_identity + When CEL expression '75u + 15u == 15u + 75u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "1u * 45u" is evaluated - # uint64_value:45 - Then value is UintType(source=45) +Scenario: uint64_math/add_associative + When CEL expression '5u + (15u + 20u) == (5u + 15u) + 20u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: mul_right_identity +Scenario: uint64_math/mul_left_identity - When CEL expression "25u * 1u" is evaluated - # uint64_value:25 - Then value is UintType(source=25) + When CEL expression '1u * 45u' is evaluated + Then value is celpy.celtypes.UintType(source=45) +Scenario: uint64_math/mul_right_identity -Scenario: mul_commutative + When CEL expression '25u * 1u' is evaluated + Then value is celpy.celtypes.UintType(source=25) - When CEL expression "15u * 25u == 25u * 15u" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: uint64_math/mul_commutative + When CEL expression '15u * 25u == 25u * 15u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: mul_associative +Scenario: uint64_math/mul_associative - When CEL expression "15u * (23u * 88u) == (15u * 23u) * 88u" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression '15u * (23u * 88u) == (15u * 23u) * 88u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: uint64_math/add_mul_distribute -Scenario: add_mul_distribute + When CEL expression '5u * (15u + 25u) == 5u * 15u + 5u * 25u' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "5u * (15u + 25u) == 5u * 15u + 5u * 25u" is evaluated - # bool_value:true - Then value is BoolType(source=True) diff --git a/features/integer_math.textproto b/features/integer_math.textproto index 4662ac0..c0d4f51 100644 --- a/features/integer_math.textproto +++ b/features/integer_math.textproto @@ -1,3 +1,6 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: cel.expr.conformance.test.SimpleTestFile + name: "integer_math" description: "Tests for int and uint math." section { @@ -117,7 +120,7 @@ section { } } test { - name: "negtive_zero" + name: "negative_zero" expr: "-(0)" value: { int64_value: 0 } } @@ -199,6 +202,22 @@ section { errors: { message: "return error for overflow" } } } + test { + name: "int64_overflow_add_negative" + description: "negative overflow via addition" + expr: "-9223372036854775808 + (-1)" + eval_error: { + errors: { message: "return error for overflow" } + } + } + test { + name: "int64_overflow_sub_positive" + description: "positive overflow via subtraction" + expr: "1 - (-9223372036854775807)" + eval_error: { + errors: { message: "return error for overflow" } + } + } test { name: "int64_min_negate" description: "Negated LLONG_MIN is not representable." @@ -207,6 +226,38 @@ section { errors: { message: "return error for overflow" } } } + test { + name: "int64_min_negate_mul" + description: "Negate LLONG_MIN via multiplication" + expr: "(-9223372036854775808) * -1" + eval_error: { + errors: { message: "return error for overflow" } + } + } + test { + name: "int64_min_negate_div" + description: "Negate LLONG_MIN via division." + expr: "(-9223372036854775808)/-1" + eval_error: { + errors: { message: "return error for overflow" } + } + } + test { + name: "int64_overflow_mul_positive" + description: "Overflow via multiplication." + expr: "5000000000 * 5000000000" + eval_error: { + errors: { message: "return error for overflow" } + } + } + test { + name: "int64_overflow_mul_negative" + description: "Overflow via multiplication." + expr: "(-5000000000) * 5000000000" + eval_error: { + errors: { message: "return error for overflow" } + } + } test { name: "uint64_overflow_positive" description: "ULLONG_MAX plus one." @@ -214,8 +265,6 @@ section { eval_error: { errors: { message: "return error for overflow" } } - ## Current behavior: - ## value: { uint64_value: 0 } } test { name: "uint64_overflow_negative" @@ -224,8 +273,14 @@ section { eval_error: { errors: { message: "return error for overflow" } } - ## Current behavior: - ## value: { uint64_value: 18446744073709551615 } + } + test { + name: "uint64_overflow_mul_positive" + description: "Overflow via multiplication." + expr: "5000000000u * 5000000000u" + eval_error: { + errors: { message: "return error for overflow" } + } } } section { @@ -257,7 +312,7 @@ section { value: { uint64_value: 2 } } test { - name: "negtive_no_overload" + name: "negative_no_overload" expr: "-(5u)" disable_check: true eval_error: { diff --git a/features/lists.feature b/features/lists.feature index 0cff81c..83fadf6 100644 --- a/features/lists.feature +++ b/features/lists.feature @@ -1,160 +1,218 @@ - +@conformance Feature: lists Tests for list operations. -# concatentation -- Tests for list concatenation. -Scenario: list_append +# concatenation -- Tests for list concatenation. - When CEL expression "[0, 1, 2] + [3, 4, 5] == [0, 1, 2, 3, 4, 5]" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: concatenation/list_append + When CEL expression '[0, 1, 2] + [3, 4, 5] == [0, 1, 2, 3, 4, 5]' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: list_not_commutative +Scenario: concatenation/list_not_commutative - When CEL expression "[0, 1, 2] + [3, 4, 5] == [3, 4, 5, 0, 1, 2]" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression '[0, 1, 2] + [3, 4, 5] == [3, 4, 5, 0, 1, 2]' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: concatenation/list_repeat -Scenario: list_repeat + When CEL expression '[2] + [2]' is evaluated + Then value is [celpy.celtypes.IntType(source=2), celpy.celtypes.IntType(source=2)] - When CEL expression "[2] + [2]" is evaluated - # list_value:{values:{int64_value:2} values:{int64_value:2}} - Then value is [IntType(source=2), IntType(source=2)] +Scenario: concatenation/empty_empty + When CEL expression '[] + []' is evaluated + Then value is [] -Scenario: empty_empty +Scenario: concatenation/left_unit - When CEL expression "[] + []" is evaluated - # list_value:{} - Then value is [] + When CEL expression '[] + [3, 4]' is evaluated + Then value is [celpy.celtypes.IntType(source=3), celpy.celtypes.IntType(source=4)] +Scenario: concatenation/right_unit -Scenario: left_unit + When CEL expression '[1, 2] + []' is evaluated + Then value is [celpy.celtypes.IntType(source=1), celpy.celtypes.IntType(source=2)] - When CEL expression "[] + [3, 4]" is evaluated - # list_value:{values:{int64_value:3} values:{int64_value:4}} - Then value is [IntType(source=3), IntType(source=4)] +# index -- List indexing tests. -Scenario: right_unit +Scenario: index/zero_based - When CEL expression "[1, 2] + []" is evaluated - # list_value:{values:{int64_value:1} values:{int64_value:2}} - Then value is [IntType(source=1), IntType(source=2)] + When CEL expression '[7, 8, 9][0]' is evaluated + Then value is celpy.celtypes.IntType(source=7) +@wip +Scenario: index/zero_based_double + When CEL expression '[7, 8, 9][dyn(0.0)]' is evaluated + Then value is celpy.celtypes.IntType(source=7) -# index -- List indexing tests. +Scenario: index/zero_based_double_error -Scenario: zero_based + When CEL expression '[7, 8, 9][dyn(0.1)]' is evaluated + Then eval_error is 'invalid_argument' - When CEL expression "[7, 8, 9][0]" is evaluated - # int64_value:7 - Then value is IntType(source=7) +Scenario: index/zero_based_uint + When CEL expression '[7, 8, 9][dyn(0u)]' is evaluated + Then value is celpy.celtypes.IntType(source=7) -Scenario: singleton +Scenario: index/singleton When CEL expression "['foo'][0]" is evaluated - # string_value:"foo" - Then value is StringType(source='foo') + Then value is celpy.celtypes.StringType(source='foo') +Scenario: index/middle -Scenario: middle + When CEL expression '[0, 1, 1, 2, 3, 5, 8, 13][4]' is evaluated + Then value is celpy.celtypes.IntType(source=3) - When CEL expression "[0, 1, 1, 2, 3, 5, 8, 13][4]" is evaluated - # int64_value:3 - Then value is IntType(source=3) +Scenario: index/last + When CEL expression "['George', 'John', 'Paul', 'Ringo'][3]" is evaluated + Then value is celpy.celtypes.StringType(source='Ringo') -Scenario: last +Scenario: index/index_out_of_bounds - When CEL expression "['George', 'John', 'Paul', 'Ringo'][3]" is evaluated - # string_value:"Ringo" - Then value is StringType(source='Ringo') + When CEL expression '[1, 2, 3][3]' is evaluated + Then eval_error is 'invalid_argument' +Scenario: index/index_out_of_bounds_or_false -Scenario: range + When CEL expression 'dyn([1, 2, 3][3]) || false' is evaluated + Then eval_error is 'invalid_argument' - When CEL expression "[1, 2, 3][3]" is evaluated - # errors:{message:"invalid_argument"} +Scenario: index/index_out_of_bounds_or_true + + When CEL expression 'dyn([1, 2, 3][3]) || true' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: index/index_out_of_bounds_and_false + + When CEL expression 'dyn([1, 2, 3][3]) && false' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: index/index_out_of_bounds_and_true + + When CEL expression 'dyn([1, 2, 3][3]) && true' is evaluated Then eval_error is 'invalid_argument' +Scenario: index/bad_index_type + When CEL expression "[1, 2, 3][dyn('')]" is evaluated + Then eval_error is 'invalid_argument' -# in -- List membership tests. +Scenario: index/bad_index_type_or_false -Scenario: empty + When CEL expression "dyn([1, 2, 3][dyn('')]) || false" is evaluated + Then eval_error is 'invalid_argument' - When CEL expression "7 in []" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: index/bad_index_type_or_true + When CEL expression "dyn([1, 2, 3][dyn('')]) || true" is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: singleton +Scenario: index/bad_index_type_and_false - When CEL expression "4u in [4u]" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression "dyn([1, 2, 3][dyn('')]) && false" is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: index/bad_index_type_and_true -Scenario: first + When CEL expression "dyn([1, 2, 3][dyn('')]) && true" is evaluated + Then eval_error is 'invalid_argument' + + +# in -- List membership tests. + +Scenario: in/empty + + When CEL expression '7 in []' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: in/singleton + + When CEL expression '4u in [4u]' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: in/first When CEL expression "'alpha' in ['alpha', 'beta', 'gamma']" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Then value is celpy.celtypes.BoolType(source=True) +Scenario: in/middle -Scenario: middle + When CEL expression '3 in [5, 4, 3, 2, 1]' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "3 in [5, 4, 3, 2, 1]" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: in/last + When CEL expression '20u in [4u, 6u, 8u, 12u, 20u]' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: last +@wip +Scenario: in/double_in_ints - When CEL expression "20u in [4u, 6u, 8u, 12u, 20u]" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'dyn(3.0) in [5, 4, 3, 2, 1]' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +@wip +Scenario: in/uint_in_ints -Scenario: missing + When CEL expression 'dyn(3u) in [5, 4, 3, 2, 1]' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "'hawaiian' in ['meat', 'veggie', 'margarita', 'cheese']" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: in/int_in_doubles + When CEL expression 'dyn(3) in [5.0, 4.0, 3.0, 2.0, 1.0]' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +@wip +Scenario: in/uint_in_doubles -# size -- List and map size tests. + When CEL expression 'dyn(3u) in [5.0, 4.0, 3.0, 2.0, 1.0]' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: in/int_in_uints -Scenario: list_empty + When CEL expression 'dyn(3) in [5u, 4u, 3u, 2u, 1u]' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "size([])" is evaluated - # int64_value:0 - Then value is IntType(source=0) +@wip +Scenario: in/double_in_uints + When CEL expression 'dyn(3.0) in [5u, 4u, 3u, 2u, 1u]' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: list +Scenario: in/missing - When CEL expression "size([1, 2, 3])" is evaluated - # int64_value:3 - Then value is IntType(source=3) + When CEL expression "'hawaiian' in ['meat', 'veggie', 'margarita', 'cheese']" is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: map_empty +# size -- List and map size tests. + +Scenario: size/list_empty - When CEL expression "size({})" is evaluated - # int64_value:0 - Then value is IntType(source=0) + When CEL expression 'size([])' is evaluated + Then value is celpy.celtypes.IntType(source=0) +Scenario: size/list -Scenario: map + When CEL expression 'size([1, 2, 3])' is evaluated + Then value is celpy.celtypes.IntType(source=3) + +Scenario: size/map_empty + + When CEL expression 'size({})' is evaluated + Then value is celpy.celtypes.IntType(source=0) + +Scenario: size/map When CEL expression "size({1: 'one', 2: 'two', 3: 'three'})" is evaluated - # int64_value:3 - Then value is IntType(source=3) + Then value is celpy.celtypes.IntType(source=3) + diff --git a/features/lists.textproto b/features/lists.textproto index fdf1ac5..2148118 100644 --- a/features/lists.textproto +++ b/features/lists.textproto @@ -1,7 +1,10 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: cel.expr.conformance.test.SimpleTestFile + name: "lists" description: "Tests for list operations." section { - name: "concatentation" + name: "concatenation" description: "Tests for list concatenation." test { name: "list_append" @@ -57,6 +60,23 @@ section { expr: "[7, 8, 9][0]" value: { int64_value: 7 } } + test { + name: "zero_based_double" + expr: "[7, 8, 9][dyn(0.0)]" + value: { int64_value: 7 } + } + test { + name: "zero_based_double_error" + expr: "[7, 8, 9][dyn(0.1)]" + eval_error { + errors { message: "invalid_argument" } + } + } + test { + name: "zero_based_uint" + expr: "[7, 8, 9][dyn(0u)]" + value: { int64_value: 7 } + } test { name: "singleton" expr: "['foo'][0]" @@ -73,12 +93,67 @@ section { value: { string_value: "Ringo" } } test { - name: "range" + name: "index_out_of_bounds" expr: "[1, 2, 3][3]" eval_error { errors { message: "invalid_argument" } } } + test { + name: "index_out_of_bounds_or_false" + expr: "dyn([1, 2, 3][3]) || false" + eval_error { + errors { message: "invalid_argument" } + } + } + test { + name: "index_out_of_bounds_or_true" + expr: "dyn([1, 2, 3][3]) || true" + value: { bool_value: true } + } + test { + name: "index_out_of_bounds_and_false" + expr: "dyn([1, 2, 3][3]) && false" + value: { bool_value: false } + } + test { + name: "index_out_of_bounds_and_true" + expr: "dyn([1, 2, 3][3]) && true" + eval_error { + errors { message: "invalid_argument" } + } + } + test { + name: "bad_index_type" + expr: "[1, 2, 3][dyn('')]" + eval_error { + errors { message: "invalid_argument" } + } + } + test { + name: "bad_index_type_or_false" + expr: "dyn([1, 2, 3][dyn('')]) || false" + eval_error { + errors { message: "invalid_argument" } + } + } + test { + name: "bad_index_type_or_true" + expr: "dyn([1, 2, 3][dyn('')]) || true" + value: { bool_value: true } + } + test { + name: "bad_index_type_and_false" + expr: "dyn([1, 2, 3][dyn('')]) && false" + value: { bool_value: false } + } + test { + name: "bad_index_type_and_true" + expr: "dyn([1, 2, 3][dyn('')]) && true" + eval_error { + errors { message: "invalid_argument" } + } + } } section { name: "in" @@ -108,6 +183,36 @@ section { expr: "20u in [4u, 6u, 8u, 12u, 20u]" value: { bool_value: true } } + test { + name: "double_in_ints" + expr: "dyn(3.0) in [5, 4, 3, 2, 1]" + value: { bool_value: true } + } + test { + name: "uint_in_ints" + expr: "dyn(3u) in [5, 4, 3, 2, 1]" + value: { bool_value: true } + } + test { + name: "int_in_doubles" + expr: "dyn(3) in [5.0, 4.0, 3.0, 2.0, 1.0]" + value: { bool_value: true } + } + test { + name: "uint_in_doubles" + expr: "dyn(3u) in [5.0, 4.0, 3.0, 2.0, 1.0]" + value: { bool_value: true } + } + test { + name: "int_in_uints" + expr: "dyn(3) in [5u, 4u, 3u, 2u, 1u]" + value: { bool_value: true } + } + test { + name: "double_in_uints" + expr: "dyn(3.0) in [5u, 4u, 3u, 2u, 1u]" + value: { bool_value: true } + } test { name: "missing" expr: "'hawaiian' in ['meat', 'veggie', 'margarita', 'cheese']" diff --git a/features/logic.feature b/features/logic.feature index cd12265..b16b45a 100644 --- a/features/logic.feature +++ b/features/logic.feature @@ -1,223 +1,175 @@ - +@conformance Feature: logic Tests for logical special operators. -# conditional -- Tests for the conditional operator. -Scenario: true_case +# conditional -- Tests for the conditional operator. - When CEL expression "true ? 1 : 2" is evaluated - # int64_value:1 - Then value is IntType(source=1) +Scenario: conditional/true_case + When CEL expression 'true ? 1 : 2' is evaluated + Then value is celpy.celtypes.IntType(source=1) -Scenario: false_case +Scenario: conditional/false_case When CEL expression "false ? 'foo' : 'bar'" is evaluated - # string_value:"bar" - Then value is StringType(source='bar') - + Then value is celpy.celtypes.StringType(source='bar') -Scenario: error_case +Scenario: conditional/error_case When CEL expression "2 / 0 > 4 ? 'baz' : 'quux'" is evaluated - # errors:{message:"division by zero"} Then eval_error is 'division by zero' +Scenario: conditional/mixed_type -Scenario: mixed_type - + Given disable_check parameter is True When CEL expression "true ? 'cows' : 17" is evaluated - # string_value:"cows" - Then value is StringType(source='cows') - + Then value is celpy.celtypes.StringType(source='cows') -Scenario: bad_type +Scenario: conditional/bad_type + Given disable_check parameter is True When CEL expression "'cows' ? false : 17" is evaluated - # errors:{message:"no matching overload"} Then eval_error is 'no matching overload' - # AND -- Tests for logical AND. -Scenario: all_true - - When CEL expression "true && true" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: AND/all_true + When CEL expression 'true && true' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: all_false +Scenario: AND/all_false - When CEL expression "false && false" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression 'false && false' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: AND/false_left -Scenario: false_left + When CEL expression 'false && true' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "false && true" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: AND/false_right + When CEL expression 'true && false' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: false_right +Scenario: AND/short_circuit_type_left - When CEL expression "true && false" is evaluated - # bool_value:false - Then value is BoolType(source=False) + Given disable_check parameter is True + When CEL expression 'false && 32' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: AND/short_circuit_type_right -Scenario: short_circuit_type_left - - When CEL expression "false && 32" is evaluated - # bool_value:false - Then value is BoolType(source=False) - - -Scenario: short_circuit_type_right - + Given disable_check parameter is True When CEL expression "'horses' && false" is evaluated - # bool_value:false - Then value is BoolType(source=False) + Then value is celpy.celtypes.BoolType(source=False) +Scenario: AND/short_circuit_error_left -Scenario: short_circuit_error_left + When CEL expression 'false && (2 / 0 > 3 ? false : true)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "false && (2 / 0 > 3 ? false : true)" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: AND/short_circuit_error_right + When CEL expression '(2 / 0 > 3 ? false : true) && false' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: short_circuit_error_right +Scenario: AND/error_right - When CEL expression "(2 / 0 > 3 ? false : true) && false" is evaluated - # bool_value:false - Then value is BoolType(source=False) - - -Scenario: error_right - - When CEL expression "true && 1/0 != 0" is evaluated - # errors:{message:"no matching overload"} + When CEL expression 'true && 1/0 != 0' is evaluated Then eval_error is 'no matching overload' +Scenario: AND/error_left -Scenario: error_left - - When CEL expression "1/0 != 0 && true" is evaluated - # errors:{message:"no matching overload"} + When CEL expression '1/0 != 0 && true' is evaluated Then eval_error is 'no matching overload' +Scenario: AND/no_overload -Scenario: no_overload - + Given disable_check parameter is True When CEL expression "'less filling' && 'tastes great'" is evaluated - # errors:{message:"no matching overload"} Then eval_error is 'no matching overload' - # OR -- Tests for logical OR -Scenario: all_true - - When CEL expression "true || true" is evaluated - # bool_value:true - Then value is BoolType(source=True) - +Scenario: OR/all_true -Scenario: all_false + When CEL expression 'true || true' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "false || false" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: OR/all_false + When CEL expression 'false || false' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: false_left +Scenario: OR/false_left - When CEL expression "false || true" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'false || true' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: OR/false_right -Scenario: false_right + When CEL expression 'true || false' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "true || false" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: OR/short_circuit_type_left + Given disable_check parameter is True + When CEL expression 'true || 32' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: short_circuit_type_left - - When CEL expression "true || 32" is evaluated - # bool_value:true - Then value is BoolType(source=True) - - -Scenario: short_circuit_type_right +Scenario: OR/short_circuit_type_right + Given disable_check parameter is True When CEL expression "'horses' || true" is evaluated - # bool_value:true - Then value is BoolType(source=True) - + Then value is celpy.celtypes.BoolType(source=True) -Scenario: short_circuit_error_left +Scenario: OR/short_circuit_error_left - When CEL expression "true || (2 / 0 > 3 ? false : true)" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression 'true || (2 / 0 > 3 ? false : true)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: OR/short_circuit_error_right -Scenario: short_circuit_error_right + When CEL expression '(2 / 0 > 3 ? false : true) || true' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "(2 / 0 > 3 ? false : true) || true" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: OR/error_right - -Scenario: error_right - - When CEL expression "false || 1/0 != 0" is evaluated - # errors:{message:"no matching overload"} + When CEL expression 'false || 1/0 != 0' is evaluated Then eval_error is 'no matching overload' +Scenario: OR/error_left -Scenario: error_left - - When CEL expression "1/0 != 0 || false" is evaluated - # errors:{message:"no matching overload"} + When CEL expression '1/0 != 0 || false' is evaluated Then eval_error is 'no matching overload' +Scenario: OR/no_overload -Scenario: no_overload - + Given disable_check parameter is True When CEL expression "'less filling' || 'tastes great'" is evaluated - # errors:{message:"no matching overload"} Then eval_error is 'no matching overload' - # NOT -- Tests for logical NOT. -Scenario: not_true - - When CEL expression "!true" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: NOT/not_true + When CEL expression '!true' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: not_false +Scenario: NOT/not_false - When CEL expression "!false" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression '!false' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: NOT/no_overload -Scenario: no_overload - - When CEL expression "!0" is evaluated - # errors:{message:"no matching overload"} + Given disable_check parameter is True + When CEL expression '!0' is evaluated Then eval_error is 'no matching overload' + diff --git a/features/logic.textproto b/features/logic.textproto index 42d9f7c..384e5ce 100644 --- a/features/logic.textproto +++ b/features/logic.textproto @@ -1,3 +1,6 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: google.api.expr.test.v1.SimpleTestFile + name: "logic" description: "Tests for logical special operators." section { diff --git a/features/macros.feature b/features/macros.feature index 2a1a759..2742b40 100644 --- a/features/macros.feature +++ b/features/macros.feature @@ -1,313 +1,251 @@ - +@conformance Feature: macros Tests for CEL macros. -# exists -- Tests for the .exists() macro, which is equivalent to joining the evaluated elements with logical-OR. - -Scenario: list_elem_all_true - When CEL expression "[1, 2, 3].exists(e, e > 0)" is evaluated - # bool_value:true - Then value is BoolType(source=True) +# exists -- Tests for the .exists() macro, which is equivalent to joining the evaluated elements with logical-OR. +Scenario: exists/list_elem_all_true -Scenario: list_elem_some_true + When CEL expression '[1, 2, 3].exists(e, e > 0)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "[1, 2, 3].exists(e, e == 2)" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: exists/list_elem_some_true + When CEL expression '[1, 2, 3].exists(e, e == 2)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: list_elem_none_true +Scenario: exists/list_elem_none_true - When CEL expression "[1, 2, 3].exists(e, e > 3)" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression '[1, 2, 3].exists(e, e > 3)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: exists/list_elem_type_shortcircuit + Exists filter is true for the last element. -Scenario: list_elem_type_shortcircuit - Exists filter is true for the last element, thus short-circuits after 'err || true' When CEL expression "[1, 'foo', 3].exists(e, e != '1')" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Then value is celpy.celtypes.BoolType(source=True) +@wip +Scenario: exists/list_elem_type_exhaustive + Exists filter is never true, but heterogenous equality ensure the + result is false. -Scenario: list_elem_type_exhaustive - Exists filter is never true, thus reduces to 'err || false || err' which is an error When CEL expression "[1, 'foo', 3].exists(e, e == '10')" is evaluated - # errors:{message:"no such overload"} - Then eval_error is 'no such overload' - + Then value is celpy.celtypes.BoolType(source=False) -Scenario: list_elem_all_error +Scenario: exists/list_elem_exists_error - When CEL expression "[1, 2, 3].exists(e, e / 0 == 17)" is evaluated - # errors:{message:"divide by zero"} + When CEL expression '[1, 2, 3].exists(e, e / 0 == 17)' is evaluated Then eval_error is 'divide by zero' +Scenario: exists/list_empty -Scenario: list_empty - - When CEL expression "[].exists(e, e == 2)" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression '[].exists(e, e == 2)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - -Scenario: map_key +Scenario: exists/map_key When CEL expression "{'key1':1, 'key2':2}.exists(k, k == 'key2')" is evaluated - # bool_value:true - Then value is BoolType(source=True) - + Then value is celpy.celtypes.BoolType(source=True) -Scenario: not_map_key +Scenario: exists/not_map_key When CEL expression "!{'key1':1, 'key2':2}.exists(k, k == 'key3')" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Then value is celpy.celtypes.BoolType(source=True) +Scenario: exists/map_key_type_shortcircuit + Exists filter is true for the second key -Scenario: map_key_type_shortcircuit - Exists filter is true for the second key, thus reduces to 'err || true' which is true When CEL expression "{'key':1, 1:21}.exists(k, k != 2)" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Then value is celpy.celtypes.BoolType(source=True) +@wip +Scenario: exists/map_key_type_exhaustive + Exists filter is never true, but heterogeneous equality ensures the + result is false. -Scenario: map_key_type_exhaustive - Exists filter is never true, thus reduces to 'err || false' which is an error When CEL expression "!{'key':1, 1:42}.exists(k, k == 2)" is evaluated - # errors:{message:"no such overload"} - Then eval_error is 'no such overload' - + Then value is celpy.celtypes.BoolType(source=True) # all -- Tests for the .all() macro, which is equivalent to joining the evaluated elements with logical-AND. -Scenario: list_elem_all_true - - When CEL expression "[1, 2, 3].all(e, e > 0)" is evaluated - # bool_value:true - Then value is BoolType(source=True) - +Scenario: all/list_elem_all_true -Scenario: list_elem_some_true + When CEL expression '[1, 2, 3].all(e, e > 0)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "[1, 2, 3].all(e, e == 2)" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: all/list_elem_some_true + When CEL expression '[1, 2, 3].all(e, e == 2)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: list_elem_none_true +Scenario: all/list_elem_none_true - When CEL expression "[1, 2, 3].all(e, e == 17)" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression '[1, 2, 3].all(e, e == 17)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - -Scenario: list_elem_type_shortcircuit +Scenario: all/list_elem_type_shortcircuit When CEL expression "[1, 'foo', 3].all(e, e == 1)" is evaluated - # bool_value:false - Then value is BoolType(source=False) - + Then value is celpy.celtypes.BoolType(source=False) -Scenario: list_elem_type_exhaustive +Scenario: all/list_elem_type_exhaustive When CEL expression "[1, 'foo', 3].all(e, e % 2 == 1)" is evaluated - # errors:{message:"no_such_overload"} Then eval_error is 'no_such_overload' +Scenario: all/list_elem_error_shortcircuit -Scenario: list_elem_error_shortcircuit - - When CEL expression "[1, 2, 3].all(e, 6 / (2 - e) == 6)" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression '[1, 2, 3].all(e, 6 / (2 - e) == 6)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: all/list_elem_error_exhaustive -Scenario: list_elem_error_exhaustive - - When CEL expression "[1, 2, 3].all(e, e / 0 != 17)" is evaluated - # errors:{message:"divide by zero"} + When CEL expression '[1, 2, 3].all(e, e / 0 != 17)' is evaluated Then eval_error is 'divide by zero' +Scenario: all/list_empty -Scenario: list_empty - - When CEL expression "[].all(e, e > 0)" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression '[].all(e, e > 0)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - -Scenario: map_key +Scenario: all/map_key When CEL expression "{'key1':1, 'key2':2}.all(k, k == 'key2')" is evaluated - # bool_value:false - Then value is BoolType(source=False) - + Then value is celpy.celtypes.BoolType(source=False) # exists_one -- Tests for exists_one() macro. An expression 'L.exists_one(I, E)' is equivalent to 'size(L.filter(I, E)) == 1'. -Scenario: list_empty - - When CEL expression "[].exists_one(a, a == 7)" is evaluated - # bool_value:false - Then value is BoolType(source=False) - - -Scenario: list_one_true +Scenario: exists_one/list_empty - When CEL expression "[7].exists_one(a, a == 7)" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression '[].exists_one(a, a == 7)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: exists_one/list_one_true -Scenario: list_one_false + When CEL expression '[7].exists_one(a, a == 7)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "[8].exists_one(a, a == 7)" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: exists_one/list_one_false + When CEL expression '[8].exists_one(a, a == 7)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: list_none +Scenario: exists_one/list_none - When CEL expression "[1, 2, 3].exists_one(x, x > 20)" is evaluated - # bool_value:false - Then value is BoolType(source=False) + When CEL expression '[1, 2, 3].exists_one(x, x > 20)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: exists_one/list_one -Scenario: list_one + When CEL expression '[6, 7, 8].exists_one(foo, foo % 5 == 2)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "[6, 7, 8].exists_one(foo, foo % 5 == 2)" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: exists_one/list_many + When CEL expression '[0, 1, 2, 3, 4].exists_one(n, n % 2 == 1)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: list_many - - When CEL expression "[0, 1, 2, 3, 4].exists_one(n, n % 2 == 1)" is evaluated - # bool_value:false - Then value is BoolType(source=False) - - -Scenario: list_all +Scenario: exists_one/list_all When CEL expression "['foal', 'foo', 'four'].exists_one(n, n.startsWith('fo'))" is evaluated - # bool_value:false - Then value is BoolType(source=False) + Then value is celpy.celtypes.BoolType(source=False) - -Scenario: list_no_shortcircuit +Scenario: exists_one/list_no_shortcircuit Errors invalidate everything, even if already false. - When CEL expression "[3, 2, 1, 0].exists_one(n, 12 / n > 1)" is evaluated - # errors:{message:"divide by zero"} - Then eval_error is 'divide by zero' + When CEL expression '[3, 2, 1, 0].exists_one(n, 12 / n > 1)' is evaluated + Then eval_error is 'divide by zero' -Scenario: map_one +Scenario: exists_one/map_one When CEL expression "{6: 'six', 7: 'seven', 8: 'eight'}.exists_one(foo, foo % 5 == 2)" is evaluated - # bool_value:true - Then value is BoolType(source=True) - + Then value is celpy.celtypes.BoolType(source=True) # map -- Tests for map() macro. -Scenario: list_empty +Scenario: map/list_empty - When CEL expression "[].map(n, n / 2)" is evaluated - # list_value:{} + When CEL expression '[].map(n, n / 2)' is evaluated Then value is [] +Scenario: map/list_one -Scenario: list_one - - When CEL expression "[3].map(n, n * n)" is evaluated - # list_value:{values:{int64_value:9}} - Then value is [IntType(source=9)] - - -Scenario: list_many + When CEL expression '[3].map(n, n * n)' is evaluated + Then value is [celpy.celtypes.IntType(source=9)] - When CEL expression "[2, 4, 6].map(n, n / 2)" is evaluated - # list_value:{values:{int64_value:1} values:{int64_value:2} values:{int64_value:3}} - Then value is [IntType(source=1), IntType(source=2), IntType(source=3)] +Scenario: map/list_many + When CEL expression '[2, 4, 6].map(n, n / 2)' is evaluated + Then value is [celpy.celtypes.IntType(source=1), celpy.celtypes.IntType(source=2), celpy.celtypes.IntType(source=3)] -Scenario: list_error +Scenario: map/list_error - When CEL expression "[2, 1, 0].map(n, 4 / n)" is evaluated - # errors:{message:"divide by zero"} + When CEL expression '[2, 1, 0].map(n, 4 / n)' is evaluated Then eval_error is 'divide by zero' +Scenario: map/map_extract_keys + + When CEL expression "{'John': 'smart'}.map(key, key) == ['John']" is evaluated + Then value is celpy.celtypes.BoolType(source=True) # filter -- Tests for filter() macro. -Scenario: list_empty +Scenario: filter/list_empty - When CEL expression "[].filter(n, n % 2 == 0)" is evaluated - # list_value:{} + When CEL expression '[].filter(n, n % 2 == 0)' is evaluated Then value is [] +Scenario: filter/list_one_true -Scenario: list_one_true - - When CEL expression "[2].filter(n, n == 2)" is evaluated - # list_value:{values:{int64_value:2}} - Then value is [IntType(source=2)] - + When CEL expression '[2].filter(n, n == 2)' is evaluated + Then value is [celpy.celtypes.IntType(source=2)] -Scenario: list_one_false +Scenario: filter/list_one_false - When CEL expression "[1].filter(n, n > 3)" is evaluated - # list_value:{} + When CEL expression '[1].filter(n, n > 3)' is evaluated Then value is [] +Scenario: filter/list_none -Scenario: list_none - - When CEL expression "[1, 2, 3].filter(e, e > 3)" is evaluated - # list_value:{} + When CEL expression '[1, 2, 3].filter(e, e > 3)' is evaluated Then value is [] +Scenario: filter/list_some -Scenario: list_some - - When CEL expression "[0, 1, 2, 3, 4].filter(x, x % 2 == 1)" is evaluated - # list_value:{values:{int64_value:1} values:{int64_value:3}} - Then value is [IntType(source=1), IntType(source=3)] + When CEL expression '[0, 1, 2, 3, 4].filter(x, x % 2 == 1)' is evaluated + Then value is [celpy.celtypes.IntType(source=1), celpy.celtypes.IntType(source=3)] +Scenario: filter/list_all -Scenario: list_all + When CEL expression '[1, 2, 3].filter(n, n > 0)' is evaluated + Then value is [celpy.celtypes.IntType(source=1), celpy.celtypes.IntType(source=2), celpy.celtypes.IntType(source=3)] - When CEL expression "[1, 2, 3].filter(n, n > 0)" is evaluated - # list_value:{values:{int64_value:1} values:{int64_value:2} values:{int64_value:3}} - Then value is [IntType(source=1), IntType(source=2), IntType(source=3)] +Scenario: filter/list_no_shortcircuit - -Scenario: list_no_shortcircuit - - When CEL expression "[3, 2, 1, 0].filter(n, 12 / n > 4)" is evaluated - # errors:{message:"divide by zero"} + When CEL expression '[3, 2, 1, 0].filter(n, 12 / n > 4)' is evaluated Then eval_error is 'divide by zero' +Scenario: filter/map_filter_keys + + When CEL expression "{'John': 'smart', 'Paul': 'cute', 'George': 'quiet', 'Ringo': 'funny'}.filter(key, key == 'Ringo') == ['Ringo']" is evaluated + Then value is celpy.celtypes.BoolType(source=True) # nested -- Tests with nested macros. -Scenario: filter_all +Scenario: nested/filter_all When CEL expression "['signer'].filter(signer, ['artifact'].all(artifact, true))" is evaluated - # list_value:{values:{string_value:"signer"}} - Then value is [StringType(source='signer')] + Then value is [celpy.celtypes.StringType(source='signer')] - -Scenario: all_all +Scenario: nested/all_all When CEL expression "['signer'].all(signer, ['artifact'].all(artifact, true))" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Then value is celpy.celtypes.BoolType(source=True) + diff --git a/features/macros.textproto b/features/macros.textproto index 389b7bb..26a201f 100644 --- a/features/macros.textproto +++ b/features/macros.textproto @@ -1,3 +1,6 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: google.api.expr.test.v1.SimpleTestFile + name: "macros" description: "Tests for CEL macros." section { @@ -20,20 +23,18 @@ section { } test { name: "list_elem_type_shortcircuit" - description: "Exists filter is true for the last element, thus short-circuits after 'err || true'" + description: "Exists filter is true for the last element." expr: "[1, 'foo', 3].exists(e, e != '1')" value: { bool_value: true } } test { name: "list_elem_type_exhaustive" - description: "Exists filter is never true, thus reduces to 'err || false || err' which is an error" + description: "Exists filter is never true, but heterogenous equality ensure the result is false." expr: "[1, 'foo', 3].exists(e, e == '10')" - eval_error: { - errors: { message: "no such overload" } - } + value: { bool_value: false } } test { - name: "list_elem_all_error" + name: "list_elem_exists_error" expr: "[1, 2, 3].exists(e, e / 0 == 17)" eval_error: { errors: { message: "divide by zero" } @@ -56,17 +57,15 @@ section { } test { name: "map_key_type_shortcircuit" - description: "Exists filter is true for the second key, thus reduces to 'err || true' which is true" + description: "Exists filter is true for the second key" expr: "{'key':1, 1:21}.exists(k, k != 2)" value: { bool_value: true } } test { name: "map_key_type_exhaustive" - description: "Exists filter is never true, thus reduces to 'err || false' which is an error" + description: "Exists filter is never true, but heterogeneous equality ensures the result is false." expr: "!{'key':1, 1:42}.exists(k, k == 2)" - eval_error: { - errors: { message: "no such overload" } - } + value: { bool_value: true } } } section { @@ -207,7 +206,11 @@ section { errors: { message: "divide by zero" } } } - # The map() macro is currently not supported for maps. + test { + name: "map_extract_keys" + expr: "{'John': 'smart'}.map(key, key) == ['John']" + value: { bool_value: true } + } } section { name: "filter" @@ -261,7 +264,11 @@ section { errors: { message: "divide by zero" } } } - # The filter() macro is currently not supported for maps. + test { + name: "map_filter_keys" + expr: "{'John': 'smart', 'Paul': 'cute', 'George': 'quiet', 'Ringo': 'funny'}.filter(key, key == 'Ringo') == ['Ringo']" + value: { bool_value: true } + } } section { name: "nested" diff --git a/features/macros2.feature b/features/macros2.feature new file mode 100644 index 0000000..5658c7d --- /dev/null +++ b/features/macros2.feature @@ -0,0 +1,290 @@ +@conformance +Feature: macros2 + Tests for CEL comprehensions v2 + + +# exists -- Tests for the .exists() macro, which is equivalent to joining the evaluated elements with logical-OR. + +@wip +Scenario: exists/list_elem_all_true + + When CEL expression '[1, 2, 3].exists(i, v, i > -1 && v > 0)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: exists/list_elem_some_true + + When CEL expression '[1, 2, 3].exists(i, v, i == 1 && v == 2)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: exists/list_elem_none_true + + When CEL expression '[1, 2, 3].exists(i, v, i > 2 && v > 3)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: exists/list_elem_type_shortcircuit + + When CEL expression "[1, 'foo', 3].exists(i, v, i == 1 && v != '1')" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: exists/list_elem_type_exhaustive + + When CEL expression "[1, 'foo', 3].exists(i, v, i == 3 || v == '10')" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: exists/list_elem_exists_error + + When CEL expression '[1, 2, 3].exists(i, v, v / i == 17)' is evaluated + Then eval_error is 'divide by zero' + +@wip +Scenario: exists/list_empty + + When CEL expression '[].exists(i, v, i == 0 || v == 2)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: exists/map_key + + When CEL expression "{'key1':1, 'key2':2}.exists(k, v, k == 'key2' && v == 2)" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: exists/not_map_key + + When CEL expression "!{'key1':1, 'key2':2}.exists(k, v, k == 'key3' || v == 3)" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: exists/map_key_type_shortcircuit + + When CEL expression "{'key':1, 1:21}.exists(k, v, k != 2 && v != 22)" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: exists/map_key_type_exhaustive + + When CEL expression "!{'key':1, 1:42}.exists(k, v, k == 2 && v == 43)" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + + +# all -- Tests for the .all() macro, which is equivalent to joining the evaluated elements with logical-AND. + +@wip +Scenario: all/list_elem_all_true + + When CEL expression '[1, 2, 3].all(i, v, i > -1 && v > 0)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: all/list_elem_some_true + + When CEL expression '[1, 2, 3].all(i, v, i == 1 && v == 2)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: all/list_elem_none_true + + When CEL expression '[1, 2, 3].all(i, v, i == 3 || v == 4)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: all/list_elem_type_shortcircuit + + When CEL expression "[1, 'foo', 3].all(i, v, i == 0 || v == 1)" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: all/list_elem_type_exhaustive + + When CEL expression "[0, 'foo', 3].all(i, v, v % 2 == i)" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: all/list_elem_type_error_exhaustive + + When CEL expression "[0, 'foo', 5].all(i, v, v % 3 == i)" is evaluated + Then eval_error is 'no_such_overload' + +@wip +Scenario: all/list_elem_error_shortcircuit + + When CEL expression '[1, 2, 3].all(i, v, 6 / (2 - v) == i)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: all/list_elem_error_exhaustive + + When CEL expression '[1, 2, 3].all(i, v, v / i != 17)' is evaluated + Then eval_error is 'divide by zero' + +@wip +Scenario: all/list_empty + + When CEL expression '[].all(i, v, i > -1 || v > 0)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: all/map_key + + When CEL expression "{'key1':1, 'key2':2}.all(k, v, k == 'key2' && v == 2)" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + + +# existsOne -- Tests for existsOne() macro. An expression 'L.existsOne(I, E)' is equivalent to 'size(L.filter(I, E)) == 1'. + +@wip +Scenario: existsOne/list_empty + + When CEL expression '[].existsOne(i, v, i == 3 || v == 7)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: existsOne/list_one_true + + When CEL expression '[7].existsOne(i, v, i == 0 && v == 7)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: existsOne/list_one_false + + When CEL expression '[8].existsOne(i, v, i == 0 && v == 7)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: existsOne/list_none + + When CEL expression '[1, 2, 3].existsOne(i, v, i > 2 || v > 3)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: existsOne/list_one + + When CEL expression '[5, 7, 8].existsOne(i, v, v % 5 == i)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: existsOne/list_many + + When CEL expression '[0, 1, 2, 3, 4].existsOne(i, v, v % 2 == i)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: existsOne/list_all + + When CEL expression "['foal', 'foo', 'four'].existsOne(i, v, i > -1 && v.startsWith('fo'))" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: existsOne/list_no_shortcircuit + + When CEL expression '[3, 2, 1, 0].existsOne(i, v, v / i > 1)' is evaluated + Then eval_error is 'divide by zero' + +@wip +Scenario: existsOne/map_one + + When CEL expression "{6: 'six', 7: 'seven', 8: 'eight'}.existsOne(k, v, k % 5 == 2 && v == 'seven')" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + + +# transformList -- Tests for transformList() macro. + +@wip +Scenario: transformList/empty + + When CEL expression '[].transformList(i, v, i / v)' is evaluated + Then value is [] + +@wip +Scenario: transformList/empty_filter + + When CEL expression '[].transformList(i, v, i > v, i / v)' is evaluated + Then value is [] + +@wip +Scenario: transformList/one + + When CEL expression '[3].transformList(i, v, v * v + i)' is evaluated + Then value is [celpy.celtypes.IntType(source=9)] + +@wip +Scenario: transformList/one_filter + + When CEL expression '[3].transformList(i, v, i == 0 && v == 3, v * v + i)' is evaluated + Then value is [celpy.celtypes.IntType(source=9)] + +@wip +Scenario: transformList/many + + When CEL expression '[2, 4, 6].transformList(i, v, v / 2 + i)' is evaluated + Then value is [celpy.celtypes.IntType(source=1), celpy.celtypes.IntType(source=3), celpy.celtypes.IntType(source=5)] + +@wip +Scenario: transformList/many_filter + + When CEL expression '[2, 4, 6].transformList(i, v, i != 1 && v != 4, v / 2 + i)' is evaluated + Then value is [celpy.celtypes.IntType(source=1), celpy.celtypes.IntType(source=5)] + +Scenario: transformList/error + + When CEL expression '[2, 1, 0].transformList(i, v, v / i)' is evaluated + Then eval_error is 'divide by zero' + +Scenario: transformList/error_filter + + When CEL expression '[2, 1, 0].transformList(i, v, v / i > 0, v)' is evaluated + Then eval_error is 'divide by zero' + + +# transformMap -- Tests for transformMap() macro. + +@wip +Scenario: transformMap/empty + + When CEL expression '{}.transformMap(k, v, k + v)' is evaluated + Then value is celpy.celtypes.MapType({}) + +@wip +Scenario: transformMap/empty_filter + + When CEL expression "{}.transformMap(k, v, k == 'foo' && v == 'bar', k + v)" is evaluated + Then value is celpy.celtypes.MapType({}) + +@wip +Scenario: transformMap/one + + When CEL expression "{'foo': 'bar'}.transformMap(k, v, k + v)" is evaluated + Then value is celpy.celtypes.MapType({'foo': celpy.celtypes.StringType(source='foobar')}) + +@wip +Scenario: transformMap/one_filter + + When CEL expression "{'foo': 'bar'}.transformMap(k, v, k == 'foo' && v == 'bar', k + v)" is evaluated + Then value is celpy.celtypes.MapType({'foo': celpy.celtypes.StringType(source='foobar')}) + +@wip +Scenario: transformMap/many + + When CEL expression "{'foo': 'bar', 'baz': 'bux', 'hello': 'world'}.transformMap(k, v, k + v)" is evaluated + Then value is celpy.celtypes.MapType({'foo': celpy.celtypes.StringType(source='foobar'), 'baz': celpy.celtypes.StringType(source='bazbux'), 'hello': celpy.celtypes.StringType(source='helloworld')}) + +@wip +Scenario: transformMap/many_filter + + When CEL expression "{'foo': 'bar', 'baz': 'bux', 'hello': 'world'}.transformMap(k, v, k != 'baz' && v != 'bux', k + v)" is evaluated + Then value is celpy.celtypes.MapType({'foo': celpy.celtypes.StringType(source='foobar'), 'hello': celpy.celtypes.StringType(source='helloworld')}) + +Scenario: transformMap/error + + When CEL expression "{'foo': 2, 'bar': 1, 'baz': 0}.transformMap(k, v, 4 / v)" is evaluated + Then eval_error is 'divide by zero' + +Scenario: transformMap/error_filter + + When CEL expression "{'foo': 2, 'bar': 1, 'baz': 0}.transformMap(k, v, k == 'baz' && 4 / v == 0, v)" is evaluated + Then eval_error is 'divide by zero' + diff --git a/features/macros2.textproto b/features/macros2.textproto new file mode 100644 index 0000000..a3f9301 --- /dev/null +++ b/features/macros2.textproto @@ -0,0 +1,354 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: google.api.expr.test.v1.SimpleTestFile + +name: "macros2" +description: "Tests for CEL comprehensions v2" +section { + name: "exists" + description: "Tests for the .exists() macro, which is equivalent to joining the evaluated elements with logical-OR." + test { + name: "list_elem_all_true" + expr: "[1, 2, 3].exists(i, v, i > -1 && v > 0)" + value: { bool_value: true } + } + test { + name: "list_elem_some_true" + expr: "[1, 2, 3].exists(i, v, i == 1 && v == 2)" + value: { bool_value: true } + } + test { + name: "list_elem_none_true" + expr: "[1, 2, 3].exists(i, v, i > 2 && v > 3)" + value: { bool_value: false } + } + test { + name: "list_elem_type_shortcircuit" + expr: "[1, 'foo', 3].exists(i, v, i == 1 && v != '1')" + value: { bool_value: true } + } + test { + name: "list_elem_type_exhaustive" + expr: "[1, 'foo', 3].exists(i, v, i == 3 || v == '10')" + value: { bool_value: false } + } + test { + name: "list_elem_exists_error" + expr: "[1, 2, 3].exists(i, v, v / i == 17)" + eval_error: { + errors: { message: "divide by zero" } + } + } + test { + name: "list_empty" + expr: "[].exists(i, v, i == 0 || v == 2)" + value: { bool_value: false } + } + test { + name: "map_key" + expr: "{'key1':1, 'key2':2}.exists(k, v, k == 'key2' && v == 2)" + value: { bool_value: true } + } + test { + name: "not_map_key" + expr: "!{'key1':1, 'key2':2}.exists(k, v, k == 'key3' || v == 3)" + value: { bool_value: true } + } + test { + name: "map_key_type_shortcircuit" + expr: "{'key':1, 1:21}.exists(k, v, k != 2 && v != 22)" + value: { bool_value: true } + } + test { + name: "map_key_type_exhaustive" + expr: "!{'key':1, 1:42}.exists(k, v, k == 2 && v == 43)" + value: { bool_value: true } + } +} +section { + name: "all" + description: "Tests for the .all() macro, which is equivalent to joining the evaluated elements with logical-AND." + test { + name: "list_elem_all_true" + expr: "[1, 2, 3].all(i, v, i > -1 && v > 0)" + value: { bool_value: true } + } + test { + name: "list_elem_some_true" + expr: "[1, 2, 3].all(i, v, i == 1 && v == 2)" + value: { bool_value: false } + } + test { + name: "list_elem_none_true" + expr: "[1, 2, 3].all(i, v, i == 3 || v == 4)" + value: { bool_value: false } + } + test { + name: "list_elem_type_shortcircuit" + expr: "[1, 'foo', 3].all(i, v, i == 0 || v == 1)" + value: { bool_value: false } + } + test { + name: "list_elem_type_exhaustive" + expr: "[0, 'foo', 3].all(i, v, v % 2 == i)" + value: { bool_value: false } + } + test { + name: "list_elem_type_error_exhaustive" + expr: "[0, 'foo', 5].all(i, v, v % 3 == i)" + eval_error: { + errors: { message: "no_such_overload" } + } + } + test { + name: "list_elem_error_shortcircuit" + expr: "[1, 2, 3].all(i, v, 6 / (2 - v) == i)" + value: { bool_value: false } + } + test { + name: "list_elem_error_exhaustive" + expr: "[1, 2, 3].all(i, v, v / i != 17)" + eval_error: { + errors: { message: "divide by zero" } + } + } + test { + name: "list_empty" + expr: "[].all(i, v, i > -1 || v > 0)" + value: { bool_value: true } + } + test { + name: "map_key" + expr: "{'key1':1, 'key2':2}.all(k, v, k == 'key2' && v == 2)" + value: { bool_value: false } + } +} +section { + name: "existsOne" + description: "Tests for existsOne() macro. An expression 'L.existsOne(I, E)' is equivalent to 'size(L.filter(I, E)) == 1'." + test { + name: "list_empty" + expr: "[].existsOne(i, v, i == 3 || v == 7)" + value: { bool_value: false } + } + test { + name: "list_one_true" + expr: "[7].existsOne(i, v, i == 0 && v == 7)" + value: { bool_value: true } + } + test { + name: "list_one_false" + expr: "[8].existsOne(i, v, i == 0 && v == 7)" + value: { bool_value: false } + } + test { + name: "list_none" + expr: "[1, 2, 3].existsOne(i, v, i > 2 || v > 3)" + value: { bool_value: false } + } + test { + name: "list_one" + expr: "[5, 7, 8].existsOne(i, v, v % 5 == i)" + value: { bool_value: true } + } + test { + name: "list_many" + expr: "[0, 1, 2, 3, 4].existsOne(i, v, v % 2 == i)" + value: { bool_value: false } + } + test { + name: "list_all" + expr: "['foal', 'foo', 'four'].existsOne(i, v, i > -1 && v.startsWith('fo'))" + value: { bool_value: false } + } + test { + name: "list_no_shortcircuit" + expr: "[3, 2, 1, 0].existsOne(i, v, v / i > 1)" + eval_error { + errors: { message: "divide by zero" } + } + } + test { + name: "map_one" + expr: "{6: 'six', 7: 'seven', 8: 'eight'}.existsOne(k, v, k % 5 == 2 && v == 'seven')" + value: { bool_value: true } + } +} +section { + name: "transformList" + description: "Tests for transformList() macro." + test { + name: "empty" + expr: "[].transformList(i, v, i / v)" + value: { list_value: {} } + } + test { + name: "empty_filter" + expr: "[].transformList(i, v, i > v, i / v)" + value: { list_value: {} } + } + test { + name: "one" + expr: "[3].transformList(i, v, v * v + i)" + value: { list_value { + values: { int64_value: 9 } + } + } + } + test { + name: "one_filter" + expr: "[3].transformList(i, v, i == 0 && v == 3, v * v + i)" + value: { list_value { + values: { int64_value: 9 } + } + } + } + test { + name: "many" + expr: "[2, 4, 6].transformList(i, v, v / 2 + i)" + value: { list_value { + values: { int64_value: 1 } + values: { int64_value: 3 } + values: { int64_value: 5 } + } + } + } + test { + name: "many_filter" + expr: "[2, 4, 6].transformList(i, v, i != 1 && v != 4, v / 2 + i)" + value: { list_value { + values: { int64_value: 1 } + values: { int64_value: 5 } + } + } + } + test { + name: "error" + expr: "[2, 1, 0].transformList(i, v, v / i)" + eval_error { + errors: { message: "divide by zero" } + } + } + test { + name: "error_filter" + expr: "[2, 1, 0].transformList(i, v, v / i > 0, v)" + eval_error { + errors: { message: "divide by zero" } + } + } +} +section { + name: "transformMap" + description: "Tests for transformMap() macro." + test { + name: "empty" + expr: "{}.transformMap(k, v, k + v)" + value: { map_value: {} } + } + test { + name: "empty_filter" + expr: "{}.transformMap(k, v, k == 'foo' && v == 'bar', k + v)" + value: { map_value: {} } + } + test { + name: "one" + expr: "{'foo': 'bar'}.transformMap(k, v, k + v)" + value: { + map_value: { + entries: { + key: { + string_value: "foo" + } + value: { + string_value: "foobar" + } + } + } + } + } + test { + name: "one_filter" + expr: "{'foo': 'bar'}.transformMap(k, v, k == 'foo' && v == 'bar', k + v)" + value: { + map_value: { + entries: { + key: { + string_value: "foo" + } + value: { + string_value: "foobar" + } + } + } + } + } + test { + name: "many" + expr: "{'foo': 'bar', 'baz': 'bux', 'hello': 'world'}.transformMap(k, v, k + v)" + value: { + map_value: { + entries: { + key: { + string_value: "foo" + } + value: { + string_value: "foobar" + } + } + entries: { + key: { + string_value: "baz" + } + value: { + string_value: "bazbux" + } + } + entries: { + key: { + string_value: "hello" + } + value: { + string_value: "helloworld" + } + } + } + } + } + test { + name: "many_filter" + expr: "{'foo': 'bar', 'baz': 'bux', 'hello': 'world'}.transformMap(k, v, k != 'baz' && v != 'bux', k + v)" + value: { + map_value: { + entries: { + key: { + string_value: "foo" + } + value: { + string_value: "foobar" + } + } + entries: { + key: { + string_value: "hello" + } + value: { + string_value: "helloworld" + } + } + } + } + } + test { + name: "error" + expr: "{'foo': 2, 'bar': 1, 'baz': 0}.transformMap(k, v, 4 / v)" + eval_error { + errors: { message: "divide by zero" } + } + } + test { + name: "error_filter" + expr: "{'foo': 2, 'bar': 1, 'baz': 0}.transformMap(k, v, k == 'baz' && 4 / v == 0, v)" + eval_error { + errors: { message: "divide by zero" } + } + } +} \ No newline at end of file diff --git a/features/math_ext.feature b/features/math_ext.feature new file mode 100644 index 0000000..c235a44 --- /dev/null +++ b/features/math_ext.feature @@ -0,0 +1,1244 @@ +@conformance +Feature: math_ext + Tests for the math extension library. + + +# greatest_int_result -- + +@wip +Scenario: greatest_int_result/unary_negative + + When CEL expression 'math.greatest(-5)' is evaluated + Then value is celpy.celtypes.IntType(source=-5) + +@wip +Scenario: greatest_int_result/unary_positive + + When CEL expression 'math.greatest(5)' is evaluated + Then value is celpy.celtypes.IntType(source=5) + +@wip +Scenario: greatest_int_result/binary_same_args + + When CEL expression 'math.greatest(1, 1)' is evaluated + Then value is celpy.celtypes.IntType(source=1) + +@wip +Scenario: greatest_int_result/binary_with_decimal + + When CEL expression 'math.greatest(1, 1.0) == 1' is evaluated + Then none is None + +@wip +Scenario: greatest_int_result/binary_with_uint + + When CEL expression 'math.greatest(1, 1u) == 1' is evaluated + Then none is None + +@wip +Scenario: greatest_int_result/binary_first_arg_greater + + When CEL expression 'math.greatest(3, -3)' is evaluated + Then value is celpy.celtypes.IntType(source=3) + +@wip +Scenario: greatest_int_result/binary_second_arg_greater + + When CEL expression 'math.greatest(-7, 5)' is evaluated + Then value is celpy.celtypes.IntType(source=5) + +@wip +Scenario: greatest_int_result/binary_first_arg_int_max + + When CEL expression 'math.greatest(9223372036854775807, 1)' is evaluated + Then value is celpy.celtypes.IntType(source=9223372036854775807) + +@wip +Scenario: greatest_int_result/binary_second_arg_int_max + + When CEL expression 'math.greatest(1, 9223372036854775807)' is evaluated + Then value is celpy.celtypes.IntType(source=9223372036854775807) + +@wip +Scenario: greatest_int_result/binary_first_arg_int_min + + When CEL expression 'math.greatest(-9223372036854775808, 1)' is evaluated + Then value is celpy.celtypes.IntType(source=1) + +@wip +Scenario: greatest_int_result/binary_second_arg_int_min + + When CEL expression 'math.greatest(1, -9223372036854775808)' is evaluated + Then value is celpy.celtypes.IntType(source=1) + +@wip +Scenario: greatest_int_result/ternary_same_args + + When CEL expression 'math.greatest(1, 1, 1) == 1' is evaluated + Then none is None + +@wip +Scenario: greatest_int_result/ternary_with_decimal + + When CEL expression 'math.greatest(1, 1.0, 1.0) == 1' is evaluated + Then none is None + +@wip +Scenario: greatest_int_result/ternary_with_uint + + When CEL expression 'math.greatest(1, 1u, 1u) == 1' is evaluated + Then none is None + +@wip +Scenario: greatest_int_result/ternary_first_arg_greatest + + When CEL expression 'math.greatest(10, 1, 3) == 10' is evaluated + Then none is None + +@wip +Scenario: greatest_int_result/ternary_third_arg_greatest + + When CEL expression 'math.greatest(1, 3, 10) == 10' is evaluated + Then none is None + +@wip +Scenario: greatest_int_result/ternary_with_negatives + + When CEL expression 'math.greatest(-1, -2, -3) == -1' is evaluated + Then none is None + +@wip +Scenario: greatest_int_result/ternary_int_max + + When CEL expression 'math.greatest(9223372036854775807, 1, 5) == 9223372036854775807' is evaluated + Then none is None + +@wip +Scenario: greatest_int_result/ternary_int_min + + When CEL expression 'math.greatest(-9223372036854775807, -1, -5) == -1' is evaluated + Then none is None + +@wip +Scenario: greatest_int_result/quaternary_mixed + + When CEL expression 'math.greatest(5.4, 10, 3u, -5.0, 9223372036854775807) == 9223372036854775807' is evaluated + Then none is None + +@wip +Scenario: greatest_int_result/quaternary_mixed_array + + When CEL expression 'math.greatest([5.4, 10, 3u, -5.0, 3.5]) == 10' is evaluated + Then none is None + +@wip +Scenario: greatest_int_result/quaternary_mixed_dyn_array + + When CEL expression 'math.greatest([dyn(5.4), dyn(10), dyn(3u), dyn(-5.0), dyn(3.5)]) == 10' is evaluated + Then none is None + + +# greatest_double_result -- + +@wip +Scenario: greatest_double_result/unary_negative + + When CEL expression 'math.greatest(-5.0)' is evaluated + Then value is celpy.celtypes.DoubleType(source=-5.0) + +@wip +Scenario: greatest_double_result/unary_positive + + When CEL expression 'math.greatest(5.0)' is evaluated + Then value is celpy.celtypes.DoubleType(source=5.0) + +@wip +Scenario: greatest_double_result/binary_same_args + + When CEL expression 'math.greatest(1.0, 1.0)' is evaluated + Then value is celpy.celtypes.DoubleType(source=1.0) + +@wip +Scenario: greatest_double_result/binary_with_int + + When CEL expression 'math.greatest(1.0, 1) == 1.0' is evaluated + Then none is None + +@wip +Scenario: greatest_double_result/binary_with_uint + + When CEL expression 'math.greatest(1.0, 1u) == 1.0' is evaluated + Then none is None + +@wip +Scenario: greatest_double_result/binary_first_arg_greater + + When CEL expression 'math.greatest(5.0, -7.0)' is evaluated + Then value is celpy.celtypes.DoubleType(source=5.0) + +@wip +Scenario: greatest_double_result/binary_second_arg_greater + + When CEL expression 'math.greatest(-3.0, 3.0)' is evaluated + Then value is celpy.celtypes.DoubleType(source=3.0) + +@wip +Scenario: greatest_double_result/binary_first_arg_double_max + + When CEL expression 'math.greatest(1.797693e308, 1)' is evaluated + Then value is celpy.celtypes.DoubleType(source=1.797693e+308) + +@wip +Scenario: greatest_double_result/binary_second_arg_double_max + + When CEL expression 'math.greatest(1, 1.797693e308)' is evaluated + Then value is celpy.celtypes.DoubleType(source=1.797693e+308) + +@wip +Scenario: greatest_double_result/binary_first_arg_double_min + + When CEL expression 'math.greatest(-1.797693e308, 1.5)' is evaluated + Then value is celpy.celtypes.DoubleType(source=1.5) + +@wip +Scenario: greatest_double_result/binary_second_arg_double_min + + When CEL expression 'math.greatest(1.5, -1.797693e308)' is evaluated + Then value is celpy.celtypes.DoubleType(source=1.5) + +@wip +Scenario: greatest_double_result/ternary_same_args + + When CEL expression 'math.greatest(1.0, 1.0, 1.0) == 1.0' is evaluated + Then none is None + +@wip +Scenario: greatest_double_result/ternary_with_int + + When CEL expression 'math.greatest(1.0, 1, 1) == 1.0' is evaluated + Then none is None + +@wip +Scenario: greatest_double_result/ternary_with_uint + + When CEL expression 'math.greatest(1.0, 1u, 1u) == 1.0' is evaluated + Then none is None + +@wip +Scenario: greatest_double_result/ternary_first_arg_greatest + + When CEL expression 'math.greatest(10.5, 1.5, 3.5) == 10.5' is evaluated + Then none is None + +@wip +Scenario: greatest_double_result/ternary_third_arg_greatest + + When CEL expression 'math.greatest(1.5, 3.5, 10.5) == 10.5' is evaluated + Then none is None + +@wip +Scenario: greatest_double_result/ternary_with_negatives + + When CEL expression 'math.greatest(-1.5, -2.5, -3.5) == -1.5' is evaluated + Then none is None + +@wip +Scenario: greatest_double_result/ternary_double_max + + When CEL expression 'math.greatest(1.797693e308, 1, 5) == 1.797693e308' is evaluated + Then none is None + +@wip +Scenario: greatest_double_result/ternary_double_min + + When CEL expression 'math.greatest(-1.797693e308, -1, -5) == -1' is evaluated + Then none is None + +@wip +Scenario: greatest_double_result/quaternary_mixed + + When CEL expression 'math.greatest(5.4, 10, 3u, -5.0, 1.797693e308) == 1.797693e308' is evaluated + Then none is None + +@wip +Scenario: greatest_double_result/quaternary_mixed_array + + When CEL expression 'math.greatest([5.4, 10.5, 3u, -5.0, 3.5]) == 10.5' is evaluated + Then none is None + +@wip +Scenario: greatest_double_result/quaternary_mixed_dyn_array + + When CEL expression 'math.greatest([dyn(5.4), dyn(10.5), dyn(3u), dyn(-5.0), dyn(3.5)]) == 10.5' is evaluated + Then none is None + + +# greatest_uint_result -- + +@wip +Scenario: greatest_uint_result/unary + + When CEL expression 'math.greatest(5u)' is evaluated + Then value is celpy.celtypes.UintType(source=5) + +@wip +Scenario: greatest_uint_result/binary_same_args + + When CEL expression 'math.greatest(1u, 1u)' is evaluated + Then value is celpy.celtypes.UintType(source=1) + +@wip +Scenario: greatest_uint_result/binary_with_decimal + + When CEL expression 'math.greatest(1u, 1.0) == 1' is evaluated + Then none is None + +@wip +Scenario: greatest_uint_result/binary_with_int + + When CEL expression 'math.greatest(1u, 1) == 1u' is evaluated + Then none is None + +@wip +Scenario: greatest_uint_result/binary_first_arg_greater + + When CEL expression 'math.greatest(5u, -7)' is evaluated + Then value is celpy.celtypes.UintType(source=5) + +@wip +Scenario: greatest_uint_result/binary_second_arg_greater + + When CEL expression 'math.greatest(-3, 3u)' is evaluated + Then value is celpy.celtypes.UintType(source=3) + +@wip +Scenario: greatest_uint_result/binary_first_arg_uint_max + + When CEL expression 'math.greatest(18446744073709551615u, 1u)' is evaluated + Then value is celpy.celtypes.UintType(source=18446744073709551615) + +@wip +Scenario: greatest_uint_result/binary_second_arg_uint_max + + When CEL expression 'math.greatest(1u, 18446744073709551615u)' is evaluated + Then value is celpy.celtypes.UintType(source=18446744073709551615) + +@wip +Scenario: greatest_uint_result/ternary_same_args + + When CEL expression 'math.greatest(1u, 1u, 1u) == 1u' is evaluated + Then none is None + +@wip +Scenario: greatest_uint_result/ternary_with_decimal + + When CEL expression 'math.greatest(1u, 1.0, 1.0) == 1u' is evaluated + Then none is None + +@wip +Scenario: greatest_uint_result/ternary_with_int + + When CEL expression 'math.greatest(1u, 1, 1) == 1u' is evaluated + Then none is None + +@wip +Scenario: greatest_uint_result/ternary_first_arg_greatest + + When CEL expression 'math.greatest(10u, 1u, 3u) == 10u' is evaluated + Then none is None + +@wip +Scenario: greatest_uint_result/ternary_third_arg_greatest + + When CEL expression 'math.greatest(1u, 3u, 10u) == 10u' is evaluated + Then none is None + +@wip +Scenario: greatest_uint_result/ternary_int_max + + When CEL expression 'math.greatest(18446744073709551615u, 1u, 5u) == 18446744073709551615u' is evaluated + Then none is None + +@wip +Scenario: greatest_uint_result/quaternary_mixed + + When CEL expression 'math.greatest(5.4, 10, 3u, -5.0, 18446744073709551615u) == 18446744073709551615u' is evaluated + Then none is None + +@wip +Scenario: greatest_uint_result/quaternary_mixed_array + + When CEL expression 'math.greatest([5.4, 10u, 3u, -5.0, 3.5]) == 10u' is evaluated + Then none is None + +@wip +Scenario: greatest_uint_result/quaternary_mixed_dyn_array + + When CEL expression 'math.greatest([dyn(5.4), dyn(10u), dyn(3u), dyn(-5.0), dyn(3.5)]) == 10u' is evaluated + Then none is None + + +# least_int_result -- + +@wip +Scenario: least_int_result/unary_negative + + When CEL expression 'math.least(-5)' is evaluated + Then value is celpy.celtypes.IntType(source=-5) + +@wip +Scenario: least_int_result/unary_positive + + When CEL expression 'math.least(5)' is evaluated + Then value is celpy.celtypes.IntType(source=5) + +@wip +Scenario: least_int_result/binary_same_args + + When CEL expression 'math.least(1, 1)' is evaluated + Then value is celpy.celtypes.IntType(source=1) + +@wip +Scenario: least_int_result/binary_with_decimal + + When CEL expression 'math.least(1, 1.0) == 1' is evaluated + Then none is None + +@wip +Scenario: least_int_result/binary_with_uint + + When CEL expression 'math.least(1, 1u) == 1' is evaluated + Then none is None + +@wip +Scenario: least_int_result/binary_first_arg_least + + When CEL expression 'math.least(-3, 3)' is evaluated + Then value is celpy.celtypes.IntType(source=-3) + +@wip +Scenario: least_int_result/binary_second_arg_least + + When CEL expression 'math.least(5, -7)' is evaluated + Then value is celpy.celtypes.IntType(source=-7) + +@wip +Scenario: least_int_result/binary_first_arg_int_max + + When CEL expression 'math.least(9223372036854775807, 1)' is evaluated + Then value is celpy.celtypes.IntType(source=1) + +@wip +Scenario: least_int_result/binary_second_arg_int_max + + When CEL expression 'math.least(1, 9223372036854775807)' is evaluated + Then value is celpy.celtypes.IntType(source=1) + +@wip +Scenario: least_int_result/binary_first_arg_int_min + + When CEL expression 'math.least(-9223372036854775808, 1)' is evaluated + Then value is celpy.celtypes.IntType(source=-9223372036854775808) + +@wip +Scenario: least_int_result/binary_second_arg_int_min + + When CEL expression 'math.least(1, -9223372036854775808)' is evaluated + Then value is celpy.celtypes.IntType(source=-9223372036854775808) + +@wip +Scenario: least_int_result/ternary_same_args + + When CEL expression 'math.least(1, 1, 1) == 1' is evaluated + Then none is None + +@wip +Scenario: least_int_result/ternary_with_decimal + + When CEL expression 'math.least(1, 1.0, 1.0) == 1' is evaluated + Then none is None + +@wip +Scenario: least_int_result/ternary_with_uint + + When CEL expression 'math.least(1, 1u, 1u) == 1' is evaluated + Then none is None + +@wip +Scenario: least_int_result/ternary_first_arg_least + + When CEL expression 'math.least(0, 1, 3) == 0' is evaluated + Then none is None + +@wip +Scenario: least_int_result/ternary_third_arg_least + + When CEL expression 'math.least(1, 3, 0) == 0' is evaluated + Then none is None + +@wip +Scenario: least_int_result/ternary_with_negatives + + When CEL expression 'math.least(-1, -2, -3) == -3' is evaluated + Then none is None + +@wip +Scenario: least_int_result/ternary_int_max + + When CEL expression 'math.least(9223372036854775807, 1, 5) == 1' is evaluated + Then none is None + +@wip +Scenario: least_int_result/ternary_int_min + + When CEL expression 'math.least(-9223372036854775808, -1, -5) == -9223372036854775808' is evaluated + Then none is None + +@wip +Scenario: least_int_result/quaternary_mixed + + When CEL expression 'math.least(5.4, 10, 3u, -5.0, 9223372036854775807) == -5.0' is evaluated + Then none is None + +@wip +Scenario: least_int_result/quaternary_mixed_array + + When CEL expression 'math.least([5.4, 10, 3u, -5.0, 3.5]) == -5.0' is evaluated + Then none is None + +@wip +Scenario: least_int_result/quaternary_mixed_dyn_array + + When CEL expression 'math.least([dyn(5.4), dyn(10), dyn(3u), dyn(-5.0), dyn(3.5)]) == -5.0' is evaluated + Then none is None + + +# least_double_result -- + +@wip +Scenario: least_double_result/unary_negative + + When CEL expression 'math.least(-5.5)' is evaluated + Then value is celpy.celtypes.DoubleType(source=-5.5) + +@wip +Scenario: least_double_result/unary_positive + + When CEL expression 'math.least(5.5)' is evaluated + Then value is celpy.celtypes.DoubleType(source=5.5) + +@wip +Scenario: least_double_result/binary_same_args + + When CEL expression 'math.least(1.5, 1.5)' is evaluated + Then value is celpy.celtypes.DoubleType(source=1.5) + +@wip +Scenario: least_double_result/binary_with_int + + When CEL expression 'math.least(1.0, 1) == 1' is evaluated + Then none is None + +@wip +Scenario: least_double_result/binary_with_uint + + When CEL expression 'math.least(1, 1u) == 1' is evaluated + Then none is None + +@wip +Scenario: least_double_result/binary_first_arg_least + + When CEL expression 'math.least(-3.5, 3.5)' is evaluated + Then value is celpy.celtypes.DoubleType(source=-3.5) + +@wip +Scenario: least_double_result/binary_second_arg_least + + When CEL expression 'math.least(5.5, -7.5)' is evaluated + Then value is celpy.celtypes.DoubleType(source=-7.5) + +@wip +Scenario: least_double_result/binary_first_arg_double_max + + When CEL expression 'math.least(1.797693e308, 1.5)' is evaluated + Then value is celpy.celtypes.DoubleType(source=1.5) + +@wip +Scenario: least_double_result/binary_second_arg_double_max + + When CEL expression 'math.least(1.5, 1.797693e308)' is evaluated + Then value is celpy.celtypes.DoubleType(source=1.5) + +@wip +Scenario: least_double_result/binary_first_arg_double_min + + When CEL expression 'math.least(-1.797693e308, 1.5)' is evaluated + Then value is celpy.celtypes.DoubleType(source=-1.797693e+308) + +@wip +Scenario: least_double_result/binary_second_arg_double_min + + When CEL expression 'math.least(1.5, -1.797693e308)' is evaluated + Then value is celpy.celtypes.DoubleType(source=-1.797693e+308) + +@wip +Scenario: least_double_result/ternary_same_args + + When CEL expression 'math.least(1.5, 1.5, 1.5) == 1.5' is evaluated + Then none is None + +@wip +Scenario: least_double_result/ternary_with_int + + When CEL expression 'math.least(1.0, 1, 1) == 1.0' is evaluated + Then none is None + +@wip +Scenario: least_double_result/ternary_with_uint + + When CEL expression 'math.least(1.0, 1u, 1u) == 1' is evaluated + Then none is None + +@wip +Scenario: least_double_result/ternary_first_arg_least + + When CEL expression 'math.least(0.5, 1.5, 3.5) == 0.5' is evaluated + Then none is None + +@wip +Scenario: least_double_result/ternary_third_arg_least + + When CEL expression 'math.least(1.5, 3.5, 0.5) == 0.5' is evaluated + Then none is None + +@wip +Scenario: least_double_result/ternary_with_negatives + + When CEL expression 'math.least(-1.5, -2.5, -3.5) == -3.5' is evaluated + Then none is None + +@wip +Scenario: least_double_result/ternary_double_max + + When CEL expression 'math.least(1.797693e308, 1, 5) == 1' is evaluated + Then none is None + +@wip +Scenario: least_double_result/ternary_double_min + + When CEL expression 'math.least(-1.797693e308, -1, -5) == -1.797693e308' is evaluated + Then none is None + +@wip +Scenario: least_double_result/quaternary_mixed + + When CEL expression 'math.least(5.4, 10, 3u, -5.0, 1.797693e308) == -5.0' is evaluated + Then none is None + +@wip +Scenario: least_double_result/quaternary_mixed_array + + When CEL expression 'math.least([5.4, 10.5, 3u, -5.0, 3.5]) == -5.0' is evaluated + Then none is None + +@wip +Scenario: least_double_result/quaternary_mixed_dyn_array + + When CEL expression 'math.least([dyn(5.4), dyn(10.5), dyn(3u), dyn(-5.0), dyn(3.5)]) == -5.0' is evaluated + Then none is None + + +# least_uint_result -- + +@wip +Scenario: least_uint_result/unary + + When CEL expression 'math.least(5u)' is evaluated + Then value is celpy.celtypes.UintType(source=5) + +@wip +Scenario: least_uint_result/binary_same_args + + When CEL expression 'math.least(1u, 1u)' is evaluated + Then value is celpy.celtypes.UintType(source=1) + +@wip +Scenario: least_uint_result/binary_with_decimal + + When CEL expression 'math.least(1u, 1.0) == 1u' is evaluated + Then none is None + +@wip +Scenario: least_uint_result/binary_with_int + + When CEL expression 'math.least(1u, 1) == 1u' is evaluated + Then none is None + +@wip +Scenario: least_uint_result/binary_first_arg_least + + When CEL expression 'math.least(1u, 3u)' is evaluated + Then value is celpy.celtypes.UintType(source=1) + +@wip +Scenario: least_uint_result/binary_second_arg_least + + When CEL expression 'math.least(5u, 2u)' is evaluated + Then value is celpy.celtypes.UintType(source=2) + +@wip +Scenario: least_uint_result/binary_first_arg_uint_max + + When CEL expression 'math.least(18446744073709551615u, 1u)' is evaluated + Then value is celpy.celtypes.UintType(source=1) + +@wip +Scenario: least_uint_result/binary_second_arg_uint_max + + When CEL expression 'math.least(1u, 18446744073709551615u)' is evaluated + Then value is celpy.celtypes.UintType(source=1) + +@wip +Scenario: least_uint_result/ternary_same_args + + When CEL expression 'math.least(1u, 1u, 1u) == 1u' is evaluated + Then none is None + +@wip +Scenario: least_uint_result/ternary_with_decimal + + When CEL expression 'math.least(1u, 1.0, 1.0) == 1u' is evaluated + Then none is None + +@wip +Scenario: least_uint_result/ternary_with_int + + When CEL expression 'math.least(1u, 1, 1) == 1u' is evaluated + Then none is None + +@wip +Scenario: least_uint_result/ternary_first_arg_least + + When CEL expression 'math.least(1u, 10u, 3u) == 1u' is evaluated + Then none is None + +@wip +Scenario: least_uint_result/ternary_third_arg_least + + When CEL expression 'math.least(10u, 3u, 1u) == 1u' is evaluated + Then none is None + +@wip +Scenario: least_uint_result/ternary_uint_max + + When CEL expression 'math.least(18446744073709551615u, 1u, 5u) == 1u' is evaluated + Then none is None + +@wip +Scenario: least_uint_result/quaternary_mixed + + When CEL expression 'math.least(5.4, 10, 3u, 1u, 18446744073709551615u) == 1u' is evaluated + Then none is None + +@wip +Scenario: least_uint_result/quaternary_mixed_array + + When CEL expression 'math.least([5.4, 10u, 3u, 1u, 3.5]) == 1u' is evaluated + Then none is None + +@wip +Scenario: least_uint_result/quaternary_mixed_dyn_array + + When CEL expression 'math.least([dyn(5.4), dyn(10u), dyn(3u), dyn(1u), dyn(3.5)]) == 1u' is evaluated + Then none is None + + +# ceil -- + +@wip +Scenario: ceil/negative + + When CEL expression 'math.ceil(-1.2)' is evaluated + Then value is celpy.celtypes.DoubleType(source=-1.0) + +@wip +Scenario: ceil/positive + + When CEL expression 'math.ceil(1.2)' is evaluated + Then value is celpy.celtypes.DoubleType(source=2.0) + +Scenario: ceil/dyn_error + + When CEL expression 'math.ceil(dyn(1))' is evaluated + Then eval_error is 'no such overload' + + +# floor -- + +@wip +Scenario: floor/negative + + When CEL expression 'math.floor(-1.2)' is evaluated + Then value is celpy.celtypes.DoubleType(source=-2.0) + +@wip +Scenario: floor/positive + + When CEL expression 'math.floor(1.2)' is evaluated + Then value is celpy.celtypes.DoubleType(source=1.0) + +Scenario: floor/dyn_error + + When CEL expression 'math.floor(dyn(1))' is evaluated + Then eval_error is 'no such overload' + + +# round -- + +@wip +Scenario: round/negative_down + + When CEL expression 'math.round(-1.6)' is evaluated + Then value is celpy.celtypes.DoubleType(source=-2.0) + +@wip +Scenario: round/negative_up + + When CEL expression 'math.round(-1.4)' is evaluated + Then value is celpy.celtypes.DoubleType(source=-1.0) + +@wip +Scenario: round/negative_mid + + When CEL expression 'math.round(-1.5)' is evaluated + Then value is celpy.celtypes.DoubleType(source=-2.0) + +@wip +Scenario: round/positive_down + + When CEL expression 'math.round(1.2)' is evaluated + Then value is celpy.celtypes.DoubleType(source=1.0) + +@wip +Scenario: round/positive_up + + When CEL expression 'math.round(1.5)' is evaluated + Then value is celpy.celtypes.DoubleType(source=2.0) + +@wip +Scenario: round/nan + + When CEL expression 'math.isNaN(math.round(0.0/0.0))' is evaluated + Then none is None + +Scenario: round/dyn_error + + When CEL expression 'math.round(dyn(1))' is evaluated + Then eval_error is 'no such overload' + + +# trunc -- + +@wip +Scenario: trunc/negative + + When CEL expression 'math.trunc(-1.2)' is evaluated + Then value is celpy.celtypes.DoubleType(source=-1.0) + +@wip +Scenario: trunc/positive + + When CEL expression 'math.trunc(1.2)' is evaluated + Then value is celpy.celtypes.DoubleType(source=1.0) + +@wip +Scenario: trunc/nan + + When CEL expression 'math.isNaN(math.trunc(0.0/0.0))' is evaluated + Then none is None + +Scenario: trunc/dyn_error + + When CEL expression 'math.trunc(dyn(1))' is evaluated + Then eval_error is 'no such overload' + + +# abs -- + +@wip +Scenario: abs/uint + + When CEL expression 'math.abs(1u)' is evaluated + Then value is celpy.celtypes.UintType(source=1) + +@wip +Scenario: abs/positive_int + + When CEL expression 'math.abs(1)' is evaluated + Then value is celpy.celtypes.IntType(source=1) + +@wip +Scenario: abs/negative_int + + When CEL expression 'math.abs(-11)' is evaluated + Then value is celpy.celtypes.IntType(source=11) + +@wip +Scenario: abs/positive_double + + When CEL expression 'math.abs(1.5)' is evaluated + Then value is celpy.celtypes.DoubleType(source=1.5) + +@wip +Scenario: abs/negative_double + + When CEL expression 'math.abs(-11.5)' is evaluated + Then value is celpy.celtypes.DoubleType(source=11.5) + +Scenario: abs/int_overflow + + When CEL expression 'math.abs(-9223372036854775808)' is evaluated + Then eval_error is 'overflow' + + +# sign -- + +@wip +Scenario: sign/positive_uint + + When CEL expression 'math.sign(100u)' is evaluated + Then value is celpy.celtypes.UintType(source=1) + +@wip +Scenario: sign/zero_uint + + When CEL expression 'math.sign(0u)' is evaluated + Then value is celpy.celtypes.UintType(source=0) + +@wip +Scenario: sign/positive_int + + When CEL expression 'math.sign(100)' is evaluated + Then value is celpy.celtypes.IntType(source=1) + +@wip +Scenario: sign/negative_int + + When CEL expression 'math.sign(-11)' is evaluated + Then value is celpy.celtypes.IntType(source=-1) + +@wip +Scenario: sign/zero_int + + When CEL expression 'math.sign(0)' is evaluated + Then value is celpy.celtypes.IntType(source=0) + +@wip +Scenario: sign/positive_double + + When CEL expression 'math.sign(100.5)' is evaluated + Then value is celpy.celtypes.DoubleType(source=1.0) + +@wip +Scenario: sign/negative_double + + When CEL expression 'math.sign(-32.0)' is evaluated + Then value is celpy.celtypes.DoubleType(source=-1.0) + +@wip +Scenario: sign/zero_double + + When CEL expression 'math.sign(0.0)' is evaluated + Then value is celpy.celtypes.DoubleType(source=0.0) + +Scenario: sign/dyn_error + + When CEL expression 'math.sign(dyn(true))' is evaluated + Then eval_error is 'no such overload' + + +# isNaN -- + +@wip +Scenario: isNaN/true + + When CEL expression 'math.isNaN(0.0/0.0)' is evaluated + Then none is None + +@wip +Scenario: isNaN/false + + When CEL expression '!math.isNaN(1.0/0.0)' is evaluated + Then none is None + +Scenario: isNaN/dyn_error + + When CEL expression 'math.isNaN(dyn(true))' is evaluated + Then eval_error is 'no such overload' + + +# isInf -- + +@wip +Scenario: isInf/true + + When CEL expression 'math.isInf(1.0/0.0)' is evaluated + Then none is None + +@wip +Scenario: isInf/false + + When CEL expression '!math.isInf(0.0/0.0)' is evaluated + Then none is None + +Scenario: isInf/dyn_error + + When CEL expression 'math.isInf(dyn(true))' is evaluated + Then eval_error is 'no such overload' + + +# isFinite -- + +@wip +Scenario: isFinite/true + + When CEL expression 'math.isFinite(1.0/1.5)' is evaluated + Then none is None + +@wip +Scenario: isFinite/false_nan + + When CEL expression '!math.isFinite(0.0/0.0)' is evaluated + Then none is None + +@wip +Scenario: isFinite/false_inf + + When CEL expression '!math.isFinite(-1.0/0.0)' is evaluated + Then none is None + +Scenario: isFinite/dyn_error + + When CEL expression 'math.isFinite(dyn(true))' is evaluated + Then eval_error is 'no such overload' + + +# bit_and -- + +@wip +Scenario: bit_and/int_int_non_intersect + + When CEL expression 'math.bitAnd(1, 2)' is evaluated + Then value is celpy.celtypes.IntType(source=0) + +@wip +Scenario: bit_and/int_int_intersect + + When CEL expression 'math.bitAnd(1, 3)' is evaluated + Then value is celpy.celtypes.IntType(source=1) + +@wip +Scenario: bit_and/int_int_intersect_neg + + When CEL expression 'math.bitAnd(1, -1)' is evaluated + Then value is celpy.celtypes.IntType(source=1) + +@wip +Scenario: bit_and/uint_uint_non_intersect + + When CEL expression 'math.bitAnd(1u, 2u)' is evaluated + Then value is celpy.celtypes.UintType(source=0) + +@wip +Scenario: bit_and/uint_uint_intersect + + When CEL expression 'math.bitAnd(1u, 3u)' is evaluated + Then value is celpy.celtypes.UintType(source=1) + +Scenario: bit_and/int_dyn_error + + When CEL expression "math.bitAnd(2u, dyn(''))" is evaluated + Then eval_error is 'no such overload' + + +# bit_or -- + +@wip +Scenario: bit_or/int_int_positive + + When CEL expression 'math.bitOr(1, 2)' is evaluated + Then value is celpy.celtypes.IntType(source=3) + +@wip +Scenario: bit_or/int_int_positive_negative + + When CEL expression 'math.bitOr(4, -2)' is evaluated + Then value is celpy.celtypes.IntType(source=-2) + +@wip +Scenario: bit_or/uint_uint + + When CEL expression 'math.bitOr(1u, 4u)' is evaluated + Then value is celpy.celtypes.UintType(source=5) + +Scenario: bit_or/dyn_int_error + + When CEL expression 'math.bitOr(dyn(1.2), 1)' is evaluated + Then eval_error is 'no such overload' + + +# bit_xor -- + +@wip +Scenario: bit_xor/int_int_positive + + When CEL expression 'math.bitXor(1, 3)' is evaluated + Then value is celpy.celtypes.IntType(source=2) + +@wip +Scenario: bit_xor/int_int_positive_negative + + When CEL expression 'math.bitXor(4, -2)' is evaluated + Then value is celpy.celtypes.IntType(source=-6) + +@wip +Scenario: bit_xor/uint_uint + + When CEL expression 'math.bitXor(1u, 3u)' is evaluated + Then value is celpy.celtypes.UintType(source=2) + +Scenario: bit_xor/dyn_dyn_error + + When CEL expression 'math.bitXor(dyn([]), dyn([1]))' is evaluated + Then eval_error is 'no such overload' + + +# bit_not -- + +@wip +Scenario: bit_not/int_positive + + When CEL expression 'math.bitNot(1)' is evaluated + Then value is celpy.celtypes.IntType(source=-2) + +@wip +Scenario: bit_not/int_negative + + When CEL expression 'math.bitNot(-1)' is evaluated + Then value is celpy.celtypes.IntType(source=0) + +@wip +Scenario: bit_not/int_zero + + When CEL expression 'math.bitNot(0)' is evaluated + Then value is celpy.celtypes.IntType(source=-1) + +@wip +Scenario: bit_not/uint_positive + + When CEL expression 'math.bitNot(1u)' is evaluated + Then value is celpy.celtypes.UintType(source=18446744073709551614) + +@wip +Scenario: bit_not/uint_zero + + When CEL expression 'math.bitNot(0u)' is evaluated + Then value is celpy.celtypes.UintType(source=18446744073709551615) + +Scenario: bit_not/dyn_error + + When CEL expression "math.bitNot(dyn(''))" is evaluated + Then eval_error is 'no such overload' + + +# bit_shift_left -- + +@wip +Scenario: bit_shift_left/int + + When CEL expression 'math.bitShiftLeft(1, 2)' is evaluated + Then value is celpy.celtypes.IntType(source=4) + +@wip +Scenario: bit_shift_left/int_large_shift + + When CEL expression 'math.bitShiftLeft(1, 200)' is evaluated + Then value is celpy.celtypes.IntType(source=0) + +@wip +Scenario: bit_shift_left/int_negative_large_shift + + When CEL expression 'math.bitShiftLeft(-1, 200)' is evaluated + Then value is celpy.celtypes.IntType(source=0) + +@wip +Scenario: bit_shift_left/uint + + When CEL expression 'math.bitShiftLeft(1u, 2)' is evaluated + Then value is celpy.celtypes.UintType(source=4) + +@wip +Scenario: bit_shift_left/uint_large_shift + + When CEL expression 'math.bitShiftLeft(1u, 200)' is evaluated + Then value is celpy.celtypes.UintType(source=0) + +Scenario: bit_shift_left/bad_shift + + When CEL expression 'math.bitShiftLeft(1u, -1)' is evaluated + Then eval_error is 'negative offset' + +Scenario: bit_shift_left/dyn_int_error + + When CEL expression 'math.bitShiftLeft(dyn(4.3), 1)' is evaluated + Then eval_error is 'no such overload' + + +# bit_shift_right -- + +@wip +Scenario: bit_shift_right/int + + When CEL expression 'math.bitShiftRight(1024, 2)' is evaluated + Then value is celpy.celtypes.IntType(source=256) + +@wip +Scenario: bit_shift_right/int_large_shift + + When CEL expression 'math.bitShiftRight(1024, 64)' is evaluated + Then value is celpy.celtypes.IntType(source=0) + +@wip +Scenario: bit_shift_right/int_negative + + When CEL expression 'math.bitShiftRight(-1024, 3)' is evaluated + Then value is celpy.celtypes.IntType(source=2305843009213693824) + +@wip +Scenario: bit_shift_right/int_negative_large_shift + + When CEL expression 'math.bitShiftRight(-1024, 64)' is evaluated + Then value is celpy.celtypes.IntType(source=0) + +@wip +Scenario: bit_shift_right/uint + + When CEL expression 'math.bitShiftRight(1024u, 2)' is evaluated + Then value is celpy.celtypes.UintType(source=256) + +@wip +Scenario: bit_shift_right/uint_large_shift + + When CEL expression 'math.bitShiftRight(1024u, 200)' is evaluated + Then value is celpy.celtypes.UintType(source=0) + +Scenario: bit_shift_right/bad_shift + + When CEL expression 'math.bitShiftRight(1u, -1)' is evaluated + Then eval_error is 'negative offset' + +Scenario: bit_shift_right/dyn_int_error + + When CEL expression "math.bitShiftRight(dyn(b'123'), 1)" is evaluated + Then eval_error is 'no such overload' + diff --git a/features/math_ext.textproto b/features/math_ext.textproto new file mode 100644 index 0000000..333d9bd --- /dev/null +++ b/features/math_ext.textproto @@ -0,0 +1,1266 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: google.api.expr.test.v1.SimpleTestFile + +name: "math_ext" +description: "Tests for the math extension library." +section: { + name: "greatest_int_result" + test: { + name: "unary_negative" + expr: "math.greatest(-5)" + value: { + int64_value: -5 + } + } + test: { + name: "unary_positive" + expr: "math.greatest(5)" + value: { + int64_value: 5 + } + } + test: { + name: "binary_same_args" + expr: "math.greatest(1, 1)" + value: { + int64_value: 1 + } + } + test: { + name: "binary_with_decimal" + expr: "math.greatest(1, 1.0) == 1" + } + test: { + name: "binary_with_uint" + expr: "math.greatest(1, 1u) == 1" + } + test: { + name: "binary_first_arg_greater" + expr: "math.greatest(3, -3)" + value: { + int64_value: 3 + } + } + test: { + name: "binary_second_arg_greater" + expr: "math.greatest(-7, 5)" + value: { + int64_value: 5 + } + } + test: { + name: "binary_first_arg_int_max" + expr: "math.greatest(9223372036854775807, 1)" + value: { + int64_value: 9223372036854775807 + } + } + test: { + name: "binary_second_arg_int_max" + expr: "math.greatest(1, 9223372036854775807)" + value: { + int64_value: 9223372036854775807 + } + } + test: { + name: "binary_first_arg_int_min" + expr: "math.greatest(-9223372036854775808, 1)" + value: { + int64_value: 1 + } + } + test: { + name: "binary_second_arg_int_min" + expr: "math.greatest(1, -9223372036854775808)" + value: { + int64_value: 1 + } + } + test: { + name: "ternary_same_args" + expr: "math.greatest(1, 1, 1) == 1" + } + test: { + name: "ternary_with_decimal" + expr: "math.greatest(1, 1.0, 1.0) == 1" + } + test: { + name: "ternary_with_uint" + expr: "math.greatest(1, 1u, 1u) == 1" + } + test: { + name: "ternary_first_arg_greatest" + expr: "math.greatest(10, 1, 3) == 10" + } + test: { + name: "ternary_third_arg_greatest" + expr: "math.greatest(1, 3, 10) == 10" + } + test: { + name: "ternary_with_negatives" + expr: "math.greatest(-1, -2, -3) == -1" + } + test: { + name: "ternary_int_max" + expr: "math.greatest(9223372036854775807, 1, 5) == 9223372036854775807" + } + test: { + name: "ternary_int_min" + expr: "math.greatest(-9223372036854775807, -1, -5) == -1" + } + test: { + name: "quaternary_mixed" + expr: "math.greatest(5.4, 10, 3u, -5.0, 9223372036854775807) == 9223372036854775807" + } + test: { + name: "quaternary_mixed_array" + expr: "math.greatest([5.4, 10, 3u, -5.0, 3.5]) == 10" + } + test: { + name: "quaternary_mixed_dyn_array" + expr: "math.greatest([dyn(5.4), dyn(10), dyn(3u), dyn(-5.0), dyn(3.5)]) == 10" + } +} + +section: { + name: "greatest_double_result" + test: { + name: "unary_negative" + expr: "math.greatest(-5.0)" + value: { + double_value: -5.0 + } + } + test: { + name: "unary_positive" + expr: "math.greatest(5.0)" + value: { + double_value: 5.0 + } + } + test: { + name: "binary_same_args" + expr: "math.greatest(1.0, 1.0)" + value: { + double_value: 1.0 + } + } + test: { + name: "binary_with_int" + expr: "math.greatest(1.0, 1) == 1.0" + } + test: { + name: "binary_with_uint" + expr: "math.greatest(1.0, 1u) == 1.0" + } + test: { + name: "binary_first_arg_greater" + expr: "math.greatest(5.0, -7.0)" + value: { + double_value: 5.0 + } + } + test: { + name: "binary_second_arg_greater" + expr: "math.greatest(-3.0, 3.0)" + value: { + double_value: 3.0 + } + } + test: { + name: "binary_first_arg_double_max" + expr: "math.greatest(1.797693e308, 1)" + value: { + double_value: 1.797693e308 + } + } + test: { + name: "binary_second_arg_double_max" + expr: "math.greatest(1, 1.797693e308)" + value: { + double_value: 1.797693e308 + } + } + test: { + name: "binary_first_arg_double_min" + expr: "math.greatest(-1.797693e308, 1.5)" + value: { + double_value: 1.5 + } + } + test: { + name: "binary_second_arg_double_min" + expr: "math.greatest(1.5, -1.797693e308)" + value: { + double_value: 1.5 + } + } + test: { + name: "ternary_same_args" + expr: "math.greatest(1.0, 1.0, 1.0) == 1.0" + } + test: { + name: "ternary_with_int" + expr: "math.greatest(1.0, 1, 1) == 1.0" + } + test: { + name: "ternary_with_uint" + expr: "math.greatest(1.0, 1u, 1u) == 1.0" + } + test: { + name: "ternary_first_arg_greatest" + expr: "math.greatest(10.5, 1.5, 3.5) == 10.5" + } + test: { + name: "ternary_third_arg_greatest" + expr: "math.greatest(1.5, 3.5, 10.5) == 10.5" + } + test: { + name: "ternary_with_negatives" + expr: "math.greatest(-1.5, -2.5, -3.5) == -1.5" + } + test: { + name: "ternary_double_max" + expr: "math.greatest(1.797693e308, 1, 5) == 1.797693e308" + } + test: { + name: "ternary_double_min" + expr: "math.greatest(-1.797693e308, -1, -5) == -1" + } + test: { + name: "quaternary_mixed" + expr: "math.greatest(5.4, 10, 3u, -5.0, 1.797693e308) == 1.797693e308" + } + test: { + name: "quaternary_mixed_array" + expr: "math.greatest([5.4, 10.5, 3u, -5.0, 3.5]) == 10.5" + } + test: { + name: "quaternary_mixed_dyn_array" + expr: "math.greatest([dyn(5.4), dyn(10.5), dyn(3u), dyn(-5.0), dyn(3.5)]) == 10.5" + } +} + +section: { + name: "greatest_uint_result" + test: { + name: "unary" + expr: "math.greatest(5u)" + value: { + uint64_value: 5 + } + } + test: { + name: "binary_same_args" + expr: "math.greatest(1u, 1u)" + value: { + uint64_value: 1 + } + } + test: { + name: "binary_with_decimal" + expr: "math.greatest(1u, 1.0) == 1" + } + test: { + name: "binary_with_int" + expr: "math.greatest(1u, 1) == 1u" + } + test: { + name: "binary_first_arg_greater" + expr: "math.greatest(5u, -7)" + value: { + uint64_value: 5 + } + } + test: { + name: "binary_second_arg_greater" + expr: "math.greatest(-3, 3u)" + value: { + uint64_value: 3 + } + } + test: { + name: "binary_first_arg_uint_max" + expr: "math.greatest(18446744073709551615u, 1u)" + value: { + uint64_value: 18446744073709551615 + } + } + test: { + name: "binary_second_arg_uint_max" + expr: "math.greatest(1u, 18446744073709551615u)" + value: { + uint64_value: 18446744073709551615 + } + } + test: { + name: "ternary_same_args" + expr: "math.greatest(1u, 1u, 1u) == 1u" + } + test: { + name: "ternary_with_decimal" + expr: "math.greatest(1u, 1.0, 1.0) == 1u" + } + test: { + name: "ternary_with_int" + expr: "math.greatest(1u, 1, 1) == 1u" + } + test: { + name: "ternary_first_arg_greatest" + expr: "math.greatest(10u, 1u, 3u) == 10u" + } + test: { + name: "ternary_third_arg_greatest" + expr: "math.greatest(1u, 3u, 10u) == 10u" + } + test: { + name: "ternary_int_max" + expr: "math.greatest(18446744073709551615u, 1u, 5u) == 18446744073709551615u" + } + test: { + name: "quaternary_mixed" + expr: "math.greatest(5.4, 10, 3u, -5.0, 18446744073709551615u) == 18446744073709551615u" + } + test: { + name: "quaternary_mixed_array" + expr: "math.greatest([5.4, 10u, 3u, -5.0, 3.5]) == 10u" + } + test: { + name: "quaternary_mixed_dyn_array" + expr: "math.greatest([dyn(5.4), dyn(10u), dyn(3u), dyn(-5.0), dyn(3.5)]) == 10u" + } +} + +section: { + name: "least_int_result" + test: { + name: "unary_negative" + expr: "math.least(-5)" + value: { + int64_value: -5 + } + } + test: { + name: "unary_positive" + expr: "math.least(5)" + value: { + int64_value: 5 + } + } + test: { + name: "binary_same_args" + expr: "math.least(1, 1)" + value: { + int64_value: 1 + } + } + test: { + name: "binary_with_decimal" + expr: "math.least(1, 1.0) == 1" + } + test: { + name: "binary_with_uint" + expr: "math.least(1, 1u) == 1" + } + test: { + name: "binary_first_arg_least" + expr: "math.least(-3, 3)" + value: { + int64_value: -3 + } + } + test: { + name: "binary_second_arg_least" + expr: "math.least(5, -7)" + value: { + int64_value: -7 + } + } + test: { + name: "binary_first_arg_int_max" + expr: "math.least(9223372036854775807, 1)" + value: { + int64_value: 1 + } + } + test: { + name: "binary_second_arg_int_max" + expr: "math.least(1, 9223372036854775807)" + value: { + int64_value: 1 + } + } + test: { + name: "binary_first_arg_int_min" + expr: "math.least(-9223372036854775808, 1)" + value: { + int64_value: -9223372036854775808 + } + } + test: { + name: "binary_second_arg_int_min" + expr: "math.least(1, -9223372036854775808)" + value: { + int64_value: -9223372036854775808 + } + } + test: { + name: "ternary_same_args" + expr: "math.least(1, 1, 1) == 1" + } + test: { + name: "ternary_with_decimal" + expr: "math.least(1, 1.0, 1.0) == 1" + } + test: { + name: "ternary_with_uint" + expr: "math.least(1, 1u, 1u) == 1" + } + test: { + name: "ternary_first_arg_least" + expr: "math.least(0, 1, 3) == 0" + } + test: { + name: "ternary_third_arg_least" + expr: "math.least(1, 3, 0) == 0" + } + test: { + name: "ternary_with_negatives" + expr: "math.least(-1, -2, -3) == -3" + } + test: { + name: "ternary_int_max" + expr: "math.least(9223372036854775807, 1, 5) == 1" + } + test: { + name: "ternary_int_min" + expr: "math.least(-9223372036854775808, -1, -5) == -9223372036854775808" + } + test: { + name: "quaternary_mixed" + expr: "math.least(5.4, 10, 3u, -5.0, 9223372036854775807) == -5.0" + } + test: { + name: "quaternary_mixed_array" + expr: "math.least([5.4, 10, 3u, -5.0, 3.5]) == -5.0" + } + test: { + name: "quaternary_mixed_dyn_array" + expr: "math.least([dyn(5.4), dyn(10), dyn(3u), dyn(-5.0), dyn(3.5)]) == -5.0" + } +} + +section: { + name: "least_double_result" + test: { + name: "unary_negative" + expr: "math.least(-5.5)" + value: { + double_value: -5.5 + } + } + test: { + name: "unary_positive" + expr: "math.least(5.5)" + value: { + double_value: 5.5 + } + } + test: { + name: "binary_same_args" + expr: "math.least(1.5, 1.5)" + value: { + double_value: 1.5 + } + } + test: { + name: "binary_with_int" + expr: "math.least(1.0, 1) == 1" + } + test: { + name: "binary_with_uint" + expr: "math.least(1, 1u) == 1" + } + test: { + name: "binary_first_arg_least" + expr: "math.least(-3.5, 3.5)" + value: { + double_value: -3.5 + } + } + test: { + name: "binary_second_arg_least" + expr: "math.least(5.5, -7.5)" + value: { + double_value: -7.5 + } + } + test: { + name: "binary_first_arg_double_max" + expr: "math.least(1.797693e308, 1.5)" + value: { + double_value: 1.5 + } + } + test: { + name: "binary_second_arg_double_max" + expr: "math.least(1.5, 1.797693e308)" + value: { + double_value: 1.5 + } + } + test: { + name: "binary_first_arg_double_min" + expr: "math.least(-1.797693e308, 1.5)" + value: { + double_value: -1.797693e308 + } + } + test: { + name: "binary_second_arg_double_min" + expr: "math.least(1.5, -1.797693e308)" + value: { + double_value: -1.797693e308 + } + } + test: { + name: "ternary_same_args" + expr: "math.least(1.5, 1.5, 1.5) == 1.5" + } + test: { + name: "ternary_with_int" + expr: "math.least(1.0, 1, 1) == 1.0" + } + test: { + name: "ternary_with_uint" + expr: "math.least(1.0, 1u, 1u) == 1" + } + test: { + name: "ternary_first_arg_least" + expr: "math.least(0.5, 1.5, 3.5) == 0.5" + } + test: { + name: "ternary_third_arg_least" + expr: "math.least(1.5, 3.5, 0.5) == 0.5" + } + test: { + name: "ternary_with_negatives" + expr: "math.least(-1.5, -2.5, -3.5) == -3.5" + } + test: { + name: "ternary_double_max" + expr: "math.least(1.797693e308, 1, 5) == 1" + } + test: { + name: "ternary_double_min" + expr: "math.least(-1.797693e308, -1, -5) == -1.797693e308" + } + test: { + name: "quaternary_mixed" + expr: "math.least(5.4, 10, 3u, -5.0, 1.797693e308) == -5.0" + } + test: { + name: "quaternary_mixed_array" + expr: "math.least([5.4, 10.5, 3u, -5.0, 3.5]) == -5.0" + } + test: { + name: "quaternary_mixed_dyn_array" + expr: "math.least([dyn(5.4), dyn(10.5), dyn(3u), dyn(-5.0), dyn(3.5)]) == -5.0" + } +} + +section: { + name: "least_uint_result" + test: { + name: "unary" + expr: "math.least(5u)" + value: { + uint64_value: 5 + } + } + test: { + name: "binary_same_args" + expr: "math.least(1u, 1u)" + value: { + uint64_value: 1 + } + } + test: { + name: "binary_with_decimal" + expr: "math.least(1u, 1.0) == 1u" + } + test: { + name: "binary_with_int" + expr: "math.least(1u, 1) == 1u" + } + test: { + name: "binary_first_arg_least" + expr: "math.least(1u, 3u)" + value: { + uint64_value: 1 + } + } + test: { + name: "binary_second_arg_least" + expr: "math.least(5u, 2u)" + value: { + uint64_value: 2 + } + } + test: { + name: "binary_first_arg_uint_max" + expr: "math.least(18446744073709551615u, 1u)" + value: { + uint64_value: 1 + } + } + test: { + name: "binary_second_arg_uint_max" + expr: "math.least(1u, 18446744073709551615u)" + value: { + uint64_value: 1 + } + } + test: { + name: "ternary_same_args" + expr: "math.least(1u, 1u, 1u) == 1u" + } + test: { + name: "ternary_with_decimal" + expr: "math.least(1u, 1.0, 1.0) == 1u" + } + test: { + name: "ternary_with_int" + expr: "math.least(1u, 1, 1) == 1u" + } + test: { + name: "ternary_first_arg_least" + expr: "math.least(1u, 10u, 3u) == 1u" + } + test: { + name: "ternary_third_arg_least" + expr: "math.least(10u, 3u, 1u) == 1u" + } + test: { + name: "ternary_uint_max" + expr: "math.least(18446744073709551615u, 1u, 5u) == 1u" + } + test: { + name: "quaternary_mixed" + expr: "math.least(5.4, 10, 3u, 1u, 18446744073709551615u) == 1u" + } + test: { + name: "quaternary_mixed_array" + expr: "math.least([5.4, 10u, 3u, 1u, 3.5]) == 1u" + } + test: { + name: "quaternary_mixed_dyn_array" + expr: "math.least([dyn(5.4), dyn(10u), dyn(3u), dyn(1u), dyn(3.5)]) == 1u" + } +} + +section: { + name: "ceil" + test: { + name: "negative" + expr: "math.ceil(-1.2)" + value: { + double_value: -1.0 + } + } + test: { + name: "positive" + expr: "math.ceil(1.2)" + value: { + double_value: 2.0 + } + } + test: { + name: "dyn_error" + expr: "math.ceil(dyn(1))" + eval_error: { + errors: { + message: "no such overload" + } + } + } +} + +section: { + name: "floor" + test: { + name: "negative" + expr: "math.floor(-1.2)" + value: { + double_value: -2.0 + } + } + test: { + name: "positive" + expr: "math.floor(1.2)" + value: { + double_value: 1.0 + } + } + test: { + name: "dyn_error" + expr: "math.floor(dyn(1))" + eval_error: { + errors: { + message: "no such overload" + } + } + } +} + +section: { + name: "round" + test: { + name: "negative_down" + expr: "math.round(-1.6)" + value: { + double_value: -2.0 + } + } + test: { + name: "negative_up" + expr: "math.round(-1.4)" + value: { + double_value: -1.0 + } + } + test: { + name: "negative_mid" + expr: "math.round(-1.5)" + value: { + double_value: -2.0 + } + } + test: { + name: "positive_down" + expr: "math.round(1.2)" + value: { + double_value: 1.0 + } + } + test: { + name: "positive_up" + expr: "math.round(1.5)" + value: { + double_value: 2.0 + } + } + test: { + name: "nan" + expr: "math.isNaN(math.round(0.0/0.0))" + } + test: { + name: "dyn_error" + expr: "math.round(dyn(1))" + eval_error: { + errors: { + message: "no such overload" + } + } + } +} + +section: { + name: "trunc" + test: { + name: "negative" + expr: "math.trunc(-1.2)" + value: { + double_value: -1.0 + } + } + test: { + name: "positive" + expr: "math.trunc(1.2)" + value: { + double_value: 1.0 + } + } + test: { + name: "nan" + expr: "math.isNaN(math.trunc(0.0/0.0))" + } + test: { + name: "dyn_error" + expr: "math.trunc(dyn(1))" + eval_error: { + errors: { + message: "no such overload" + } + } + } +} + +section: { + name: "abs" + test: { + name: "uint" + expr: "math.abs(1u)" + value: { + uint64_value: 1 + } + } + test: { + name: "positive_int" + expr: "math.abs(1)" + value: { + int64_value: 1 + } + } + test: { + name: "negative_int" + expr: "math.abs(-11)" + value: { + int64_value: 11 + } + } + test: { + name: "positive_double" + expr: "math.abs(1.5)" + value: { + double_value: 1.5 + } + } + test: { + name: "negative_double" + expr: "math.abs(-11.5)" + value: { + double_value: 11.5 + } + } + test: { + name: "int_overflow" + expr: "math.abs(-9223372036854775808)" + eval_error: { + errors: { + message: "overflow" + } + } + } +} + +section: { + name: "sign" + test: { + name: "positive_uint" + expr: "math.sign(100u)" + value: { + uint64_value: 1 + } + } + test: { + name: "zero_uint" + expr: "math.sign(0u)" + value: { + uint64_value: 0 + } + } + test: { + name: "positive_int" + expr: "math.sign(100)" + value: { + int64_value: 1 + } + } + test: { + name: "negative_int" + expr: "math.sign(-11)" + value: { + int64_value: -1 + } + } + test: { + name: "zero_int" + expr: "math.sign(0)" + value: { + int64_value: 0 + } + } + test: { + name: "positive_double" + expr: "math.sign(100.5)" + value: { + double_value: 1.0 + } + } + test: { + name: "negative_double" + expr: "math.sign(-32.0)" + value: { + double_value: -1.0 + } + } + test: { + name: "zero_double" + expr: "math.sign(0.0)" + value: { + double_value: 0.0 + } + } + test: { + name: "dyn_error" + expr: "math.sign(dyn(true))" + eval_error: { + errors: { + message: "no such overload" + } + } + } +} + +section: { + name: "isNaN" + test: { + name: "true" + expr: "math.isNaN(0.0/0.0)" + } + test: { + name: "false" + expr: "!math.isNaN(1.0/0.0)" + } + test: { + name: "dyn_error" + expr: "math.isNaN(dyn(true))" + eval_error: { + errors: { + message: "no such overload" + } + } + } +} + +section: { + name: "isInf" + test: { + name: "true" + expr: "math.isInf(1.0/0.0)" + } + test: { + name: "false" + expr: "!math.isInf(0.0/0.0)" + } + test: { + name: "dyn_error" + expr: "math.isInf(dyn(true))" + eval_error: { + errors: { + message: "no such overload" + } + } + } +} + +section: { + name: "isFinite" + test: { + name: "true" + expr: "math.isFinite(1.0/1.5)" + } + test: { + name: "false_nan" + expr: "!math.isFinite(0.0/0.0)" + } + test: { + name: "false_inf" + expr: "!math.isFinite(-1.0/0.0)" + } + test: { + name: "dyn_error" + expr: "math.isFinite(dyn(true))" + eval_error: { + errors: { + message: "no such overload" + } + } + } +} + +section: { + name: "bit_and" + test: { + name: "int_int_non_intersect" + expr: "math.bitAnd(1, 2)" + value: { + int64_value: 0 + } + } + test: { + name: "int_int_intersect" + expr: "math.bitAnd(1, 3)" + value: { + int64_value: 1 + } + } + test: { + name: "int_int_intersect_neg" + expr: "math.bitAnd(1, -1)" + value: { + int64_value: 1 + } + } + test: { + name: "uint_uint_non_intersect" + expr: "math.bitAnd(1u, 2u)" + value: { + uint64_value: 0 + } + } + test: { + name: "uint_uint_intersect" + expr: "math.bitAnd(1u, 3u)" + value: { + uint64_value: 1 + } + } + test: { + name: "int_dyn_error" + expr: "math.bitAnd(2u, dyn(''))" + eval_error: { + errors: { + message: "no such overload" + } + } + } +} + +section: { + name: "bit_or" + test: { + name: "int_int_positive" + expr: "math.bitOr(1, 2)" + value: { + int64_value: 3 + } + } + test: { + name: "int_int_positive_negative" + expr: "math.bitOr(4, -2)" + value: { + int64_value: -2 + } + } + test: { + name: "uint_uint" + expr: "math.bitOr(1u, 4u)" + value: { + uint64_value: 5 + } + } + test: { + name: "dyn_int_error" + expr: "math.bitOr(dyn(1.2), 1)" + eval_error: { + errors: { + message: "no such overload" + } + } + } +} + +section: { + name: "bit_xor" + test: { + name: "int_int_positive" + expr: "math.bitXor(1, 3)" + value: { + int64_value: 2 + } + } + test: { + name: "int_int_positive_negative" + expr: "math.bitXor(4, -2)" + value: { + int64_value: -6 + } + } + test: { + name: "uint_uint" + expr: "math.bitXor(1u, 3u)" + value: { + uint64_value: 2 + } + } + test: { + name: "dyn_dyn_error" + expr: "math.bitXor(dyn([]), dyn([1]))" + eval_error: { + errors: { + message: "no such overload" + } + } + } +} + +section: { + name: "bit_not" + test: { + name: "int_positive" + expr: "math.bitNot(1)" + value: { + int64_value: -2 + } + } + test: { + name: "int_negative" + expr: "math.bitNot(-1)" + value: { + int64_value: 0 + } + } + test: { + name: "int_zero" + expr: "math.bitNot(0)" + value: { + int64_value: -1 + } + } + test: { + name: "uint_positive" + expr: "math.bitNot(1u)" + value: { + uint64_value: 18446744073709551614 + } + } + test: { + name: "uint_zero" + expr: "math.bitNot(0u)" + value: { + uint64_value: 18446744073709551615 + } + } + test: { + name: "dyn_error" + expr: "math.bitNot(dyn(''))" + eval_error: { + errors: { + message: "no such overload" + } + } + } +} + +section: { + name: "bit_shift_left" + test: { + name: "int", + expr: "math.bitShiftLeft(1, 2)" + value: { + int64_value: 4 + } + } + test: { + name: "int_large_shift", + expr: "math.bitShiftLeft(1, 200)" + value: { + int64_value: 0 + } + } + test: { + name: "int_negative_large_shift", + expr: "math.bitShiftLeft(-1, 200)" + value: { + int64_value: 0 + } + } + test: { + name: "uint", + expr: "math.bitShiftLeft(1u, 2)" + value: { + uint64_value: 4 + } + } + test: { + name: "uint_large_shift", + expr: "math.bitShiftLeft(1u, 200)" + value: { + uint64_value: 0 + } + } + test: { + name: "bad_shift", + expr: "math.bitShiftLeft(1u, -1)" + eval_error: { + errors: { + message: "negative offset" + } + } + } + test: { + name: "dyn_int_error" + expr: "math.bitShiftLeft(dyn(4.3), 1)" + eval_error: { + errors: { + message: "no such overload" + } + } + } +} + +section: { + name: "bit_shift_right" + test: { + name: "int", + expr: "math.bitShiftRight(1024, 2)" + value: { + int64_value: 256 + } + } + test: { + name: "int_large_shift", + expr: "math.bitShiftRight(1024, 64)" + value: { + int64_value: 0 + } + } + test: { + name: "int_negative", + expr: "math.bitShiftRight(-1024, 3)" + value: { + int64_value: 2305843009213693824 + } + } + test: { + name: "int_negative_large_shift", + expr: "math.bitShiftRight(-1024, 64)" + value: { + int64_value: 0 + } + } + test: { + name: "uint", + expr: "math.bitShiftRight(1024u, 2)" + value: { + uint64_value: 256 + } + } + test: { + name: "uint_large_shift", + expr: "math.bitShiftRight(1024u, 200)" + value: { + uint64_value: 0 + } + } + test: { + name: "bad_shift", + expr: "math.bitShiftRight(1u, -1)" + eval_error: { + errors: { + message: "negative offset" + } + } + } + test: { + name: "dyn_int_error" + expr: "math.bitShiftRight(dyn(b'123'), 1)" + eval_error: { + errors: { + message: "no such overload" + } + } + } +} diff --git a/features/namespace.feature b/features/namespace.feature index 83bd11d..77ece74 100644 --- a/features/namespace.feature +++ b/features/namespace.feature @@ -1,67 +1,38 @@ - +@conformance Feature: namespace Uses of qualified identifiers and namespaces. -# qualified -- Qualified variable lookups. - -Scenario: self_eval_qualified_lookup - - # type:{primitive:BOOL} - # Given type_env parameter "x.y" is TypeType(value='BOOL') - Given type_env parameter "x.y" is BOOL - # bool_value:true - Given bindings parameter "x.y" is BoolType(source=True) +# qualified -- Qualified variable lookups. - When CEL expression "x.y" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: qualified/self_eval_qualified_lookup + Given type_env parameter "x.y" is celpy.celtypes.BoolType + and bindings parameter "x.y" is celpy.celtypes.BoolType(source=True) + When CEL expression 'x.y' is evaluated + Then value is celpy.celtypes.BoolType(source=True) # namespace -- Namespaced identifiers. -Scenario: self_eval_container_lookup - - # type:{primitive:BOOL} - # Given type_env parameter "x.y" is TypeType(value='BOOL') - Given type_env parameter "x.y" is BOOL - - # type:{primitive:STRING} - # Given type_env parameter "y" is TypeType(value='STRING') - Given type_env parameter "y" is STRING - - # bool_value:true - Given bindings parameter "x.y" is BoolType(source=True) - - # string_value:"false" - Given bindings parameter "y" is StringType(source='false') - - Given container is "x" - - When CEL expression "y" is evaluated - # bool_value:true - Then value is BoolType(source=True) - - -Scenario: self_eval_container_lookup_unchecked - - # type:{primitive:BOOL} - # Given type_env parameter "x.y" is TypeType(value='BOOL') - Given type_env parameter "x.y" is BOOL - - # type:{primitive:BOOL} - # Given type_env parameter "y" is TypeType(value='BOOL') - Given type_env parameter "y" is BOOL +Scenario: namespace/self_eval_container_lookup - # bool_value:true - Given bindings parameter "x.y" is BoolType(source=True) + Given type_env parameter "x.y" is celpy.celtypes.BoolType + and type_env parameter "y" is celpy.celtypes.StringType + and bindings parameter "y" is celpy.celtypes.StringType(source='false') + and bindings parameter "x.y" is celpy.celtypes.BoolType(source=True) + and container is 'x' + When CEL expression 'y' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - # bool_value:false - Given bindings parameter "y" is BoolType(source=False) +Scenario: namespace/self_eval_container_lookup_unchecked - Given container is "x" + Given disable_check parameter is True + and type_env parameter "x.y" is celpy.celtypes.BoolType + and type_env parameter "y" is celpy.celtypes.BoolType + and bindings parameter "y" is celpy.celtypes.BoolType(source=False) + and bindings parameter "x.y" is celpy.celtypes.BoolType(source=True) + and container is 'x' + When CEL expression 'y' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "y" is evaluated - # bool_value:true - Then value is BoolType(source=True) diff --git a/features/namespace.textproto b/features/namespace.textproto index df439c6..15cc3ac 100644 --- a/features/namespace.textproto +++ b/features/namespace.textproto @@ -1,3 +1,6 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: google.api.expr.test.v1.SimpleTestFile + name: "namespace" description: "Uses of qualified identifiers and namespaces." section { diff --git a/features/optionals.feature b/features/optionals.feature new file mode 100644 index 0000000..7fc2017 --- /dev/null +++ b/features/optionals.feature @@ -0,0 +1,434 @@ +@conformance +Feature: optionals + Tests for optionals. + + +# optionals -- + +@wip +Scenario: optionals/null + + When CEL expression 'optional.of(null).hasValue()' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: optionals/null_non_zero_value + + When CEL expression 'optional.ofNonZeroValue(null).hasValue()' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: optionals/none_or_none_or_value + + When CEL expression 'optional.none().or(optional.none()).orValue(42)' is evaluated + Then value is celpy.celtypes.IntType(source=42) + +@wip +Scenario: optionals/none_optMap_hasValue + + When CEL expression 'optional.none().optMap(y, y + 1).hasValue()' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: optionals/empty_map_optFlatMap_hasValue + + When CEL expression '{}.?key.optFlatMap(k, k.?subkey).hasValue()' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: optionals/map_empty_submap_optFlatMap_hasValue + + When CEL expression "{'key': {}}.?key.optFlatMap(k, k.?subkey).hasValue()" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: optionals/map_null_entry_hasValue + + When CEL expression "{'null_key': dyn(null)}.?null_key.hasValue()" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: optionals/map_null_entry_no_such_key + + When CEL expression "{'null_key': dyn(null)}.?null_key.invalid.hasValue()" is evaluated + Then eval_error is 'no such key' + +@wip +Scenario: optionals/map_absent_key_absent_field_none + + When CEL expression '{true: dyn(0)}[?false].absent.hasValue()' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +Scenario: optionals/map_present_key_invalid_field + + When CEL expression '{true: dyn(0)}[?true].absent.hasValue()' is evaluated + Then eval_error is 'no such key' + +@wip +Scenario: optionals/map_undefined_entry_hasValue + + When CEL expression '{}.?null_key.invalid.hasValue()' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: optionals/map_submap_subkey_optFlatMap_value + + When CEL expression "{'key': {'subkey': 'subvalue'}}.?key.optFlatMap(k, k.?subkey).value()" is evaluated + Then value is celpy.celtypes.StringType(source='subvalue') + +@wip +Scenario: optionals/map_submap_optFlatMap_value + + When CEL expression "{'key': {'subkey': ''}}.?key.optFlatMap(k, k.?subkey).value()" is evaluated + Then value is celpy.celtypes.StringType(source='') + +@wip +Scenario: optionals/map_optindex_optFlatMap_optional_ofNonZeroValue_hasValue + + When CEL expression "{'key': {'subkey': ''}}.?key.optFlatMap(k, optional.ofNonZeroValue(k.subkey)).hasValue()" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: optionals/optional_of_optMap_value + + When CEL expression 'optional.of(42).optMap(y, y + 1).value()' is evaluated + Then value is celpy.celtypes.IntType(source=43) + +@wip +Scenario: optionals/optional_ofNonZeroValue_or_optional_value + + When CEL expression 'optional.ofNonZeroValue(42).or(optional.of(20)).value() == 42' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: optionals/ternary_optional_hasValue + + When CEL expression '(has({}.x) ? optional.of({}.x) : optional.none()).hasValue()' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: optionals/map_optindex_hasValue + + When CEL expression '{}.?x.hasValue()' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: optionals/has_map_optindex + + When CEL expression 'has({}.?x.y)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: optionals/has_map_optindex_field + + When CEL expression "has({'x': {'y': 'z'}}.?x.y)" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: optionals/type + + When CEL expression 'type(optional.none()) == optional_type' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: optionals/optional_chaining_1 + + When CEL expression "optional.ofNonZeroValue('').or(optional.of({'c': {'dashed-index': 'goodbye'}}.c['dashed-index'])).orValue('default value')" is evaluated + Then value is celpy.celtypes.StringType(source='goodbye') + +@wip +Scenario: optionals/optional_chaining_2 + + When CEL expression "{'c': {'dashed-index': 'goodbye'}}.c[?'dashed-index'].orValue('default value')" is evaluated + Then value is celpy.celtypes.StringType(source='goodbye') + +@wip +Scenario: optionals/optional_chaining_3 + + When CEL expression "{'c': {}}.c[?'missing-index'].orValue('default value')" is evaluated + Then value is celpy.celtypes.StringType(source='default value') + +@wip +Scenario: optionals/optional_chaining_4 + + When CEL expression "optional.of({'c': {'index': 'goodbye'}}).c.index.orValue('default value')" is evaluated + Then value is celpy.celtypes.StringType(source='goodbye') + +@wip +Scenario: optionals/optional_chaining_5 + + When CEL expression "optional.of({'c': {}}).c.missing.or(optional.none()[0]).orValue('default value')" is evaluated + Then value is celpy.celtypes.StringType(source='default value') + +@wip +Scenario: optionals/optional_chaining_6 + + When CEL expression "optional.of({'c': {}}).c.missing.or(optional.of(['list-value'])[0]).orValue('default value')" is evaluated + Then value is celpy.celtypes.StringType(source='list-value') + +@wip +Scenario: optionals/optional_chaining_7 + + When CEL expression "optional.of({'c': {'index': 'goodbye'}}).c['index'].orValue('default value')" is evaluated + Then value is celpy.celtypes.StringType(source='goodbye') + +@wip +Scenario: optionals/optional_chaining_8 + + When CEL expression "optional.of({'c': {}}).c['missing'].orValue('default value')" is evaluated + Then value is celpy.celtypes.StringType(source='default value') + +@wip +Scenario: optionals/optional_chaining_9 + + When CEL expression "has(optional.of({'c': {'entry': 'hello world'}}).c) && !has(optional.of({'c': {'entry': 'hello world'}}).c.missing)" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: optionals/optional_chaining_10 + + When CEL expression "optional.ofNonZeroValue({'c': {'dashed-index': 'goodbye'}}.a.z).orValue({'c': {'dashed-index': 'goodbye'}}.c['dashed-index'])" is evaluated + Then eval_error is 'no such key' + +@wip +Scenario: optionals/optional_chaining_11 + + When CEL expression "{'c': {'dashed-index': 'goodbye'}}.?c.missing.or({'c': {'dashed-index': 'goodbye'}}.?c['dashed-index']).orValue('').size()" is evaluated + Then value is celpy.celtypes.IntType(source=7) + +@wip +Scenario: optionals/optional_chaining_12 + + When CEL expression "{?'nested_map': optional.ofNonZeroValue({?'map': {'c': {'dashed-index': 'goodbye'}}.?c})}" is evaluated + Then value is celpy.celtypes.MapType({'nested_map': celpy.celtypes.MapType({'map': celpy.celtypes.MapType({'dashed-index': celpy.celtypes.StringType(source='goodbye')})})}) + +@wip +Scenario: optionals/optional_chaining_13 + + When CEL expression "{?'nested_map': optional.ofNonZeroValue({?'map': {}.?c}), 'singleton': true}" is evaluated + Then value is celpy.celtypes.MapType({'singleton': celpy.celtypes.BoolType(source=True)}) + +@wip +Scenario: optionals/optional_chaining_14 + + When CEL expression '[?{}.?c, ?optional.of(42), ?optional.none()]' is evaluated + Then value is [celpy.celtypes.IntType(source=42)] + +@wip +Scenario: optionals/optional_chaining_15 + + When CEL expression "[?optional.ofNonZeroValue({'c': []}.?c.orValue(dyn({})))]" is evaluated + Then value is [] + +@wip +Scenario: optionals/optional_chaining_16 + + When CEL expression "optional.ofNonZeroValue({?'nested_map': optional.ofNonZeroValue({?'map': optional.of({}).?c})}).hasValue()" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: optionals/has_optional_ofNonZeroValue_struct_optional_ofNonZeroValue_map_optindex_field + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'has(TestAllTypes{?single_double_wrapper: optional.ofNonZeroValue(0.0)}.single_double_wrapper)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: optionals/optional_ofNonZeroValue_struct_optional_ofNonZeroValue_map_optindex_field + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'optional.ofNonZeroValue(TestAllTypes{?single_double_wrapper: optional.ofNonZeroValue(0.0)}).hasValue()' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: optionals/struct_map_optindex_field + + Given container is 'cel.expr.conformance.proto2' + When CEL expression "TestAllTypes{?map_string_string: {'nested': {}}[?'nested']}.map_string_string" is evaluated + Then value is celpy.celtypes.MapType({}) + +@wip +Scenario: optionals/struct_optional_ofNonZeroValue_map_optindex_field + + Given container is 'cel.expr.conformance.proto2' + When CEL expression "TestAllTypes{?map_string_string: optional.ofNonZeroValue({'nested': {}}[?'nested'].orValue({}))}.map_string_string" is evaluated + Then value is celpy.celtypes.MapType({}) + +@wip +Scenario: optionals/struct_map_optindex_field_nested + + Given container is 'cel.expr.conformance.proto2' + When CEL expression "TestAllTypes{?map_string_string: {'nested': {'hello': 'world'}}[?'nested']}.map_string_string" is evaluated + Then value is celpy.celtypes.MapType({'hello': celpy.celtypes.StringType(source='world')}) + +@wip +Scenario: optionals/struct_list_optindex_field + + Given container is 'cel.expr.conformance.proto2' + When CEL expression "TestAllTypes{repeated_string: ['greetings', ?{'nested': {'hello': 'world'}}.nested.?hello]}.repeated_string" is evaluated + Then value is [celpy.celtypes.StringType(source='greetings'), celpy.celtypes.StringType(source='world')] + +@wip +Scenario: optionals/optional_empty_map_optindex_hasValue + + When CEL expression 'optional.of({}).?c.hasValue()' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: optionals/empty_struct_optindex_hasValue + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.?repeated_string.hasValue()' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: optionals/optional_empty_struct_optindex_hasValue + + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'optional.of(TestAllTypes{}).?repeated_string.hasValue()' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: optionals/optional_none_optselect_hasValue + + When CEL expression 'optional.none().?repeated_string.hasValue()' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: optionals/struct_optindex_value + + Given container is 'cel.expr.conformance.proto2' + When CEL expression "TestAllTypes{repeated_string: ['foo']}.?repeated_string.value()" is evaluated + Then value is [celpy.celtypes.StringType(source='foo')] + +@wip +Scenario: optionals/optional_struct_optindex_value + + Given container is 'cel.expr.conformance.proto2' + When CEL expression "optional.of(TestAllTypes{repeated_string: ['foo']}).?repeated_string.value()" is evaluated + Then value is [celpy.celtypes.StringType(source='foo')] + +@wip +Scenario: optionals/optional_struct_optindex_index_value + + Given container is 'cel.expr.conformance.proto2' + When CEL expression "optional.of(TestAllTypes{repeated_string: ['foo']}).?repeated_string[0].value()" is evaluated + Then value is celpy.celtypes.StringType(source='foo') + +@wip +Scenario: optionals/empty_list_optindex_hasValue + + When CEL expression '[][?0].hasValue()' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: optionals/optional_empty_list_optindex_hasValue + + When CEL expression 'optional.of([])[?0].hasValue()' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: optionals/optional_none_optindex_hasValue + + When CEL expression 'optional.none()[?0].hasValue()' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: optionals/list_optindex_value + + When CEL expression "['foo'][?0].value()" is evaluated + Then value is celpy.celtypes.StringType(source='foo') + +@wip +Scenario: optionals/optional_list_optindex_value + + When CEL expression "optional.of(['foo'])[?0].value()" is evaluated + Then value is celpy.celtypes.StringType(source='foo') + +@wip +Scenario: optionals/map_key_mixed_type_optindex_value + + When CEL expression '{true: 1, 2: 2, 5u: 3}[?true].value()' is evaluated + Then value is celpy.celtypes.IntType(source=1) + +@wip +Scenario: optionals/map_key_mixed_numbers_double_key_optindex_value + + When CEL expression '{1u: 1.0, 2: 2.0, 3u: 3.0}[?3.0].value()' is evaluated + Then value is celpy.celtypes.DoubleType(source=3.0) + +@wip +Scenario: optionals/map_key_mixed_numbers_uint_key_optindex_value + + When CEL expression '{1u: 1.0, 2: 2.0, 3u: 3.0}[?2u].value()' is evaluated + Then value is celpy.celtypes.DoubleType(source=2.0) + +@wip +Scenario: optionals/map_key_mixed_numbers_int_key_optindex_value + + When CEL expression '{1u: 1.0, 2: 2.0, 3u: 3.0}[?1].value()' is evaluated + Then value is celpy.celtypes.DoubleType(source=1.0) + +@wip +Scenario: optionals/optional_eq_none_none + + When CEL expression 'optional.none() == optional.none()' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: optionals/optional_eq_none_int + + When CEL expression 'optional.none() == optional.of(1)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: optionals/optional_eq_int_none + + When CEL expression 'optional.of(1) == optional.none()' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: optionals/optional_eq_int_int + + When CEL expression 'optional.of(1) == optional.of(1)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: optionals/optional_ne_none_none + + When CEL expression 'optional.none() != optional.none()' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: optionals/optional_ne_none_int + + When CEL expression 'optional.none() != optional.of(1)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: optionals/optional_ne_int_none + + When CEL expression 'optional.of(1) != optional.none()' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: optionals/optional_ne_int_int + + When CEL expression 'optional.of(1) != optional.of(1)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: optionals/map_optional_has + + When CEL expression "has({'foo': optional.none()}.foo)" is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: optionals/map_optional_select_has + + When CEL expression "has({'foo': optional.none()}.foo.bar)" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + +@wip +Scenario: optionals/map_optional_entry_has + + When CEL expression "has({?'foo': optional.none()}.foo)" is evaluated + Then value is celpy.celtypes.BoolType(source=False) + diff --git a/features/optionals.textproto b/features/optionals.textproto new file mode 100644 index 0000000..6ad1cf9 --- /dev/null +++ b/features/optionals.textproto @@ -0,0 +1,451 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: cel.expr.conformance.test.SimpleTestFile + +name: "optionals" +description: "Tests for optionals." +section: { + name: "optionals" + test { + name: "null" + expr: "optional.of(null).hasValue()" + value: { bool_value: true } + } + test { + name: "null_non_zero_value" + expr: "optional.ofNonZeroValue(null).hasValue()" + value: { bool_value: false } + } + test { + name: "none_or_none_or_value" + expr: "optional.none().or(optional.none()).orValue(42)" + value: { int64_value: 42 } + } + test { + name: "none_optMap_hasValue" + expr: "optional.none().optMap(y, y + 1).hasValue()" + value: { bool_value: false } + } + test { + name: "empty_map_optFlatMap_hasValue" + expr: "{}.?key.optFlatMap(k, k.?subkey).hasValue()" + value: { bool_value: false } + } + test { + name: "map_empty_submap_optFlatMap_hasValue" + expr: "{'key': {}}.?key.optFlatMap(k, k.?subkey).hasValue()" + value: { bool_value: false } + } + test { + name: "map_null_entry_hasValue" + expr: "{'null_key': dyn(null)}.?null_key.hasValue()" + value: { bool_value: true } + } + test { + name: "map_null_entry_no_such_key" + expr: "{'null_key': dyn(null)}.?null_key.invalid.hasValue()" + eval_error: { + errors: { message: "no such key" } + } + } + test { + name: "map_absent_key_absent_field_none" + expr: "{true: dyn(0)}[?false].absent.hasValue()" + value: { bool_value: false } + } + test { + name: "map_present_key_invalid_field" + expr: "{true: dyn(0)}[?true].absent.hasValue()" + eval_error: { + errors: { message: "no such key" } + } + } + test { + name: "map_undefined_entry_hasValue" + expr: "{}.?null_key.invalid.hasValue()" + value: { bool_value: false } + } + test { + name: "map_submap_subkey_optFlatMap_value" + expr: "{'key': {'subkey': 'subvalue'}}.?key.optFlatMap(k, k.?subkey).value()" + value: { string_value: "subvalue" } + } + test { + name: "map_submap_optFlatMap_value" + expr: "{'key': {'subkey': ''}}.?key.optFlatMap(k, k.?subkey).value()" + value: { string_value: "" } + } + test { + name: "map_optindex_optFlatMap_optional_ofNonZeroValue_hasValue" + expr: "{'key': {'subkey': ''}}.?key.optFlatMap(k, optional.ofNonZeroValue(k.subkey)).hasValue()" + value: { bool_value: false } + } + test { + name: "optional_of_optMap_value" + expr: "optional.of(42).optMap(y, y + 1).value()" + value: { int64_value: 43 } + } + test { + name: "optional_ofNonZeroValue_or_optional_value" + expr: "optional.ofNonZeroValue(42).or(optional.of(20)).value() == 42" + value: { bool_value: true } + } + test { + name: "ternary_optional_hasValue" + expr: "(has({}.x) ? optional.of({}.x) : optional.none()).hasValue()" + value: { bool_value: false } + } + test { + name: "map_optindex_hasValue" + expr: "{}.?x.hasValue()" + value: { bool_value: false } + } + test { + name: "has_map_optindex" + expr: "has({}.?x.y)" + value: { bool_value: false } + } + test { + name: "has_map_optindex_field" + expr: "has({'x': {'y': 'z'}}.?x.y)" + value: { bool_value: true } + } + test { + name: "type" + expr: "type(optional.none()) == optional_type" + value: { bool_value: true } + } + test { + name: "optional_chaining_1" + expr: "optional.ofNonZeroValue('').or(optional.of({'c': {'dashed-index': 'goodbye'}}.c['dashed-index'])).orValue('default value')" + value: { string_value: "goodbye" } + } + test { + name: "optional_chaining_2" + expr: "{'c': {'dashed-index': 'goodbye'}}.c[?'dashed-index'].orValue('default value')" + value: { string_value: "goodbye" } + } + test { + name: "optional_chaining_3" + expr: "{'c': {}}.c[?'missing-index'].orValue('default value')" + value: { string_value: "default value" } + } + test { + name: "optional_chaining_4" + expr: "optional.of({'c': {'index': 'goodbye'}}).c.index.orValue('default value')" + value: { string_value: "goodbye" } + } + test { + name: "optional_chaining_5" + expr: "optional.of({'c': {}}).c.missing.or(optional.none()[0]).orValue('default value')" + value: { string_value: "default value" } + } + test { + name: "optional_chaining_6" + expr: "optional.of({'c': {}}).c.missing.or(optional.of(['list-value'])[0]).orValue('default value')" + value: { string_value: "list-value" } + } + test { + name: "optional_chaining_7" + expr: "optional.of({'c': {'index': 'goodbye'}}).c['index'].orValue('default value')" + value: { string_value: "goodbye" } + } + test { + name: "optional_chaining_8" + expr: "optional.of({'c': {}}).c['missing'].orValue('default value')" + value: { string_value: "default value" } + } + test { + name: "optional_chaining_9" + expr: "has(optional.of({'c': {'entry': 'hello world'}}).c) && !has(optional.of({'c': {'entry': 'hello world'}}).c.missing)" + value: { bool_value: true } + } + test { + name: "optional_chaining_10" + expr: "optional.ofNonZeroValue({'c': {'dashed-index': 'goodbye'}}.a.z).orValue({'c': {'dashed-index': 'goodbye'}}.c['dashed-index'])" + eval_error: { + errors: { message: "no such key" } + } + } + test { + name: "optional_chaining_11" + expr: "{'c': {'dashed-index': 'goodbye'}}.?c.missing.or({'c': {'dashed-index': 'goodbye'}}.?c['dashed-index']).orValue('').size()" + value: { int64_value: 7 } + } + test { + name: "optional_chaining_12" + expr: "{?'nested_map': optional.ofNonZeroValue({?'map': {'c': {'dashed-index': 'goodbye'}}.?c})}" + value: { + map_value: { + entries { + key: { string_value: "nested_map" } + value: { + map_value: { + entries { + key: { string_value: "map" } + value: { + map_value: { + entries { + key: { string_value: "dashed-index" } + value: { string_value: "goodbye" } + } + } + } + } + } + } + } + } + } + } + test { + name: "optional_chaining_13" + expr: "{?'nested_map': optional.ofNonZeroValue({?'map': {}.?c}), 'singleton': true}" + value: { + map_value: { + entries { + key: { string_value: "singleton" } + value: { bool_value: true } + } + } + } + } + test { + name: "optional_chaining_14" + expr: "[?{}.?c, ?optional.of(42), ?optional.none()]" + value: { list_value: { values: { int64_value: 42 } } } + } + test { + name: "optional_chaining_15" + expr: "[?optional.ofNonZeroValue({'c': []}.?c.orValue(dyn({})))]" + value: { list_value: {} } + } + test { + name: "optional_chaining_16" + expr: "optional.ofNonZeroValue({?'nested_map': optional.ofNonZeroValue({?'map': optional.of({}).?c})}).hasValue()" + value: { bool_value: false } + } + test { + name: "has_optional_ofNonZeroValue_struct_optional_ofNonZeroValue_map_optindex_field" + container: "cel.expr.conformance.proto2" + expr: "has(TestAllTypes{?single_double_wrapper: optional.ofNonZeroValue(0.0)}.single_double_wrapper)" + value: { bool_value: false } + } + test { + name: "optional_ofNonZeroValue_struct_optional_ofNonZeroValue_map_optindex_field" + container: "cel.expr.conformance.proto2" + expr: "optional.ofNonZeroValue(TestAllTypes{?single_double_wrapper: optional.ofNonZeroValue(0.0)}).hasValue()" + value: { bool_value: false } + } + test { + name: "struct_map_optindex_field" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{?map_string_string: {'nested': {}}[?'nested']}.map_string_string" + value: { map_value: {} } + } + test { + name: "struct_optional_ofNonZeroValue_map_optindex_field" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{?map_string_string: optional.ofNonZeroValue({'nested': {}}[?'nested'].orValue({}))}.map_string_string" + value: { map_value: {} } + } + test { + name: "struct_map_optindex_field_nested" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{?map_string_string: {'nested': {'hello': 'world'}}[?'nested']}.map_string_string" + value: { + map_value: { + entries { + key: { string_value: "hello" } + value: { string_value: "world" } + } + } + } + } + test { + name: "struct_list_optindex_field" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{repeated_string: ['greetings', ?{'nested': {'hello': 'world'}}.nested.?hello]}.repeated_string" + value: { + list_value: { + values { + string_value: "greetings" + } + values { + string_value: "world" + } + } + } + } + test { + name: "optional_empty_map_optindex_hasValue" + expr: "optional.of({}).?c.hasValue()" + value: { + bool_value: false + } + } + test { + name: "empty_struct_optindex_hasValue" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{}.?repeated_string.hasValue()" + value: { + bool_value: false + } + } + test { + name: "optional_empty_struct_optindex_hasValue" + container: "cel.expr.conformance.proto2" + expr: "optional.of(TestAllTypes{}).?repeated_string.hasValue()" + value: { + bool_value: false + } + } + test { + name: "optional_none_optselect_hasValue" + expr: "optional.none().?repeated_string.hasValue()" + value: { + bool_value: false + } + } + test { + name: "struct_optindex_value" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{repeated_string: ['foo']}.?repeated_string.value()" + value: { + list_value: { + values { + string_value: "foo" + } + } + } + } + test { + name: "optional_struct_optindex_value" + container: "cel.expr.conformance.proto2" + expr: "optional.of(TestAllTypes{repeated_string: ['foo']}).?repeated_string.value()" + value: { + list_value: { + values { + string_value: "foo" + } + } + } + } + test { + name: "optional_struct_optindex_index_value" + container: "cel.expr.conformance.proto2" + expr: "optional.of(TestAllTypes{repeated_string: ['foo']}).?repeated_string[0].value()" + value: { + string_value: "foo" + } + } + test { + name: "empty_list_optindex_hasValue" + expr: "[][?0].hasValue()" + value: { + bool_value: false + } + } + test { + name: "optional_empty_list_optindex_hasValue" + expr: "optional.of([])[?0].hasValue()" + value: { + bool_value: false + } + } + test { + name: "optional_none_optindex_hasValue" + expr: "optional.none()[?0].hasValue()" + value: { + bool_value: false + } + } + test { + name: "list_optindex_value" + expr: "['foo'][?0].value()" + value: { + string_value: "foo" + } + } + test { + name: "optional_list_optindex_value" + expr: "optional.of(['foo'])[?0].value()" + value: { + string_value: "foo" + } + } + test { + name: "map_key_mixed_type_optindex_value" + expr: "{true: 1, 2: 2, 5u: 3}[?true].value()" + value: { int64_value: 1 } + } + test { + name: "map_key_mixed_numbers_double_key_optindex_value" + expr: "{1u: 1.0, 2: 2.0, 3u: 3.0}[?3.0].value()" + value: { double_value: 3.0 } + } + test { + name: "map_key_mixed_numbers_uint_key_optindex_value" + expr: "{1u: 1.0, 2: 2.0, 3u: 3.0}[?2u].value()" + value: { double_value: 2.0 } + } + test { + name: "map_key_mixed_numbers_int_key_optindex_value" + expr: "{1u: 1.0, 2: 2.0, 3u: 3.0}[?1].value()" + value: { double_value: 1.0 } + } + test { + name: "optional_eq_none_none" + expr: "optional.none() == optional.none()" + value: { bool_value: true } + } + test { + name: "optional_eq_none_int" + expr: "optional.none() == optional.of(1)" + value: { bool_value: false } + } + test { + name: "optional_eq_int_none" + expr: "optional.of(1) == optional.none()" + value: { bool_value: false } + } + test { + name: "optional_eq_int_int" + expr: "optional.of(1) == optional.of(1)" + value: { bool_value: true } + } + test { + name: "optional_ne_none_none" + expr: "optional.none() != optional.none()" + value: { bool_value: false } + } + test { + name: "optional_ne_none_int" + expr: "optional.none() != optional.of(1)" + value: { bool_value: true } + } + test { + name: "optional_ne_int_none" + expr: "optional.of(1) != optional.none()" + value: { bool_value: true } + } + test { + name: "optional_ne_int_int" + expr: "optional.of(1) != optional.of(1)" + value: { bool_value: false } + } + test { + name: "map_optional_has" + expr: "has({'foo': optional.none()}.foo)" + value: { bool_value: true } + } + test { + name: "map_optional_select_has" + expr: "has({'foo': optional.none()}.foo.bar)" + value: { bool_value: false } + } + test { + name: "map_optional_entry_has" + expr: "has({?'foo': optional.none()}.foo)" + value: { bool_value: false } + } +} diff --git a/features/parse.feature b/features/parse.feature index d7694d2..0698e57 100644 --- a/features/parse.feature +++ b/features/parse.feature @@ -1,146 +1,184 @@ - +@conformance Feature: parse End-to-end parsing tests. -# nest -- Deep parse trees which all implementations must support. - -Scenario: list_index - Member = Member '[' Expr ']' - # type:{list_type:{elem_type:{primitive:INT64}}} - # Given type_env parameter "a" is TypeType(value='list_type') - Given type_env parameter "a" is list_type - - # list_value:{values:{int64_value:0}} - Given bindings parameter "a" is [IntType(source=0)] - When CEL expression "a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[0]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]" is evaluated - # int64_value:0 - Then value is IntType(source=0) +# nest -- Deep parse trees which all implementations must support. +Scenario: nest/list_index + Member = Member '[' Expr ']'. Nested indices are supported up to 12 + times. -Scenario: message_literal - Member = Member '{' [FieldInits] '}' - Given container is "google.api.expr.test.v1.proto3" + Given type_env parameter "a" is celpy.celtypes.ListType + and bindings parameter "a" is [celpy.celtypes.IntType(source=0)] + When CEL expression 'a[a[a[a[a[a[a[a[a[a[a[a[0]]]]]]]]]]]]' is evaluated + Then value is celpy.celtypes.IntType(source=0) - When CEL expression "NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{payload: TestAllTypes{single_int64: 137}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}.payload.single_int64" is evaluated - # int64_value:0 - Then value is IntType(source=0) +Scenario: nest/message_literal + Member = Member '{' [FieldInits] '}'. Nested messages supported up to + 12 levels deep. + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{payload: TestAllTypes{single_int64: 137}}}}}}}}}}}}.payload.single_int64' is evaluated + Then value is celpy.celtypes.IntType(source=0) -Scenario: funcall - Primary = ['.'] IDENT ['(' [ExprList] ')'] - When CEL expression "int(uint(int(uint(int(uint(int(uint(int(uint(int(uint(int(uint(int(uint(int(uint(int(uint(int(uint(int(uint(int(uint(int(uint(int(uint(int(uint(7))))))))))))))))))))))))))))))))" is evaluated - # int64_value:7 - Then value is IntType(source=7) +Scenario: nest/funcall + Primary = ['.'] IDENT ['(' [ExprList] ')']. Nested function calls + supported up to 12 levels deep. + When CEL expression 'int(uint(int(uint(int(uint(int(uint(int(uint(int(uint(7))))))))))))' is evaluated + Then value is celpy.celtypes.IntType(source=7) -Scenario: parens - Primary = '(' Expr ')' - When CEL expression "((((((((((((((((((((((((((((((((7))))))))))))))))))))))))))))))))" is evaluated - # int64_value:7 - Then value is IntType(source=7) +Scenario: nest/list_literal + Primary = '[' [ExprList] ']'. Nested list literals up to 12 levels + deep. + When CEL expression 'size([[[[[[[[[[[[0]]]]]]]]]]]])' is evaluated + Then value is celpy.celtypes.IntType(source=1) -Scenario: list_literal - Primary = '[' [ExprList] ']' - When CEL expression "size([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[0]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]])" is evaluated - # int64_value:1 - Then value is IntType(source=1) +Scenario: nest/map_literal + Primary = '{' [MapInits] '}'. Nested map literals up to 12 levels + deep. + When CEL expression "size({0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: 'foo'}}}}}}}}}}}})" is evaluated + Then value is celpy.celtypes.IntType(source=1) -Scenario: map_literal - Primary = '{' [MapInits] '}' - When CEL expression "size({0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: 'foo'}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}})" is evaluated - # int64_value:1 - Then value is IntType(source=1) +Scenario: nest/parens + Primary = '(' Expr ')' + When CEL expression '((((((((((((((((((((((((((((((((7))))))))))))))))))))))))))))))))' is evaluated + Then value is celpy.celtypes.IntType(source=7) # repeat -- Repetitive parse trees which all implementations must support. -Scenario: conditional - Expr = ConditionalOr ['?' ConditionalOr ':' Expr] - When CEL expression "true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : false" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: repeat/conditional + Expr = ConditionalOr ['?' ConditionalOr ':' Expr]. Chained ternary + operators up to 24 levels. + When CEL expression 'true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : false' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: or - ConditionalOr = [ConditionalOr '||'] ConditionalAnd - When CEL expression "false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || true" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: repeat/or + ConditionalOr = [ConditionalOr '||'] ConditionalAnd. Logical OR + statements with 32 conditions. + When CEL expression 'false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || true' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: and - ConditionalAnd = [ConditionalAnd '&&'] Relation - When CEL expression "true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && false" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: repeat/and + ConditionalAnd = [ConditionalAnd '&&'] Relation. Logical AND + statements with 32 conditions. + When CEL expression 'true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && false' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: add_sub - Addition = [Addition ('+' | '-')] Multiplication - When CEL expression "3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3" is evaluated - # int64_value:3 - Then value is IntType(source=3) +Scenario: repeat/add_sub + Addition = [Addition ('+' | '-')] Multiplication. Addition operators + are supported up to 24 times consecutively. + When CEL expression '3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3' is evaluated + Then value is celpy.celtypes.IntType(source=3) -Scenario: mul_div - Multiplication = [Multiplication ('*' | '/' | '%')] Unary - When CEL expression "4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4" is evaluated - # int64_value:4 - Then value is IntType(source=4) +Scenario: repeat/mul_div + Multiplication = [Multiplication ('*' | '/' | '%')] Unary. + Multiplication operators are supported up to 24 times consecutively. + When CEL expression '4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4' is evaluated + Then value is celpy.celtypes.IntType(source=4) -Scenario: not +Scenario: repeat/not Unary = '!' {'!'} Member - When CEL expression "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!true" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!true' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: unary_neg +Scenario: repeat/unary_neg Unary = '-' {'-'} Member - When CEL expression "--------------------------------19" is evaluated - # int64_value:19 - Then value is IntType(source=19) + When CEL expression '--------------------------------19' is evaluated + Then value is celpy.celtypes.IntType(source=19) -Scenario: select - Member = Member '.' IDENT ['(' [ExprList] ')'] - Given container is "google.api.expr.test.v1.proto3" +Scenario: repeat/select + Member = Member '.' IDENT ['(' [ExprList] ')']. Selection is supported + up to 12 times consecutively. - When CEL expression "NestedTestAllTypes{}.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.payload.single_int32" is evaluated - # int64_value:0 - Then value is IntType(source=0) + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'NestedTestAllTypes{}.child.child.child.child.child.child.child.child.child.child.payload.single_int32' is evaluated + Then value is celpy.celtypes.IntType(source=0) +Scenario: repeat/index + Member = Member '[' Expr ']'. Indexing is supported up to 12 times + consecutively. -Scenario: index - Member = Member '[' Expr ']' - When CEL expression "[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[['foo']]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0]" is evaluated - # string_value:"foo" - Then value is StringType(source='foo') + When CEL expression "[[[[[[[[[[[['foo']]]]]]]]]]]][0][0][0][0][0][0][0][0][0][0][0][0]" is evaluated + Then value is celpy.celtypes.StringType(source='foo') +Scenario: repeat/list_literal + Primary = '[' [ExprList] ']'. List literals with up to 32 elements. -Scenario: list_literal - Primary = '[' [ExprList] ']' - When CEL expression "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31][17]" is evaluated - # int64_value:17 - Then value is IntType(source=17) + When CEL expression '[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31][17]' is evaluated + Then value is celpy.celtypes.IntType(source=17) +Scenario: repeat/map_literal + Primary = '{' [MapInits] '}'. Map literals with up to 32 entries. -Scenario: map_literal - Primary = '{' [MapInits] '}' When CEL expression "{0: 'zero', 1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine', 10: 'ten', 11: 'eleven', 12: 'twelve', 13: 'thirteen', 14: 'fourteen', 15: 'fifteen', 16: 'sixteen', 17: 'seventeen', 18: 'eighteen', 19: 'nineteen', 20: 'twenty', 21: 'twenty-one', 22: 'twenty-two', 23: 'twenty-three', 24: 'twenty-four', 25: 'twenty-five', 26: 'twenty-six', 27: 'twenty-seven', 28: 'twenty-eight', 29: 'twenty-nine', 30: 'thirty', 31: 'thirty-one'}[17]" is evaluated - # string_value:"seventeen" - Then value is StringType(source='seventeen') + Then value is celpy.celtypes.StringType(source='seventeen') +Scenario: repeat/message_literal + Member = Member '{' [FieldInits] '}'. Message literals with up to 32 + fields. -Scenario: message_literal - Member = Member '{' [FieldInits] '}' - Given container is "google.api.expr.test.v1.proto3" - + Given container is 'cel.expr.conformance.proto3' When CEL expression "TestAllTypes{single_int32: 5, single_int64: 10, single_uint32: 15u, single_uint64: 20u, single_sint32: 25, single_sint64: 30, single_fixed32: 35u, single_fixed64: 40u, single_float: 45.0, single_double: 50.0, single_bool: true, single_string: 'sixty', single_bytes: b'sixty-five', single_value: 70.0, single_int64_wrapper: 75, single_int32_wrapper: 80, single_double_wrapper: 85.0, single_float_wrapper: 90.0, single_uint64_wrapper: 95u, single_uint32_wrapper: 100u, single_string_wrapper: 'one hundred five', single_bool_wrapper: true, repeated_int32: [115], repeated_int64: [120], repeated_uint32: [125u], repeated_uint64: [130u], repeated_sint32: [135], repeated_sint64: [140], repeated_fixed32: [145u], repeated_fixed64: [150u], repeated_sfixed32: [155], repeated_float: [160.0]}.single_sint64" is evaluated - # int64_value:30 - Then value is IntType(source=30) + Then value is celpy.celtypes.IntType(source=30) + + +# whitespace -- Check that whitespace is ignored by the grammar. + +@wip +Scenario: whitespace/spaces + Check that spaces are ignored. + + When CEL expression '[ . cel. expr .conformance. proto3. TestAllTypes { single_int64 : int ( 17 ) } . single_int64 ] [ 0 ] == ( 18 - 1 ) && ! false ? 1 : 2' is evaluated + Then value is celpy.celtypes.IntType(source=1) + +@wip +Scenario: whitespace/tabs + Check that tabs (`\t`) are ignored. + + When CEL expression '[\t.\tcel.\texpr\t.conformance.\tproto3.\tTestAllTypes\t{\tsingle_int64\t:\tint\t(\t17\t)\t}\t.\tsingle_int64\t]\t[\t0\t]\t==\t(\t18\t-\t1\t)\t&&\t!\tfalse\t?\t1\t:\t2' is evaluated + Then value is celpy.celtypes.IntType(source=1) + +@wip +Scenario: whitespace/new_lines + Check that new lines (`\n`) are ignored. + + When CEL expression '[\n.\ncel.\nexpr\n.conformance.\nproto3.\nTestAllTypes\n{\nsingle_int64\n:\nint\n(\n17\n)\n}\n.\nsingle_int64\n]\n[\n0\n]\n==\n(\n18\n-\n1\n)\n&&\n!\nfalse\n?\n1\n:\n2' is evaluated + Then value is celpy.celtypes.IntType(source=1) + +@wip +Scenario: whitespace/new_pages + Check that new pages (`\f`) are ignored. + + When CEL expression '[\x0c.\x0ccel.\x0cexpr\x0c.conformance.\x0cproto3.\x0cTestAllTypes\x0c{\x0csingle_int64\x0c:\x0cint\x0c(\x0c17\x0c)\x0c}\x0c.\x0csingle_int64\x0c]\x0c[\x0c0\x0c]\x0c==\x0c(\x0c18\x0c-\x0c1\x0c)\x0c&&\x0c!\x0cfalse\x0c?\x0c1\x0c:\x0c2' is evaluated + Then value is celpy.celtypes.IntType(source=1) + +@wip +Scenario: whitespace/carriage_returns + Check that carriage returns (`\r`) are ignored. + + When CEL expression '[\r.\rcel.\rexpr\r.conformance.\rproto3.\rTestAllTypes\r{\rsingle_int64\r:\rint\r(\r17\r)\r}\r.\rsingle_int64\r]\r[\r0\r]\r==\r(\r18\r-\r1\r)\r&&\r!\rfalse\r?\r1\r:\r2' is evaluated + Then value is celpy.celtypes.IntType(source=1) + + +# comments -- Check that comments are ignored by the grammar. Note that carriage returns alone cannot terminate comments. + +@wip +Scenario: comments/new_line_terminated + Check that new-line-terminated comments are ignored. + + When CEL expression '[// @\n.// @\ncel.// @\nexpr// @\n.conformance.// @\nproto3.// @\nTestAllTypes// @\n{// @\nsingle_int64// @\n:// @\nint// @\n(// @\n17// @\n)// @\n}// @\n.// @\nsingle_int64// @\n]// @\n[// @\n0// @\n]// @\n==// @\n(// @\n18// @\n-// @\n1// @\n)// @\n&&// @\n!// @\nfalse// @\n?// @\n1// @\n:// @\n2' is evaluated + Then value is celpy.celtypes.IntType(source=1) + diff --git a/features/parse.textproto b/features/parse.textproto index c73e6ae..76c0ad8 100644 --- a/features/parse.textproto +++ b/features/parse.textproto @@ -1,3 +1,6 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: cel.expr.conformance.test.SimpleTestFile + name: "parse" description: "End-to-end parsing tests." section { @@ -5,8 +8,8 @@ section { description: "Deep parse trees which all implementations must support." test { name: "list_index" - description: "Member = Member '[' Expr ']'" - expr: "a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[a[0]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]" + description: "Member = Member '[' Expr ']'. Nested indices are supported up to 12 times." + expr: "a[a[a[a[a[a[a[a[a[a[a[a[0]]]]]]]]]]]]" type_env { name: "a" ident { type { list_type { elem_type { primitive: INT64 } } } } @@ -19,67 +22,67 @@ section { } test { name: "message_literal" - description: "Member = Member '{' [FieldInits] '}'" - container: "google.api.expr.test.v1.proto3" - expr: "NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{payload: TestAllTypes{single_int64: 137}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}.payload.single_int64" + description: "Member = Member '{' [FieldInits] '}'. Nested messages supported up to 12 levels deep." + container: "cel.expr.conformance.proto3" + expr: "NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{child: NestedTestAllTypes{payload: TestAllTypes{single_int64: 137}}}}}}}}}}}}.payload.single_int64" value { int64_value: 0 } } test { name: "funcall" - description: "Primary = ['.'] IDENT ['(' [ExprList] ')']" - expr: "int(uint(int(uint(int(uint(int(uint(int(uint(int(uint(int(uint(int(uint(int(uint(int(uint(int(uint(int(uint(int(uint(int(uint(int(uint(int(uint(7))))))))))))))))))))))))))))))))" - value { int64_value: 7 } - } - test { - name: "parens" - description: "Primary = '(' Expr ')'" - expr: "((((((((((((((((((((((((((((((((7))))))))))))))))))))))))))))))))" + description: "Primary = ['.'] IDENT ['(' [ExprList] ')']. Nested function calls supported up to 12 levels deep." + expr: "int(uint(int(uint(int(uint(int(uint(int(uint(int(uint(7))))))))))))" value { int64_value: 7 } } test { name: "list_literal" - description: "Primary = '[' [ExprList] ']'" - expr: "size([[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[0]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]])" + description: "Primary = '[' [ExprList] ']'. Nested list literals up to 12 levels deep." + expr: "size([[[[[[[[[[[[0]]]]]]]]]]]])" value { int64_value: 1 } } test { name: "map_literal" - description: "Primary = '{' [MapInits] '}'" - expr: "size({0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: 'foo'}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}})" + description: "Primary = '{' [MapInits] '}'. Nested map literals up to 12 levels deep." + expr: "size({0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: {0: 'foo'}}}}}}}}}}}})" value { int64_value: 1 } } + test { + name: "parens" + description: "Primary = '(' Expr ')'" + expr: "((((((((((((((((((((((((((((((((7))))))))))))))))))))))))))))))))" + value { int64_value: 7 } + } } section { name: "repeat" description: "Repetitive parse trees which all implementations must support." test { name: "conditional" - description: "Expr = ConditionalOr ['?' ConditionalOr ':' Expr]" - expr: "true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : false" + description: "Expr = ConditionalOr ['?' ConditionalOr ':' Expr]. Chained ternary operators up to 24 levels." + expr: "true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : true ? true : false" value { bool_value: true } } test { name: "or" - description: "ConditionalOr = [ConditionalOr '||'] ConditionalAnd" + description: "ConditionalOr = [ConditionalOr '||'] ConditionalAnd. Logical OR statements with 32 conditions." expr: "false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || false || true" value { bool_value: true } } test { name: "and" - description: "ConditionalAnd = [ConditionalAnd '&&'] Relation" + description: "ConditionalAnd = [ConditionalAnd '&&'] Relation. Logical AND statements with 32 conditions." expr: "true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && true && false" value { bool_value: false } } test { name: "add_sub" - description: "Addition = [Addition ('+' | '-')] Multiplication" - expr: "3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3" + description: "Addition = [Addition ('+' | '-')] Multiplication. Addition operators are supported up to 24 times consecutively." + expr: "3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3 - 3 + 3" value { int64_value: 3 } } test { name: "mul_div" - description: "Multiplication = [Multiplication ('*' | '/' | '%')] Unary" - expr: "4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4" + description: "Multiplication = [Multiplication ('*' | '/' | '%')] Unary. Multiplication operators are supported up to 24 times consecutively." + expr: "4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4 * 4 / 4" value { int64_value: 4 } } test { @@ -96,34 +99,78 @@ section { } test { name: "select" - description: "Member = Member '.' IDENT ['(' [ExprList] ')']" - container: "google.api.expr.test.v1.proto3" - expr: "NestedTestAllTypes{}.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.child.payload.single_int32" + description: "Member = Member '.' IDENT ['(' [ExprList] ')']. Selection is supported up to 12 times consecutively." + container: "cel.expr.conformance.proto3" + expr: "NestedTestAllTypes{}.child.child.child.child.child.child.child.child.child.child.payload.single_int32" value { int64_value: 0 } } test { name: "index" - description: "Member = Member '[' Expr ']'" - expr: "[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[['foo']]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0]" + description: "Member = Member '[' Expr ']'. Indexing is supported up to 12 times consecutively." + expr: "[[[[[[[[[[[['foo']]]]]]]]]]]][0][0][0][0][0][0][0][0][0][0][0][0]" value { string_value: "foo" } } test { name: "list_literal" - description: "Primary = '[' [ExprList] ']'" + description: "Primary = '[' [ExprList] ']'. List literals with up to 32 elements." expr: "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31][17]" value { int64_value: 17 } } test { name: "map_literal" - description: "Primary = '{' [MapInits] '}'" + description: "Primary = '{' [MapInits] '}'. Map literals with up to 32 entries." expr: "{0: 'zero', 1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine', 10: 'ten', 11: 'eleven', 12: 'twelve', 13: 'thirteen', 14: 'fourteen', 15: 'fifteen', 16: 'sixteen', 17: 'seventeen', 18: 'eighteen', 19: 'nineteen', 20: 'twenty', 21: 'twenty-one', 22: 'twenty-two', 23: 'twenty-three', 24: 'twenty-four', 25: 'twenty-five', 26: 'twenty-six', 27: 'twenty-seven', 28: 'twenty-eight', 29: 'twenty-nine', 30: 'thirty', 31: 'thirty-one'}[17]" value { string_value: 'seventeen' } } test { name: "message_literal" - description: "Member = Member '{' [FieldInits] '}'" - container: "google.api.expr.test.v1.proto3" + description: "Member = Member '{' [FieldInits] '}'. Message literals with up to 32 fields." + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_int32: 5, single_int64: 10, single_uint32: 15u, single_uint64: 20u, single_sint32: 25, single_sint64: 30, single_fixed32: 35u, single_fixed64: 40u, single_float: 45.0, single_double: 50.0, single_bool: true, single_string: 'sixty', single_bytes: b'sixty-five', single_value: 70.0, single_int64_wrapper: 75, single_int32_wrapper: 80, single_double_wrapper: 85.0, single_float_wrapper: 90.0, single_uint64_wrapper: 95u, single_uint32_wrapper: 100u, single_string_wrapper: 'one hundred five', single_bool_wrapper: true, repeated_int32: [115], repeated_int64: [120], repeated_uint32: [125u], repeated_uint64: [130u], repeated_sint32: [135], repeated_sint64: [140], repeated_fixed32: [145u], repeated_fixed64: [150u], repeated_sfixed32: [155], repeated_float: [160.0]}.single_sint64" value { int64_value: 30 } } } +section { + name: "whitespace" + description: "Check that whitespace is ignored by the grammar." + test { + name: "spaces" + description: "Check that spaces are ignored." + expr: "[ . cel. expr .conformance. proto3. TestAllTypes { single_int64 : int ( 17 ) } . single_int64 ] [ 0 ] == ( 18 - 1 ) && ! false ? 1 : 2" + value { int64_value: 1 } + } + test { + name: "tabs" + description: "Check that tabs (`\\t`) are ignored." + expr: "[\t.\tcel.\texpr\t.conformance.\tproto3.\tTestAllTypes\t{\tsingle_int64\t:\tint\t(\t17\t)\t}\t.\tsingle_int64\t]\t[\t0\t]\t==\t(\t18\t-\t1\t)\t&&\t!\tfalse\t?\t1\t:\t2" + value { int64_value: 1 } + } + test { + name: "new_lines" + description: "Check that new lines (`\\n`) are ignored." + expr: "[\n.\ncel.\nexpr\n.conformance.\nproto3.\nTestAllTypes\n{\nsingle_int64\n:\nint\n(\n17\n)\n}\n.\nsingle_int64\n]\n[\n0\n]\n==\n(\n18\n-\n1\n)\n&&\n!\nfalse\n?\n1\n:\n2" + value { int64_value: 1 } + } + test { + name: "new_pages" + description: "Check that new pages (`\\f`) are ignored." + expr: "[\f.\fcel.\fexpr\f.conformance.\fproto3.\fTestAllTypes\f{\fsingle_int64\f:\fint\f(\f17\f)\f}\f.\fsingle_int64\f]\f[\f0\f]\f==\f(\f18\f-\f1\f)\f&&\f!\ffalse\f?\f1\f:\f2" + value { int64_value: 1 } + } + test { + name: "carriage_returns" + description: "Check that carriage returns (`\\r`) are ignored." + expr: "[\r.\rcel.\rexpr\r.conformance.\rproto3.\rTestAllTypes\r{\rsingle_int64\r:\rint\r(\r17\r)\r}\r.\rsingle_int64\r]\r[\r0\r]\r==\r(\r18\r-\r1\r)\r&&\r!\rfalse\r?\r1\r:\r2" + value { int64_value: 1 } + } +} +section { + name: "comments" + description: "Check that comments are ignored by the grammar. Note that carriage returns alone cannot terminate comments." + test { + name: "new_line_terminated" + description: "Check that new-line-terminated comments are ignored." + expr: "[// @\n.// @\ncel.// @\nexpr// @\n.conformance.// @\nproto3.// @\nTestAllTypes// @\n{// @\nsingle_int64// @\n:// @\nint// @\n(// @\n17// @\n)// @\n}// @\n.// @\nsingle_int64// @\n]// @\n[// @\n0// @\n]// @\n==// @\n(// @\n18// @\n-// @\n1// @\n)// @\n&&// @\n!// @\nfalse// @\n?// @\n1// @\n:// @\n2" + value { int64_value: 1 } + } +} diff --git a/features/plumbing.feature b/features/plumbing.feature index 1f0e305..f99699a 100644 --- a/features/plumbing.feature +++ b/features/plumbing.feature @@ -1,51 +1,49 @@ - +@conformance Feature: plumbing - Check that the ConformanceService server can accept all arguments and return all responses. + Check that the ConformanceService server can accept all arguments and + return all responses. + # min -- Minimal programs. -Scenario: min_program +Scenario: min/min_program Smallest functionality: expr in, result out. - When CEL expression "17" is evaluated - # int64_value:17 - Then value is IntType(source=17) + When CEL expression '17' is evaluated + Then value is celpy.celtypes.IntType(source=17) # eval_results -- All evaluation result kinds. -Scenario: error_result +Scenario: eval_results/error_result Check that error results go through. - When CEL expression "1 / 0" is evaluated - # errors:{message:"foo"} - Then eval_error is 'foo' + When CEL expression '1 / 0' is evaluated + Then eval_error is 'foo' -Scenario: eval_map_results +Scenario: eval_results/eval_map_results Check that map literals results are order independent. - When CEL expression '{"k1":"v1","k":"v"}' is evaluated - # map_value:{entries:{key:{string_value:"k"} value:{string_value:"v"}} entries:{key:{string_value:"k1"} value:{string_value:"v1"}}} - Then value is MapType({StringType(source='k'): StringType(source='v'), StringType(source='k1'): StringType(source='v1')}) + When CEL expression '{"k1":"v1","k":"v"}' is evaluated + Then value is celpy.celtypes.MapType({'k': celpy.celtypes.StringType(source='v'), 'k1': celpy.celtypes.StringType(source='v1')}) # check_inputs -- All inputs to Check phase. -Scenario: skip_check +Scenario: check_inputs/skip_check Make sure we can skip type checking. - When CEL expression "[17, 'pancakes']" is evaluated - # list_value:{values:{int64_value:17} values:{string_value:"pancakes"}} - Then value is [IntType(source=17), StringType(source='pancakes')] + Given disable_check parameter is True + When CEL expression "[17, 'pancakes']" is evaluated + Then value is [celpy.celtypes.IntType(source=17), celpy.celtypes.StringType(source='pancakes')] # eval_inputs -- All inputs to Eval phase. -Scenario: one_ignored_value_arg +Scenario: eval_inputs/one_ignored_value_arg Check that value bindings can be given, even if ignored. - # int64_value:17 - Given bindings parameter "x" is IntType(source=17) + Given bindings parameter "x" is celpy.celtypes.IntType(source=17) When CEL expression "'foo'" is evaluated - # string_value:"foo" - Then value is StringType(source='foo') + Then value is celpy.celtypes.StringType(source='foo') + diff --git a/features/plumbing.textproto b/features/plumbing.textproto index 2f58b3c..7b347aa 100644 --- a/features/plumbing.textproto +++ b/features/plumbing.textproto @@ -1,3 +1,6 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: google.api.expr.test.v1.SimpleTestFile + name: "plumbing" description: "Check that the ConformanceService server can accept all arguments and return all responses." section { diff --git a/features/proto2.feature b/features/proto2.feature index 44c3d25..f96580d 100644 --- a/features/proto2.feature +++ b/features/proto2.feature @@ -1,607 +1,769 @@ -@wip +@conformance Feature: proto2 - Protocol buffer version 2 tests. See notes for the available set of protos for tests. - -# literal_singular -- Literals with singular fields set. - -Scenario: int64_nocontainer + Protocol buffer version 2 tests. See notes for the available set of + protos for tests. - When CEL expression "google.api.expr.test.v1.proto2.TestAllTypes{single_int64: 17}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int64:17}} - Then value is TestAllTypes(single_int32=0, single_int64=17, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) +# literal_singular -- Literals with singular fields set. -Scenario: int32 - - Given container is "google.api.expr.test.v1.proto2" +@wip +Scenario: literal_singular/int64_nocontainer - When CEL expression "TestAllTypes{single_int32: -34}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int32:-34}} - Then value is TestAllTypes(single_int32=-34, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + When CEL expression 'cel.expr.conformance.proto2.TestAllTypes{single_int64: 17}' is evaluated + Then value is TestAllTypes(single_int64=17) +Scenario: literal_singular/int32 -Scenario: int64 + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_int32: -34}' is evaluated + Then value is TestAllTypes(single_int32=-34) - Given container is "google.api.expr.test.v1.proto2" +@wip +Scenario: literal_singular/int32_eq_uint - When CEL expression "TestAllTypes{single_int64: 17}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int64:17}} - Then value is TestAllTypes(single_int32=0, single_int64=17, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'google.protobuf' + When CEL expression 'Int32Value{value: 34} == dyn(UInt64Value{value: 34u})' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +@wip +Scenario: literal_singular/not_int32_eq_uint -Scenario: uint32 + Given container is 'google.protobuf' + When CEL expression 'Int32Value{value: 34} == dyn(UInt64Value{value: 18446744073709551615u})' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - Given container is "google.api.expr.test.v1.proto2" +@wip +Scenario: literal_singular/int32_eq_double - When CEL expression "TestAllTypes{single_uint32: 1u}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_uint32:1}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=1, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'google.protobuf' + When CEL expression 'Int32Value{value: 34} == dyn(DoubleValue{value: 34.0})' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +@wip +Scenario: literal_singular/not_int32_eq_double -Scenario: uint64 + Given container is 'google.protobuf' + When CEL expression 'Int32Value{value: 34} == dyn(DoubleValue{value: -9223372036854775809.0})' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - Given container is "google.api.expr.test.v1.proto2" +Scenario: literal_singular/int64 - When CEL expression "TestAllTypes{single_uint64: 9999u}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_uint64:9999}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=9999, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_int64: 17}' is evaluated + Then value is TestAllTypes(single_int64=17) +Scenario: literal_singular/uint32 -Scenario: sint32 + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_uint32: 1u}' is evaluated + Then value is TestAllTypes(single_uint32=1) - Given container is "google.api.expr.test.v1.proto2" +@wip +Scenario: literal_singular/uint32_eq_int - When CEL expression "TestAllTypes{single_sint32: -3}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_sint32:-3}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=-3, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'google.protobuf' + When CEL expression 'UInt32Value{value: 34u} == dyn(Int64Value{value: 34})' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +@wip +Scenario: literal_singular/not_uint32_eq_int -Scenario: sint64 + Given container is 'google.protobuf' + When CEL expression 'UInt32Value{value: 34u} == dyn(Int64Value{value: -1})' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - Given container is "google.api.expr.test.v1.proto2" +@wip +Scenario: literal_singular/uint32_eq_double - When CEL expression "TestAllTypes{single_sint64: 255}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_sint64:255}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=255, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'google.protobuf' + When CEL expression 'UInt32Value{value: 34u} == dyn(DoubleValue{value: 34.0})' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +@wip +Scenario: literal_singular/not_uint32_eq_double -Scenario: fixed32 + Given container is 'google.protobuf' + When CEL expression 'UInt32Value{value: 34u} == dyn(DoubleValue{value: 18446744073709551616.0})' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - Given container is "google.api.expr.test.v1.proto2" +Scenario: literal_singular/uint64 - When CEL expression "TestAllTypes{single_fixed32: 43u}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_fixed32:43}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=43, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_uint64: 9999u}' is evaluated + Then value is TestAllTypes(single_uint64=9999) +Scenario: literal_singular/sint32 -Scenario: fixed64 + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_sint32: -3}' is evaluated + Then value is TestAllTypes(single_sint32=-3) - Given container is "google.api.expr.test.v1.proto2" +Scenario: literal_singular/sint64 - When CEL expression "TestAllTypes{single_fixed64: 1880u}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_fixed64:1880}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=1880, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_sint64: 255}' is evaluated + Then value is TestAllTypes(single_sint64=255) +Scenario: literal_singular/fixed32 -Scenario: sfixed32 + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_fixed32: 43u}' is evaluated + Then value is TestAllTypes(single_fixed32=43) - Given container is "google.api.expr.test.v1.proto2" +Scenario: literal_singular/fixed64 - When CEL expression "TestAllTypes{single_sfixed32: -404}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_sfixed32:-404}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=-404, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_fixed64: 1880u}' is evaluated + Then value is TestAllTypes(single_fixed64=1880) +Scenario: literal_singular/sfixed32 -Scenario: sfixed64 + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_sfixed32: -404}' is evaluated + Then value is TestAllTypes(single_sfixed32=-404) - Given container is "google.api.expr.test.v1.proto2" +Scenario: literal_singular/sfixed64 - When CEL expression "TestAllTypes{single_sfixed64: -1}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_sfixed64:-1}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=-1, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_sfixed64: -1}' is evaluated + Then value is TestAllTypes(single_sfixed64=-1) +@wip +Scenario: literal_singular/float -Scenario: float + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_float: 3.1416}' is evaluated + Then value is TestAllTypes(single_float=3.1415998935699463) - Given container is "google.api.expr.test.v1.proto2" +@wip +Scenario: literal_singular/float_eq_int - When CEL expression "TestAllTypes{single_float: 3.1416}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_float:3.1416}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=3.1416, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'google.protobuf' + When CEL expression 'FloatValue{value: 3.0} == dyn(Int64Value{value: 3})' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +@wip +Scenario: literal_singular/not_float_eq_int -Scenario: double + Given container is 'google.protobuf' + When CEL expression 'FloatValue{value: -1.14} == dyn(Int64Value{value: -1})' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - Given container is "google.api.expr.test.v1.proto2" +@wip +Scenario: literal_singular/float_eq_uint - When CEL expression "TestAllTypes{single_double: 6.022e23}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_double:6.022e+23}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=6.022e+23, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'google.protobuf' + When CEL expression 'FloatValue{value: 34.0} == dyn(UInt64Value{value: 34u})' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +@wip +Scenario: literal_singular/not_float_eq_uint -Scenario: bool + Given container is 'google.protobuf' + When CEL expression 'FloatValue{value: -1.0} == dyn(UInt64Value{value: 18446744073709551615u})' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - Given container is "google.api.expr.test.v1.proto2" +Scenario: literal_singular/double - When CEL expression "TestAllTypes{single_bool: true}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_bool:true}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=True, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_double: 6.022e23}' is evaluated + Then value is TestAllTypes(single_double=6.022e+23) +Scenario: literal_singular/bool -Scenario: string + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_bool: true}' is evaluated + Then value is TestAllTypes(single_bool=True) - Given container is "google.api.expr.test.v1.proto2" +Scenario: literal_singular/string + Given container is 'cel.expr.conformance.proto2' When CEL expression "TestAllTypes{single_string: 'foo'}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_string:"foo"}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='foo', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Then value is TestAllTypes(single_string='foo') +Scenario: literal_singular/bytes -Scenario: bytes - - Given container is "google.api.expr.test.v1.proto2" - - When CEL expression "TestAllTypes{single_bytes: b'\377'}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_bytes:"\xff"}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes='ÿ', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - + Given container is 'cel.expr.conformance.proto2' + When CEL expression "TestAllTypes{single_bytes: b'\\377'}" is evaluated + Then value is TestAllTypes(single_bytes=b'\xff') # literal_wellknown -- Literals with well-known fields set. -Scenario: any - - Given container is "google.api.expr.test.v1.proto2" +Scenario: literal_wellknown/any - When CEL expression "TestAllTypes{single_any: TestAllTypes{single_int32: 1}}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_any:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int32:1}}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=TestAllTypes(single_int32=1, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]), single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_any: TestAllTypes{single_int32: 1}}' is evaluated + Then value is TestAllTypes(single_any=TestAllTypes(single_int32=1)) +Scenario: literal_wellknown/duration -Scenario: duration - - Given container is "google.api.expr.test.v1.proto2" - + Given container is 'cel.expr.conformance.proto2' When CEL expression "TestAllTypes{single_duration: duration('123s')}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_duration:{seconds:123}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=123, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: timestamp + Then value is TestAllTypes(single_duration=celpy.celtypes.DurationType(seconds=123, nanos=0)) - Given container is "google.api.expr.test.v1.proto2" +Scenario: literal_wellknown/timestamp + Given container is 'cel.expr.conformance.proto2' When CEL expression "TestAllTypes{single_timestamp: timestamp('2009-02-13T23:31:30Z')}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_timestamp:{seconds:1234567890}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=1234567890, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Then value is TestAllTypes(single_timestamp=celpy.celtypes.TimestampType(datetime.datetime(2009, 2, 13, 23, 31, 30, tzinfo=datetime.timezone.utc))) +@wip +Scenario: literal_wellknown/struct -Scenario: struct - - Given container is "google.api.expr.test.v1.proto2" - + Given container is 'cel.expr.conformance.proto2' When CEL expression "TestAllTypes{single_struct: {'one': 1, 'two': 2}}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_struct:{fields:{key:"one" value:{number_value:1}} fields:{key:"two" value:{number_value:2}}}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({'one': DoubleType(source=1), 'two': DoubleType(source=2)}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Then value is TestAllTypes(single_struct=celpy.celtypes.MapType({'one': celpy.celtypes.DoubleType(source=1.0), 'two': celpy.celtypes.DoubleType(source=2.0)})) +Scenario: literal_wellknown/value -Scenario: value - - Given container is "google.api.expr.test.v1.proto2" - + Given container is 'cel.expr.conformance.proto2' When CEL expression "TestAllTypes{single_value: 'foo'}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_value:{string_value:"foo"}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=StringType(source='foo'), single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: int64_wrapper - - Given container is "google.api.expr.test.v1.proto2" - - When CEL expression "TestAllTypes{single_int64_wrapper: -321}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int64_wrapper:{value:-321}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=-321, single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: int32_wrapper - - Given container is "google.api.expr.test.v1.proto2" - - When CEL expression "TestAllTypes{single_int32_wrapper: -456}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int32_wrapper:{value:-456}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=-456, single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: double_wrapper - - Given container is "google.api.expr.test.v1.proto2" - - When CEL expression "TestAllTypes{single_double_wrapper: 2.71828}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_double_wrapper:{value:2.71828}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=2.71828, single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: float_wrapper + Then value is TestAllTypes(single_value=celpy.celtypes.StringType(source='foo')) - Given container is "google.api.expr.test.v1.proto2" +Scenario: literal_wellknown/int64_wrapper - When CEL expression "TestAllTypes{single_float_wrapper: 2.99792e8}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_float_wrapper:{value:2.99792e+08}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=299792000.0, single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_int64_wrapper: -321}' is evaluated + Then value is TestAllTypes(single_int64_wrapper=celpy.celtypes.IntType(source=-321)) +Scenario: literal_wellknown/int32_wrapper -Scenario: uint64_wrapper + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_int32_wrapper: -456}' is evaluated + Then value is TestAllTypes(single_int32_wrapper=celpy.celtypes.IntType(source=-456)) - Given container is "google.api.expr.test.v1.proto2" +Scenario: literal_wellknown/double_wrapper - When CEL expression "TestAllTypes{single_uint64_wrapper: 8675309u}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_uint64_wrapper:{value:8675309}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=8675309, single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_double_wrapper: 2.71828}' is evaluated + Then value is TestAllTypes(single_double_wrapper=celpy.celtypes.DoubleType(source=2.71828)) +Scenario: literal_wellknown/float_wrapper -Scenario: uint32_wrapper + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_float_wrapper: 2.99792e8}' is evaluated + Then value is TestAllTypes(single_float_wrapper=celpy.celtypes.DoubleType(source=299792000.0)) - Given container is "google.api.expr.test.v1.proto2" +Scenario: literal_wellknown/uint64_wrapper - When CEL expression "TestAllTypes{single_uint32_wrapper: 987u}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_uint32_wrapper:{value:987}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=987, single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_uint64_wrapper: 8675309u}' is evaluated + Then value is TestAllTypes(single_uint64_wrapper=celpy.celtypes.UintType(source=8675309)) +Scenario: literal_wellknown/uint32_wrapper -Scenario: string_wrapper + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_uint32_wrapper: 987u}' is evaluated + Then value is TestAllTypes(single_uint32_wrapper=celpy.celtypes.UintType(source=987)) - Given container is "google.api.expr.test.v1.proto2" +Scenario: literal_wellknown/string_wrapper + Given container is 'cel.expr.conformance.proto2' When CEL expression "TestAllTypes{single_string_wrapper: 'hubba'}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_string_wrapper:{value:"hubba"}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper='hubba', single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Then value is TestAllTypes(single_string_wrapper=celpy.celtypes.StringType(source='hubba')) +Scenario: literal_wellknown/bool_wrapper -Scenario: bool_wrapper + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_bool_wrapper: true}' is evaluated + Then value is TestAllTypes(single_bool_wrapper=celpy.celtypes.BoolType(source=True)) - Given container is "google.api.expr.test.v1.proto2" +Scenario: literal_wellknown/bytes_wrapper - When CEL expression "TestAllTypes{single_bool_wrapper: true}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_bool_wrapper:{value:true}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=True, single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto2' + When CEL expression "TestAllTypes{single_bytes_wrapper: b'\\301\\103'}" is evaluated + Then value is TestAllTypes(single_bytes_wrapper=celpy.celtypes.BytesType(source=b'\xc1C')) -Scenario: bytes_wrapper +# singular_bind -- Binding the singular fields. - Given container is "google.api.expr.test.v1.proto2" +Scenario: singular_bind/int32 - When CEL expression "TestAllTypes{single_bytes_wrapper: b'\301\103'}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_bytes_wrapper:{value:"\xc1C"}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper='ÁC', list_value=[]) + Given type_env parameter "x" is celpy.celtypes.MessageType + and bindings parameter "x" is TestAllTypes(single_int32=17) + When CEL expression 'x.single_int32' is evaluated + Then value is celpy.celtypes.IntType(source=17) +Scenario: singular_bind/int64 + Given type_env parameter "x" is celpy.celtypes.MessageType + and bindings parameter "x" is TestAllTypes(single_int64=-99) + When CEL expression 'x.single_int64' is evaluated + Then value is celpy.celtypes.IntType(source=-99) -# singular_bind -- Binding the singlular fields. -Scenario: int32 - - # type:{message_type:"google.api.expr.test.v1.proto2.TestAllTypes"} - Given type_env parameter "x" is TypeType(value='google.api.expr.test.v1.proto2.TestAllTypes') - - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int32:17}} - Given bindings parameter "x" is TestAllTypes(single_int32=17, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - When CEL expression "x.single_int32" is evaluated - # int64_value:17 - Then value is IntType(source=17) - - -Scenario: int64 +# empty_field -- Tests on empty fields. - # type:{message_type:"google.api.expr.test.v1.proto2.TestAllTypes"} - Given type_env parameter "x" is TypeType(value='google.api.expr.test.v1.proto2.TestAllTypes') +@wip +Scenario: empty_field/scalar_with_default - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int64:-99}} - Given bindings parameter "x" is TestAllTypes(single_int32=0, single_int64=-99, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.single_int32' is evaluated + Then value is celpy.celtypes.IntType(source=-32) - When CEL expression "x.single_int64" is evaluated - # int64_value:-99 - Then value is IntType(source=-99) +@wip +Scenario: empty_field/scalar_no_default + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.single_fixed32' is evaluated + Then value is celpy.celtypes.UintType(source=0) +Scenario: empty_field/nested_message -# empty_field -- Tests on empty fields. + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.single_nested_message' is evaluated + Then value is NestedMessage() -Scenario: scalar_with_default +@wip +Scenario: empty_field/nested_message_subfield - Given container is "google.api.expr.test.v1.proto2" + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.single_nested_message.bb' is evaluated + Then value is celpy.celtypes.IntType(source=0) - When CEL expression "TestAllTypes{}.single_int32" is evaluated - # int64_value:-32 - Then value is IntType(source=-32) +@wip +Scenario: empty_field/wkt + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.single_int64_wrapper' is evaluated + Then value is None -Scenario: scalar_no_default +@wip +Scenario: empty_field/repeated_scalar - Given container is "google.api.expr.test.v1.proto2" + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.repeated_int64' is evaluated + Then value is [] - When CEL expression "TestAllTypes{}.single_fixed32" is evaluated - # uint64_value:0 - Then value is UintType(source=0) +@wip +Scenario: empty_field/repeated_enum + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{}.repeated_nested_enum' is evaluated + Then value is [] -Scenario: nested_message +@wip +Scenario: empty_field/repeated_nested - Given container is "google.api.expr.test.v1.proto2" + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.repeated_nested_message' is evaluated + Then value is [] - When CEL expression "TestAllTypes{}.single_nested_message" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes.NestedMessage]:{}} - Then value is NestedMessage() +Scenario: empty_field/map + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{}.map_string_string' is evaluated + Then value is celpy.celtypes.MapType({}) -Scenario: nested_message_subfield - Given container is "google.api.expr.test.v1.proto2" +# has -- Tests for the has() macro on proto2 messages. - When CEL expression "TestAllTypes{}.single_nested_message.bb" is evaluated - # int64_value:0 - Then value is IntType(source=0) +@wip +Scenario: has/undefined + Given disable_check parameter is True + and container is 'cel.expr.conformance.proto2' + When CEL expression 'has(TestAllTypes{}.no_such_field)' is evaluated + Then eval_error is 'no_such_field' -Scenario: wkt +@wip +Scenario: has/repeated_none_implicit - Given container is "google.api.expr.test.v1.proto2" + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'has(TestAllTypes{}.repeated_int32)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "TestAllTypes{}.single_int64_wrapper" is evaluated - # null_value:NULL_VALUE - Then value is None +@wip +Scenario: has/repeated_none_explicit + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'has(TestAllTypes{repeated_int32: []}.repeated_int32)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: repeated_scalar +Scenario: has/repeated_one - Given container is "google.api.expr.test.v1.proto2" + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'has(TestAllTypes{repeated_int32: [1]}.repeated_int32)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "TestAllTypes{}.repeated_int64" is evaluated - # list_value:{} - Then value is [] +Scenario: has/repeated_many + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'has(TestAllTypes{repeated_int32: [1, 2, 3]}.repeated_int32)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: repeated_nested +@wip +Scenario: has/map_none_implicit - Given container is "google.api.expr.test.v1.proto2" + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'has(TestAllTypes{}.map_string_string)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "TestAllTypes{}.repeated_nested_message" is evaluated - # list_value:{} - Then value is [] +@wip +Scenario: has/map_none_explicit + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'has(TestAllTypes{map_string_string: {}}.map_string_string)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: map +Scenario: has/map_one_default - Given container is "google.api.expr.test.v1.proto2" + Given container is 'cel.expr.conformance.proto2' + When CEL expression "has(TestAllTypes{map_string_string: {'MT': ''}}.map_string_string)" is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "TestAllTypes{}.map_string_string" is evaluated - # map_value:{} - Then value is MapType({}) +Scenario: has/map_one + Given container is 'cel.expr.conformance.proto2' + When CEL expression "has(TestAllTypes{map_string_string: {'one': 'uno'}}.map_string_string)" is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: has/map_many -# has -- Tests for the has() macro on proto2 messages. + Given container is 'cel.expr.conformance.proto2' + When CEL expression "has(TestAllTypes{map_string_string: {'one': 'uno', 'two': 'dos'}}.map_string_string)" is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: undefined +@wip +Scenario: has/required - Given container is "google.api.expr.test.v1.proto2" + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'has(TestRequired{required_int32: 4}.required_int32)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "has(TestAllTypes{}.no_such_field)" is evaluated - # errors:{message:"no_such_field"} - Then eval_error is 'no_such_field' +@wip +Scenario: has/optional_unset_no_default + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'has(TestAllTypes{}.single_sint32)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: repeated_none_implicit +Scenario: has/optional_set_no_default - Given container is "google.api.expr.test.v1.proto2" + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'has(TestAllTypes{single_sint32: -4}.single_sint32)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "has(TestAllTypes{}.repeated_int32)" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: has/optional_unset_with_default + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'has(TestAllTypes{}.single_int32)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: repeated_none_explicit +Scenario: has/optional_set_with_default - Given container is "google.api.expr.test.v1.proto2" + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'has(TestAllTypes{single_int32: 16}.single_int32)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "has(TestAllTypes{repeated_int32: []}.repeated_int32)" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: has/optional_set_to_default + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'has(TestAllTypes{single_int32: -32}.single_int32)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: repeated_one +@wip +Scenario: has/optional_message_unset - Given container is "google.api.expr.test.v1.proto2" + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'has(TestAllTypes{}.standalone_message)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "has(TestAllTypes{repeated_int32: [1]}.repeated_int32)" is evaluated - # bool_value:true - Then value is BoolType(source=True) +@wip +Scenario: has/optional_message_set + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'has(TestAllTypes{standalone_message: TestAllTypes.NestedMessage{}}.standalone_message)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: repeated_many +@wip +Scenario: has/optional_enum_unset - Given container is "google.api.expr.test.v1.proto2" + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'has(TestAllTypes{}.standalone_enum)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "has(TestAllTypes{repeated_int32: [1, 2, 3]}.repeated_int32)" is evaluated - # bool_value:true - Then value is BoolType(source=True) +@wip +Scenario: has/optional_enum_set + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'has(TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.BAR}.standalone_enum)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: map_none_implicit +@wip +Scenario: has/optional_enum_set_zero - Given container is "google.api.expr.test.v1.proto2" + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'has(TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.FOO}.standalone_enum)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "has(TestAllTypes{}.map_string_string)" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: has/oneof_unset + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'has(TestAllTypes{}.single_nested_message)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: map_none_explicit +@wip +Scenario: has/oneof_other_set - Given container is "google.api.expr.test.v1.proto2" + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'has(TestAllTypes{single_nested_enum: TestAllTypes.NestedEnum.BAZ}.single_nested_message)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "has(TestAllTypes{map_string_string: {}}.map_string_string)" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: has/oneof_set + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'has(TestAllTypes{single_nested_message: TestAllTypes.NestedMessage{}}.single_nested_message)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: map_one_default +@wip +Scenario: has/oneof_set_default - Given container is "google.api.expr.test.v1.proto2" + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'has(TestAllTypes{single_nested_enum: TestAllTypes.NestedEnum.FOO}.single_nested_enum)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "has(TestAllTypes{map_string_string: {'MT': ''}}.map_string_string)" is evaluated - # bool_value:true - Then value is BoolType(source=True) +# set_null -- -Scenario: map_one +Scenario: set_null/single_message - Given container is "google.api.expr.test.v1.proto2" + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_nested_message: null} == TestAllTypes{}' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "has(TestAllTypes{map_string_string: {'one': 'uno'}}.map_string_string)" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: set_null/single_any + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_any: null}.single_any' is evaluated + Then value is None -Scenario: map_many +Scenario: set_null/single_value - Given container is "google.api.expr.test.v1.proto2" + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_value: null}.single_value' is evaluated + Then value is None - When CEL expression "has(TestAllTypes{map_string_string: {'one': 'uno', 'two': 'dos'}}.map_string_string)" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: set_null/single_duration + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_duration: null} == TestAllTypes{}' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: required +Scenario: set_null/single_timestamp - Given container is "google.api.expr.test.v1.proto2" + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_timestamp: null} == TestAllTypes{}' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "has(TestRequired{required_int32: 4}.required_int32)" is evaluated - # bool_value:true - Then value is BoolType(source=True) +@wip +Scenario: set_null/single_scalar + Given disable_check parameter is True + and container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_bool: null} == TestAllTypes{}' is evaluated + Then eval_error is 'unsupported field type' -Scenario: optional_unset_no_default +@wip +Scenario: set_null/repeated - Given container is "google.api.expr.test.v1.proto2" + Given disable_check parameter is True + and container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{repeated_int32: null} == TestAllTypes{}' is evaluated + Then eval_error is 'unsupported field type' - When CEL expression "has(TestAllTypes{}.single_sint32)" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: set_null/map + Given disable_check parameter is True + and container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{map_string_string: null} == TestAllTypes{}' is evaluated + Then eval_error is 'unsupported field type' -Scenario: optional_set_no_default +@wip +Scenario: set_null/list_value - Given container is "google.api.expr.test.v1.proto2" + Given disable_check parameter is True + and container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{list_value: null} == TestAllTypes{}' is evaluated + Then eval_error is 'unsupported field type' - When CEL expression "has(TestAllTypes{single_sint32: -4}.single_sint32)" is evaluated - # bool_value:true - Then value is BoolType(source=True) +@wip +Scenario: set_null/single_struct + Given disable_check parameter is True + and container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{single_struct: null} == TestAllTypes{}' is evaluated + Then eval_error is 'unsupported field type' -Scenario: optional_unset_with_default - Given container is "google.api.expr.test.v1.proto2" +# quoted_fields -- - When CEL expression "has(TestAllTypes{}.single_int32)" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: quoted_fields/set_field_with_quoted_name + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{`in`: true} == TestAllTypes{}' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: optional_set_with_default +@wip +Scenario: quoted_fields/get_field_with_quoted_name - Given container is "google.api.expr.test.v1.proto2" + Given container is 'cel.expr.conformance.proto2' + When CEL expression 'TestAllTypes{`in`: true}.`in`' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "has(TestAllTypes{single_int32: 16}.single_int32)" is evaluated - # bool_value:true - Then value is BoolType(source=True) +# extensions_has -- Tests for presence checks on proto2 extension fields. -Scenario: optional_set_to_default +@wip +Scenario: extensions_has/package_scoped_int32 - Given container is "google.api.expr.test.v1.proto2" + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(int32_ext=42) + When CEL expression 'has(msg.`cel.expr.conformance.proto2.int32_ext`)' is evaluated + Then none is None - When CEL expression "has(TestAllTypes{single_int32: -32}.single_int32)" is evaluated - # bool_value:true - Then value is BoolType(source=True) +@wip +Scenario: extensions_has/package_scoped_nested_ext + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(nested_ext=TestAllTypes()) + When CEL expression 'has(msg.`cel.expr.conformance.proto2.nested_ext`)' is evaluated + Then none is None -Scenario: optional_message_unset +@wip +Scenario: extensions_has/package_scoped_test_all_types_ext - Given container is "google.api.expr.test.v1.proto2" + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(test_all_types_ext=TestAllTypes()) + When CEL expression 'has(msg.`cel.expr.conformance.proto2.test_all_types_ext`)' is evaluated + Then none is None - When CEL expression "has(TestAllTypes{}.standalone_message)" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: extensions_has/package_scoped_test_all_types_nested_enum_ext + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(nested_enum_ext=1) + When CEL expression 'has(msg.`cel.expr.conformance.proto2.nested_enum_ext`)' is evaluated + Then none is None -Scenario: optional_message_set +@wip +Scenario: extensions_has/package_scoped_repeated_test_all_types - Given container is "google.api.expr.test.v1.proto2" + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(repeated_test_all_types=[TestAllTypes(single_int64=1), TestAllTypes(single_bool=True)]) + When CEL expression 'has(msg.`cel.expr.conformance.proto2.repeated_test_all_types`)' is evaluated + Then none is None - When CEL expression "has(TestAllTypes{standalone_message: TestAllTypes.NestedMessage{}}.standalone_message)" is evaluated - # bool_value:true - Then value is BoolType(source=True) +@wip +Scenario: extensions_has/message_scoped_int64 + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(int64_ext=42) + When CEL expression 'has(msg.`cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.int64_ext`)' is evaluated + Then none is None -Scenario: optional_enum_unset +@wip +Scenario: extensions_has/message_scoped_nested_ext - Given container is "google.api.expr.test.v1.proto2" + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(message_scoped_nested_ext=TestAllTypes()) + When CEL expression 'has(msg.`cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_nested_ext`)' is evaluated + Then none is None - When CEL expression "has(TestAllTypes{}.standalone_enum)" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: extensions_has/message_scoped_nested_enum_ext + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(nested_enum_ext=1) + When CEL expression 'has(msg.`cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.nested_enum_ext`)' is evaluated + Then none is None -Scenario: optional_enum_set +@wip +Scenario: extensions_has/message_scoped_repeated_test_all_types - Given container is "google.api.expr.test.v1.proto2" + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(message_scoped_repeated_test_all_types=[TestAllTypes(single_int64=1), TestAllTypes(single_bool=True)]) + When CEL expression 'has(msg.`cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_repeated_test_all_types`)' is evaluated + Then none is None - When CEL expression "has(TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.BAR}.standalone_enum)" is evaluated - # bool_value:true - Then value is BoolType(source=True) +# extensions_get -- Tests for accessing proto2 extension fields. -Scenario: optional_enum_set_zero +@wip +Scenario: extensions_get/package_scoped_int32 - Given container is "google.api.expr.test.v1.proto2" + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(int32_ext=42) + When CEL expression 'msg.`cel.expr.conformance.proto2.int32_ext` == 42' is evaluated + Then none is None - When CEL expression "has(TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.FOO}.standalone_enum)" is evaluated - # bool_value:true - Then value is BoolType(source=True) +@wip +Scenario: extensions_get/package_scoped_nested_ext + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(nested_ext=TestAllTypes()) + When CEL expression 'msg.`cel.expr.conformance.proto2.nested_ext` == cel.expr.conformance.proto2.TestAllTypes{}' is evaluated + Then none is None -Scenario: oneof_unset +@wip +Scenario: extensions_get/package_scoped_test_all_types_ext - Given container is "google.api.expr.test.v1.proto2" + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(test_all_types_ext=TestAllTypes()) + When CEL expression 'msg.`cel.expr.conformance.proto2.test_all_types_ext` == cel.expr.conformance.proto2.TestAllTypes{}' is evaluated + Then none is None - When CEL expression "has(TestAllTypes{}.single_nested_message)" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: extensions_get/package_scoped_test_all_types_nested_enum_ext + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(nested_enum_ext=1) + When CEL expression 'msg.`cel.expr.conformance.proto2.nested_enum_ext` == cel.expr.conformance.proto2.TestAllTypes.NestedEnum.BAR' is evaluated + Then none is None -Scenario: oneof_other_set +@wip +Scenario: extensions_get/package_scoped_repeated_test_all_types - Given container is "google.api.expr.test.v1.proto2" + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(repeated_test_all_types=[TestAllTypes(single_int64=1), TestAllTypes(single_bool=True)]) + When CEL expression 'msg.`cel.expr.conformance.proto2.repeated_test_all_types` == [cel.expr.conformance.proto2.TestAllTypes{single_int64: 1}, cel.expr.conformance.proto2.TestAllTypes{single_bool: true}]' is evaluated + Then none is None - When CEL expression "has(TestAllTypes{single_nested_enum: TestAllTypes.NestedEnum.BAZ}.single_nested_message)" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: extensions_get/message_scoped_int64 + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(int64_ext=42) + When CEL expression 'msg.`cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.int64_ext` == 42' is evaluated + Then none is None -Scenario: oneof_set +@wip +Scenario: extensions_get/message_scoped_nested_ext - Given container is "google.api.expr.test.v1.proto2" + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(message_scoped_nested_ext=TestAllTypes()) + When CEL expression 'msg.`cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_nested_ext` == cel.expr.conformance.proto2.TestAllTypes{}' is evaluated + Then none is None - When CEL expression "has(TestAllTypes{single_nested_message: TestAllTypes.NestedMessage{}}.single_nested_message)" is evaluated - # bool_value:true - Then value is BoolType(source=True) +@wip +Scenario: extensions_get/message_scoped_nested_enum_ext + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(nested_enum_ext=1) + When CEL expression 'msg.`cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.nested_enum_ext` == cel.expr.conformance.proto2.TestAllTypes.NestedEnum.BAR' is evaluated + Then none is None -Scenario: oneof_set_default +@wip +Scenario: extensions_get/message_scoped_repeated_test_all_types - Given container is "google.api.expr.test.v1.proto2" + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(message_scoped_repeated_test_all_types=[TestAllTypes(single_int64=1), TestAllTypes(single_bool=True)]) + When CEL expression 'msg.`cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_repeated_test_all_types` == [cel.expr.conformance.proto2.TestAllTypes{single_int64: 1}, cel.expr.conformance.proto2.TestAllTypes{single_bool: true}]' is evaluated + Then none is None - When CEL expression "has(TestAllTypes{single_nested_enum: TestAllTypes.NestedEnum.FOO}.single_nested_enum)" is evaluated - # bool_value:true - Then value is BoolType(source=True) diff --git a/features/proto2.textproto b/features/proto2.textproto index bfc0325..0662b06 100644 --- a/features/proto2.textproto +++ b/features/proto2.textproto @@ -1,3 +1,6 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: cel.expr.conformance.test.SimpleTestFile + name: "proto2" description: "Protocol buffer version 2 tests. See notes for the available set of protos for tests." @@ -7,191 +10,259 @@ section { test { name: "int64_nocontainer" - expr: "google.api.expr.test.v1.proto2.TestAllTypes{single_int64: 17}" + expr: "cel.expr.conformance.proto2.TestAllTypes{single_int64: 17}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] - { single_int64: 17 } + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_int64: 17 } } } } test { name: "int32" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_int32: -34}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] - { single_int32: -34 } + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_int32: -34 } } } } + test { + name: "int32_eq_uint" + container: "google.protobuf" + expr: "Int32Value{value: 34} == dyn(UInt64Value{value: 34u})" + value { bool_value: true } + } + + test { + name: "not_int32_eq_uint" + container: "google.protobuf" + expr: "Int32Value{value: 34} == dyn(UInt64Value{value: 18446744073709551615u})" + value { bool_value: false } + } + + test { + name: "int32_eq_double" + container: "google.protobuf" + expr: "Int32Value{value: 34} == dyn(DoubleValue{value: 34.0})" + value { bool_value: true } + } + + test { + name: "not_int32_eq_double" + container: "google.protobuf" + expr: "Int32Value{value: 34} == dyn(DoubleValue{value: -9223372036854775809.0})" + value { bool_value: false } + } + test { name: "int64" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_int64: 17}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] - { single_int64: 17 } + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_int64: 17 } } } } test { name: "uint32" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_uint32: 1u}" value { object_value: { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] - { single_uint32: 1 } + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_uint32: 1 } } } } + test { + name: "uint32_eq_int" + container: "google.protobuf" + expr: "UInt32Value{value: 34u} == dyn(Int64Value{value: 34})" + value { bool_value: true } + } + + test { + name: "not_uint32_eq_int" + container: "google.protobuf" + expr: "UInt32Value{value: 34u} == dyn(Int64Value{value: -1})" + value { bool_value: false } + } + + test { + name: "uint32_eq_double" + container: "google.protobuf" + expr: "UInt32Value{value: 34u} == dyn(DoubleValue{value: 34.0})" + value { bool_value: true } + } + + test { + name: "not_uint32_eq_double" + container: "google.protobuf" + expr: "UInt32Value{value: 34u} == dyn(DoubleValue{value: 18446744073709551616.0})" + value { bool_value: false } + } + test { name: "uint64" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_uint64: 9999u}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] - { single_uint64: 9999 } + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_uint64: 9999 } } } } test { name: "sint32" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_sint32: -3}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] - { single_sint32: -3 } + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_sint32: -3 } } } } test { name: "sint64" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_sint64: 255}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] - { single_sint64: 255 } + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_sint64: 255 } } } } test { name: "fixed32" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_fixed32: 43u}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] - { single_fixed32: 43 } + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_fixed32: 43 } } } } test { name: "fixed64" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_fixed64: 1880u}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] - { single_fixed64: 1880 } + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_fixed64: 1880 } } } } test { name: "sfixed32" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_sfixed32: -404}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] - { single_sfixed32: -404 } + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_sfixed32: -404 } } } } test { name: "sfixed64" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_sfixed64: -1}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] - { single_sfixed64: -1 } + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_sfixed64: -1 } } } } test { name: "float" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_float: 3.1416}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] - { single_float: 3.1416 } + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_float: 3.1416 } } } } + test { + name: "float_eq_int" + container: "google.protobuf" + expr: "FloatValue{value: 3.0} == dyn(Int64Value{value: 3})" + value { bool_value: true } + } + + test { + name: "not_float_eq_int" + container: "google.protobuf" + expr: "FloatValue{value: -1.14} == dyn(Int64Value{value: -1})" + value { bool_value: false } + } + + test { + name: "float_eq_uint" + container: "google.protobuf" + expr: "FloatValue{value: 34.0} == dyn(UInt64Value{value: 34u})" + value { bool_value: true } + } + + test { + name: "not_float_eq_uint" + container: "google.protobuf" + expr: "FloatValue{value: -1.0} == dyn(UInt64Value{value: 18446744073709551615u})" + value { bool_value: false } + } + test { name: "double" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_double: 6.022e23}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] - { single_double: 6.022e23 } + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_double: 6.022e23 } } } } test { name: "bool" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_bool: true}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] - { single_bool: true } + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_bool: true } } } } test { name: "string" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_string: 'foo'}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] - { single_string: 'foo' } + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_string: "foo" } } } } test { name: "bytes" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_bytes: b'\\377'}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] - { single_bytes: '\377' } + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_bytes: "\377" } } } } @@ -203,14 +274,14 @@ section { test { name: "any" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_any: TestAllTypes{single_int32: 1}}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] { - single_any { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] { - single_int32: 1 + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { + single_any { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { + single_int32: 1 } } } @@ -220,11 +291,11 @@ section { test { name: "duration" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_duration: duration('123s')}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_duration { seconds: 123 } @@ -235,11 +306,11 @@ section { test { name: "timestamp" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_timestamp: timestamp('2009-02-13T23:31:30Z')}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_timestamp { seconds: 1234567890 } @@ -250,11 +321,11 @@ section { test { name: "struct" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_struct: {'one': 1, 'two': 2}}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_struct { fields { key: "one" @@ -272,11 +343,11 @@ section { test { name: "value" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_value: 'foo'}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_value { string_value: "foo" } @@ -287,11 +358,11 @@ section { test { name: "int64_wrapper" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_int64_wrapper: -321}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_int64_wrapper { value: -321 } @@ -302,11 +373,11 @@ section { test { name: "int32_wrapper" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_int32_wrapper: -456}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_int32_wrapper { value: -456 } @@ -317,11 +388,11 @@ section { test { name: "double_wrapper" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_double_wrapper: 2.71828}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_double_wrapper { value: 2.71828 } @@ -332,11 +403,11 @@ section { test { name: "float_wrapper" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_float_wrapper: 2.99792e8}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_float_wrapper { value: 2.99792e8 } @@ -345,14 +416,13 @@ section { } } - test { name: "uint64_wrapper" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_uint64_wrapper: 8675309u}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_uint64_wrapper { value: 8675309 } @@ -361,14 +431,13 @@ section { } } - test { name: "uint32_wrapper" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_uint32_wrapper: 987u}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_uint32_wrapper { value: 987 } @@ -377,14 +446,13 @@ section { } } - test { name: "string_wrapper" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_string_wrapper: 'hubba'}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_string_wrapper { value: "hubba" } @@ -393,14 +461,13 @@ section { } } - test { name: "bool_wrapper" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_bool_wrapper: true}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_bool_wrapper { value: true } @@ -409,14 +476,13 @@ section { } } - test { name: "bytes_wrapper" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{single_bytes_wrapper: b'\\301\\103'}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_bytes_wrapper { value: "\301\103" } @@ -429,21 +495,24 @@ section { section { name: "singular_bind" - description: "Binding the singlular fields." + description: "Binding the singular fields." test { name: "int32" expr: "x.single_int32" type_env: { name: "x" - ident: { type: { message_type: "google.api.expr.test.v1.proto2.TestAllTypes" } } + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } } bindings: { key: "x" - value: { value: { object_value: { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] - { single_int32: 17 } - }}} + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_int32: 17 } + } + } + } } value: { int64_value: 17 } } @@ -453,14 +522,17 @@ section { expr: "x.single_int64" type_env: { name: "x" - ident { type { message_type: "google.api.expr.test.v1.proto2.TestAllTypes" } } + ident { type { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } } bindings: { key: "x" - value: { value: { object_value: { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes] - { single_int64: -99 } - }}} + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes] { single_int64: -99 } + } + } + } } value: { int64_value: -99 } } @@ -472,58 +544,67 @@ section { test { name: "scalar_with_default" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{}.single_int32" value: { int64_value: -32 } } test { name: "scalar_no_default" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{}.single_fixed32" value: { uint64_value: 0 } } test { name: "nested_message" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{}.single_nested_message" - value: { object_value: { - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes.NestedMessage] - { }}} + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes.NestedMessage] {} + } + } } test { name: "nested_message_subfield" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{}.single_nested_message.bb" value: { int64_value: 0 } } test { name: "wkt" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{}.single_int64_wrapper" value: { null_value: NULL_VALUE } } test { name: "repeated_scalar" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{}.repeated_int64" value: { list_value: {} } } + test { + name: "repeated_enum" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{}.repeated_nested_enum" + value: { list_value: {} } + } + test { name: "repeated_nested" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{}.repeated_nested_message" value: { list_value: {} } } test { name: "map" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "TestAllTypes{}.map_string_string" value: { map_value: {} } } @@ -533,7 +614,7 @@ section { description: "Tests for the has() macro on proto2 messages." test { name: "undefined" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "has(TestAllTypes{}.no_such_field)" disable_check: true eval_error: { @@ -542,146 +623,607 @@ section { } test { name: "repeated_none_implicit" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "has(TestAllTypes{}.repeated_int32)" value { bool_value: false } } test { name: "repeated_none_explicit" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "has(TestAllTypes{repeated_int32: []}.repeated_int32)" value { bool_value: false } } test { name: "repeated_one" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "has(TestAllTypes{repeated_int32: [1]}.repeated_int32)" value { bool_value: true } } test { name: "repeated_many" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "has(TestAllTypes{repeated_int32: [1, 2, 3]}.repeated_int32)" value { bool_value: true } } test { name: "map_none_implicit" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "has(TestAllTypes{}.map_string_string)" value { bool_value: false } } test { name: "map_none_explicit" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "has(TestAllTypes{map_string_string: {}}.map_string_string)" value { bool_value: false } } test { name: "map_one_default" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "has(TestAllTypes{map_string_string: {'MT': ''}}.map_string_string)" value { bool_value: true } } test { name: "map_one" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "has(TestAllTypes{map_string_string: {'one': 'uno'}}.map_string_string)" value { bool_value: true } } test { name: "map_many" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "has(TestAllTypes{map_string_string: {'one': 'uno', 'two': 'dos'}}.map_string_string)" value { bool_value: true } } test { name: "required" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "has(TestRequired{required_int32: 4}.required_int32)" value { bool_value: true } } test { name: "optional_unset_no_default" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "has(TestAllTypes{}.single_sint32)" value { bool_value: false } } test { name: "optional_set_no_default" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "has(TestAllTypes{single_sint32: -4}.single_sint32)" value { bool_value: true } } test { name: "optional_unset_with_default" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "has(TestAllTypes{}.single_int32)" value { bool_value: false } } test { name: "optional_set_with_default" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "has(TestAllTypes{single_int32: 16}.single_int32)" value { bool_value: true } } test { name: "optional_set_to_default" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "has(TestAllTypes{single_int32: -32}.single_int32)" value { bool_value: true } } test { name: "optional_message_unset" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "has(TestAllTypes{}.standalone_message)" value { bool_value: false } } test { name: "optional_message_set" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "has(TestAllTypes{standalone_message: TestAllTypes.NestedMessage{}}.standalone_message)" value { bool_value: true } } test { name: "optional_enum_unset" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "has(TestAllTypes{}.standalone_enum)" value { bool_value: false } } test { name: "optional_enum_set" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "has(TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.BAR}.standalone_enum)" value { bool_value: true } } test { name: "optional_enum_set_zero" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "has(TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.FOO}.standalone_enum)" value { bool_value: true } } test { name: "oneof_unset" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "has(TestAllTypes{}.single_nested_message)" value { bool_value: false } } test { name: "oneof_other_set" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "has(TestAllTypes{single_nested_enum: TestAllTypes.NestedEnum.BAZ}.single_nested_message)" value { bool_value: false } } test { name: "oneof_set" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "has(TestAllTypes{single_nested_message: TestAllTypes.NestedMessage{}}.single_nested_message)" value { bool_value: true } } test { name: "oneof_set_default" - container: "google.api.expr.test.v1.proto2" + container: "cel.expr.conformance.proto2" expr: "has(TestAllTypes{single_nested_enum: TestAllTypes.NestedEnum.FOO}.single_nested_enum)" value { bool_value: true } } } +section { + name: "set_null" + test { + name: "single_message" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{single_nested_message: null} == TestAllTypes{}" + value: { bool_value: true } + } + test { + name: "single_any" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{single_any: null}.single_any" + value { null_value: NULL_VALUE } + } + test { + name: "single_value" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{single_value: null}.single_value" + value { null_value: NULL_VALUE } + } + test { + name: "single_duration" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{single_duration: null} == TestAllTypes{}" + value: { bool_value: true } + } + test { + name: "single_timestamp" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{single_timestamp: null} == TestAllTypes{}" + value: { bool_value: true } + } + test { + name: "single_scalar" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{single_bool: null} == TestAllTypes{}" + disable_check: true + eval_error: { + errors: { message: "unsupported field type" } + } + } + test { + name: "repeated" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{repeated_int32: null} == TestAllTypes{}" + disable_check: true + eval_error: { + errors: { message: "unsupported field type" } + } + } + test { + name: "map" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{map_string_string: null} == TestAllTypes{}" + disable_check: true + eval_error: { + errors: { message: "unsupported field type" } + } + } + test { + name: "list_value" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{list_value: null} == TestAllTypes{}" + disable_check: true + eval_error: { + errors: { message: "unsupported field type" } + } + } + test { + name: "single_struct" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{single_struct: null} == TestAllTypes{}" + disable_check: true + eval_error: { + errors: { message: "unsupported field type" } + } + } +} +section { + name: "quoted_fields" + test { + name: "set_field_with_quoted_name" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{`in`: true} == TestAllTypes{}" + value: { bool_value: false } + } + test { + name: "get_field_with_quoted_name" + container: "cel.expr.conformance.proto2" + expr: "TestAllTypes{`in`: true}.`in`" + value: { bool_value: true } + } +} +section: { + name: "extensions_has" + description: "Tests for presence checks on proto2 extension fields." + test: { + name: "package_scoped_int32" + expr: "has(msg.`cel.expr.conformance.proto2.int32_ext`)" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.int32_ext]: 42 + } + } + } + } + } + } + test: { + name: "package_scoped_nested_ext" + expr: "has(msg.`cel.expr.conformance.proto2.nested_ext`)" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.nested_ext]: {} + } + } + } + } + } + } + test: { + name: "package_scoped_test_all_types_ext" + expr: "has(msg.`cel.expr.conformance.proto2.test_all_types_ext`)" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.test_all_types_ext]: {} + } + } + } + } + } + } + test: { + name: "package_scoped_test_all_types_nested_enum_ext" + expr: "has(msg.`cel.expr.conformance.proto2.nested_enum_ext`)" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.nested_enum_ext]: BAR + } + } + } + } + } + } + test: { + name: "package_scoped_repeated_test_all_types" + expr: "has(msg.`cel.expr.conformance.proto2.repeated_test_all_types`)" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.repeated_test_all_types]: [ { single_int64: 1 }, { single_bool: true } ] + } + } + } + } + } + } + test: { + name: "message_scoped_int64" + expr: "has(msg.`cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.int64_ext`)" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.int64_ext]: 42 + } + } + } + } + } + } + test: { + name: "message_scoped_nested_ext" + expr: "has(msg.`cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_nested_ext`)" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_nested_ext]: {} + } + } + } + } + } + } + test: { + name: "message_scoped_nested_enum_ext" + expr: "has(msg.`cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.nested_enum_ext`)" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.nested_enum_ext]: BAR + } + } + } + } + } + } + test: { + name: "message_scoped_repeated_test_all_types" + expr: "has(msg.`cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_repeated_test_all_types`)" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_repeated_test_all_types]: [ { single_int64: 1 }, { single_bool: true } ] + } + } + } + } + } + } +} +section { + name: "extensions_get" + description: "Tests for accessing proto2 extension fields." + test: { + name: "package_scoped_int32" + expr: "msg.`cel.expr.conformance.proto2.int32_ext` == 42" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.int32_ext]: 42 + } + } + } + } + } + } + test: { + name: "package_scoped_nested_ext" + expr: "msg.`cel.expr.conformance.proto2.nested_ext` == cel.expr.conformance.proto2.TestAllTypes{}" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.nested_ext]: {} + } + } + } + } + } + } + test: { + name: "package_scoped_test_all_types_ext" + expr: "msg.`cel.expr.conformance.proto2.test_all_types_ext` == cel.expr.conformance.proto2.TestAllTypes{}" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.test_all_types_ext]: {} + } + } + } + } + } + } + test: { + name: "package_scoped_test_all_types_nested_enum_ext" + expr: "msg.`cel.expr.conformance.proto2.nested_enum_ext` == cel.expr.conformance.proto2.TestAllTypes.NestedEnum.BAR" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.nested_enum_ext]: BAR + } + } + } + } + } + } + test: { + name: "package_scoped_repeated_test_all_types" + expr: "msg.`cel.expr.conformance.proto2.repeated_test_all_types` == [cel.expr.conformance.proto2.TestAllTypes{single_int64: 1}, cel.expr.conformance.proto2.TestAllTypes{single_bool: true}]" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.repeated_test_all_types]: [ { single_int64: 1 }, { single_bool: true } ] + } + } + } + } + } + } + test: { + name: "message_scoped_int64" + expr: "msg.`cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.int64_ext` == 42" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.int64_ext]: 42 + } + } + } + } + } + } + test: { + name: "message_scoped_nested_ext" + expr: "msg.`cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_nested_ext` == cel.expr.conformance.proto2.TestAllTypes{}" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_nested_ext]: {} + } + } + } + } + } + } + test: { + name: "message_scoped_nested_enum_ext" + expr: "msg.`cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.nested_enum_ext` == cel.expr.conformance.proto2.TestAllTypes.NestedEnum.BAR" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.nested_enum_ext]: BAR + } + } + } + } + } + } + test: { + name: "message_scoped_repeated_test_all_types" + expr: "msg.`cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_repeated_test_all_types` == [cel.expr.conformance.proto2.TestAllTypes{single_int64: 1}, cel.expr.conformance.proto2.TestAllTypes{single_bool: true}]" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_repeated_test_all_types]: [ { single_int64: 1 }, { single_bool: true } ] + } + } + } + } + } + } +} diff --git a/features/proto2_ext.feature b/features/proto2_ext.feature new file mode 100644 index 0000000..d112fe5 --- /dev/null +++ b/features/proto2_ext.feature @@ -0,0 +1,154 @@ +@conformance +Feature: proto2_ext + Tests for the proto extension library. + + +# has_ext -- + +@wip +Scenario: has_ext/package_scoped_int32 + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(int32_ext=42) + When CEL expression 'proto.hasExt(msg, cel.expr.conformance.proto2.int32_ext)' is evaluated + Then none is None + +@wip +Scenario: has_ext/package_scoped_nested_ext + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(nested_ext=TestAllTypes()) + When CEL expression 'proto.hasExt(msg, cel.expr.conformance.proto2.nested_ext)' is evaluated + Then none is None + +@wip +Scenario: has_ext/package_scoped_test_all_types_ext + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(test_all_types_ext=TestAllTypes()) + When CEL expression 'proto.hasExt(msg, cel.expr.conformance.proto2.test_all_types_ext)' is evaluated + Then none is None + +@wip +Scenario: has_ext/package_scoped_test_all_types_nested_enum_ext + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(nested_enum_ext=1) + When CEL expression 'proto.hasExt(msg, cel.expr.conformance.proto2.nested_enum_ext)' is evaluated + Then none is None + +@wip +Scenario: has_ext/package_scoped_repeated_test_all_types + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(repeated_test_all_types=[TestAllTypes(single_int64=1), TestAllTypes(single_bool=True)]) + When CEL expression 'proto.hasExt(msg, cel.expr.conformance.proto2.repeated_test_all_types)' is evaluated + Then none is None + +@wip +Scenario: has_ext/message_scoped_int64 + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(int64_ext=42) + When CEL expression 'proto.hasExt(msg, cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.int64_ext)' is evaluated + Then none is None + +@wip +Scenario: has_ext/message_scoped_nested_ext + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(message_scoped_nested_ext=TestAllTypes()) + When CEL expression 'proto.hasExt(msg, cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_nested_ext)' is evaluated + Then none is None + +@wip +Scenario: has_ext/message_scoped_nested_enum_ext + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(nested_enum_ext=1) + When CEL expression 'proto.hasExt(msg, cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.nested_enum_ext)' is evaluated + Then none is None + +@wip +Scenario: has_ext/message_scoped_repeated_test_all_types + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(message_scoped_repeated_test_all_types=[TestAllTypes(single_int64=1), TestAllTypes(single_bool=True)]) + When CEL expression 'proto.hasExt(msg, cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_repeated_test_all_types)' is evaluated + Then none is None + + +# get_ext -- + +@wip +Scenario: get_ext/package_scoped_int32 + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(int32_ext=42) + When CEL expression 'proto.getExt(msg, cel.expr.conformance.proto2.int32_ext) == 42' is evaluated + Then none is None + +@wip +Scenario: get_ext/package_scoped_nested_ext + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(nested_ext=TestAllTypes()) + When CEL expression 'proto.getExt(msg, cel.expr.conformance.proto2.nested_ext) == cel.expr.conformance.proto2.TestAllTypes{}' is evaluated + Then none is None + +@wip +Scenario: get_ext/package_scoped_test_all_types_ext + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(test_all_types_ext=TestAllTypes()) + When CEL expression 'proto.getExt(msg, cel.expr.conformance.proto2.test_all_types_ext) == cel.expr.conformance.proto2.TestAllTypes{}' is evaluated + Then none is None + +@wip +Scenario: get_ext/package_scoped_test_all_types_nested_enum_ext + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(nested_enum_ext=1) + When CEL expression 'proto.getExt(msg, cel.expr.conformance.proto2.nested_enum_ext) == cel.expr.conformance.proto2.TestAllTypes.NestedEnum.BAR' is evaluated + Then none is None + +@wip +Scenario: get_ext/package_scoped_repeated_test_all_types + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(repeated_test_all_types=[TestAllTypes(single_int64=1), TestAllTypes(single_bool=True)]) + When CEL expression 'proto.getExt(msg, cel.expr.conformance.proto2.repeated_test_all_types) == [cel.expr.conformance.proto2.TestAllTypes{single_int64: 1}, cel.expr.conformance.proto2.TestAllTypes{single_bool: true}]' is evaluated + Then none is None + +@wip +Scenario: get_ext/message_scoped_int64 + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(int64_ext=42) + When CEL expression 'proto.getExt(msg, cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.int64_ext) == 42' is evaluated + Then none is None + +@wip +Scenario: get_ext/message_scoped_nested_ext + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(message_scoped_nested_ext=TestAllTypes()) + When CEL expression 'proto.getExt(msg, cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_nested_ext) == cel.expr.conformance.proto2.TestAllTypes{}' is evaluated + Then none is None + +@wip +Scenario: get_ext/message_scoped_nested_enum_ext + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(nested_enum_ext=1) + When CEL expression 'proto.getExt(msg, cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.nested_enum_ext) == cel.expr.conformance.proto2.TestAllTypes.NestedEnum.BAR' is evaluated + Then none is None + +@wip +Scenario: get_ext/message_scoped_repeated_test_all_types + + Given type_env parameter "msg" is celpy.celtypes.MessageType + and bindings parameter "msg" is TestAllTypes(message_scoped_repeated_test_all_types=[TestAllTypes(single_int64=1), TestAllTypes(single_bool=True)]) + When CEL expression 'proto.getExt(msg, cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_repeated_test_all_types) == [cel.expr.conformance.proto2.TestAllTypes{single_int64: 1}, cel.expr.conformance.proto2.TestAllTypes{single_bool: true}]' is evaluated + Then none is None + diff --git a/features/proto2_ext.textproto b/features/proto2_ext.textproto new file mode 100644 index 0000000..efd3fa4 --- /dev/null +++ b/features/proto2_ext.textproto @@ -0,0 +1,372 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: cel.expr.conformance.test.SimpleTestFile + +name: "proto2_ext" +description: "Tests for the proto extension library." +section: { + name: "has_ext" + test: { + name: "package_scoped_int32" + expr: "proto.hasExt(msg, cel.expr.conformance.proto2.int32_ext)" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.int32_ext]: 42 + } + } + } + } + } + } + test: { + name: "package_scoped_nested_ext" + expr: "proto.hasExt(msg, cel.expr.conformance.proto2.nested_ext)" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.nested_ext]: {} + } + } + } + } + } + } + test: { + name: "package_scoped_test_all_types_ext" + expr: "proto.hasExt(msg, cel.expr.conformance.proto2.test_all_types_ext)" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.test_all_types_ext]: {} + } + } + } + } + } + } + test: { + name: "package_scoped_test_all_types_nested_enum_ext" + expr: "proto.hasExt(msg, cel.expr.conformance.proto2.nested_enum_ext)" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.nested_enum_ext]: BAR + } + } + } + } + } + } + test: { + name: "package_scoped_repeated_test_all_types" + expr: "proto.hasExt(msg, cel.expr.conformance.proto2.repeated_test_all_types)" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.repeated_test_all_types]: [ { single_int64: 1 }, { single_bool: true } ] + } + } + } + } + } + } + test: { + name: "message_scoped_int64" + expr: "proto.hasExt(msg, cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.int64_ext)" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.int64_ext]: 42 + } + } + } + } + } + } + test: { + name: "message_scoped_nested_ext" + expr: "proto.hasExt(msg, cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_nested_ext)" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_nested_ext]: {} + } + } + } + } + } + } + test: { + name: "message_scoped_nested_enum_ext" + expr: "proto.hasExt(msg, cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.nested_enum_ext)" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.nested_enum_ext]: BAR + } + } + } + } + } + } + test: { + name: "message_scoped_repeated_test_all_types" + expr: "proto.hasExt(msg, cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_repeated_test_all_types)" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_repeated_test_all_types]: [ { single_int64: 1 }, { single_bool: true } ] + } + } + } + } + } + } +} + +section: { + name: "get_ext" + test: { + name: "package_scoped_int32" + expr: "proto.getExt(msg, cel.expr.conformance.proto2.int32_ext) == 42" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.int32_ext]: 42 + } + } + } + } + } + } + test: { + name: "package_scoped_nested_ext" + expr: "proto.getExt(msg, cel.expr.conformance.proto2.nested_ext) == cel.expr.conformance.proto2.TestAllTypes{}" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.nested_ext]: {} + } + } + } + } + } + } + test: { + name: "package_scoped_test_all_types_ext" + expr: "proto.getExt(msg, cel.expr.conformance.proto2.test_all_types_ext) == cel.expr.conformance.proto2.TestAllTypes{}" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.test_all_types_ext]: {} + } + } + } + } + } + } + test: { + name: "package_scoped_test_all_types_nested_enum_ext" + expr: "proto.getExt(msg, cel.expr.conformance.proto2.nested_enum_ext) == cel.expr.conformance.proto2.TestAllTypes.NestedEnum.BAR" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.nested_enum_ext]: BAR + } + } + } + } + } + } + test: { + name: "package_scoped_repeated_test_all_types" + expr: "proto.getExt(msg, cel.expr.conformance.proto2.repeated_test_all_types) == [cel.expr.conformance.proto2.TestAllTypes{single_int64: 1}, cel.expr.conformance.proto2.TestAllTypes{single_bool: true}]" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.repeated_test_all_types]: [ { single_int64: 1 }, { single_bool: true } ] + } + } + } + } + } + } + test: { + name: "message_scoped_int64" + expr: "proto.getExt(msg, cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.int64_ext) == 42" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.int64_ext]: 42 + } + } + } + } + } + } + test: { + name: "message_scoped_nested_ext" + expr: "proto.getExt(msg, cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_nested_ext) == cel.expr.conformance.proto2.TestAllTypes{}" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_nested_ext]: {} + } + } + } + } + } + } + test: { + name: "message_scoped_nested_enum_ext" + expr: "proto.getExt(msg, cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.nested_enum_ext) == cel.expr.conformance.proto2.TestAllTypes.NestedEnum.BAR" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.nested_enum_ext]: BAR + } + } + } + } + } + } + test: { + name: "message_scoped_repeated_test_all_types" + expr: "proto.getExt(msg, cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_repeated_test_all_types) == [cel.expr.conformance.proto2.TestAllTypes{single_int64: 1}, cel.expr.conformance.proto2.TestAllTypes{single_bool: true}]" + type_env: { + name: "msg" + ident: { type: { message_type: "cel.expr.conformance.proto2.TestAllTypes" } } + } + bindings: { + key: "msg" + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]: { + [cel.expr.conformance.proto2.Proto2ExtensionScopedMessage.message_scoped_repeated_test_all_types]: [ { single_int64: 1 }, { single_bool: true } ] + } + } + } + } + } + } +} diff --git a/features/proto3.feature b/features/proto3.feature index 7650aeb..94a7eb2 100644 --- a/features/proto3.feature +++ b/features/proto3.feature @@ -1,580 +1,515 @@ -@wip +@conformance Feature: proto3 - Protocol buffer version 3 tests. See notes for the available set of protos for tests. - -# literal_singular -- Literals with singular fields set. - -Scenario: int64_nocontainer - - When CEL expression "google.api.expr.test.v1.proto3.TestAllTypes{single_int64: 17}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_int64:17}} - Then value is TestAllTypes(single_int32=0, single_int64=17, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: int32 - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_int32: -34}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_int32:-34}} - Then value is TestAllTypes(single_int32=-34, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: int64 - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_int64: 17}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_int64:17}} - Then value is TestAllTypes(single_int32=0, single_int64=17, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: uint32 - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_uint32: 1u}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_uint32:1}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=1, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Protocol buffer version 3 tests. See notes for the available set of + protos for tests. -Scenario: uint64 - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_uint64: 9999u}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_uint64:9999}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=9999, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: sint32 - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_sint32: -3}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_sint32:-3}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=-3, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: sint64 - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_sint64: 255}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_sint64:255}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=255, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: fixed32 +# literal_singular -- Literals with singular fields set. - Given container is "google.api.expr.test.v1.proto3" +@wip +Scenario: literal_singular/int64_nocontainer - When CEL expression "TestAllTypes{single_fixed32: 43u}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_fixed32:43}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=43, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + When CEL expression 'cel.expr.conformance.proto3.TestAllTypes{single_int64: 17}' is evaluated + Then value is TestAllTypes(single_int64=17) +Scenario: literal_singular/int32 -Scenario: fixed64 + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_int32: -34}' is evaluated + Then value is TestAllTypes(single_int32=-34) - Given container is "google.api.expr.test.v1.proto3" +Scenario: literal_singular/int64 - When CEL expression "TestAllTypes{single_fixed64: 1880u}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_fixed64:1880}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=1880, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_int64: 17}' is evaluated + Then value is TestAllTypes(single_int64=17) +Scenario: literal_singular/uint32 -Scenario: sfixed32 + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_uint32: 1u}' is evaluated + Then value is TestAllTypes(single_uint32=1) - Given container is "google.api.expr.test.v1.proto3" +Scenario: literal_singular/uint64 - When CEL expression "TestAllTypes{single_sfixed32: -404}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_sfixed32:-404}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=-404, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_uint64: 9999u}' is evaluated + Then value is TestAllTypes(single_uint64=9999) +Scenario: literal_singular/sint32 -Scenario: sfixed64 + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_sint32: -3}' is evaluated + Then value is TestAllTypes(single_sint32=-3) - Given container is "google.api.expr.test.v1.proto3" +Scenario: literal_singular/sint64 - When CEL expression "TestAllTypes{single_sfixed64: -1}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_sfixed64:-1}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=-1, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_sint64: 255}' is evaluated + Then value is TestAllTypes(single_sint64=255) +Scenario: literal_singular/fixed32 -Scenario: float + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_fixed32: 43u}' is evaluated + Then value is TestAllTypes(single_fixed32=43) - Given container is "google.api.expr.test.v1.proto3" +Scenario: literal_singular/fixed64 - When CEL expression "TestAllTypes{single_float: 3.1416}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_float:3.1416}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=3.1416, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_fixed64: 1880u}' is evaluated + Then value is TestAllTypes(single_fixed64=1880) +Scenario: literal_singular/sfixed32 -Scenario: double + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_sfixed32: -404}' is evaluated + Then value is TestAllTypes(single_sfixed32=-404) - Given container is "google.api.expr.test.v1.proto3" +Scenario: literal_singular/sfixed64 - When CEL expression "TestAllTypes{single_double: 6.022e23}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_double:6.022e+23}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=6.022e+23, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_sfixed64: -1}' is evaluated + Then value is TestAllTypes(single_sfixed64=-1) +@wip +Scenario: literal_singular/float -Scenario: bool + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_float: 3.1416}' is evaluated + Then value is TestAllTypes(single_float=3.1415998935699463) - Given container is "google.api.expr.test.v1.proto3" +Scenario: literal_singular/double - When CEL expression "TestAllTypes{single_bool: true}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_bool:true}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=True, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_double: 6.022e23}' is evaluated + Then value is TestAllTypes(single_double=6.022e+23) +Scenario: literal_singular/bool -Scenario: string + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_bool: true}' is evaluated + Then value is TestAllTypes(single_bool=True) - Given container is "google.api.expr.test.v1.proto3" +Scenario: literal_singular/string + Given container is 'cel.expr.conformance.proto3' When CEL expression "TestAllTypes{single_string: 'foo'}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_string:"foo"}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='foo', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: bytes + Then value is TestAllTypes(single_string='foo') - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_bytes: b'\377'}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_bytes:"\xff"}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes='ÿ', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) +Scenario: literal_singular/bytes + Given container is 'cel.expr.conformance.proto3' + When CEL expression "TestAllTypes{single_bytes: b'\\377'}" is evaluated + Then value is TestAllTypes(single_bytes=b'\xff') # literal_wellknown -- Literals with well-known fields set. -Scenario: any - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_any: TestAllTypes{single_int32: 1}}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_any:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_int32:1}}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=TestAllTypes(single_int32=1, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]), single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) +Scenario: literal_wellknown/any + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_any: TestAllTypes{single_int32: 1}}' is evaluated + Then value is TestAllTypes(single_any=TestAllTypes(single_int32=1)) -Scenario: duration - - Given container is "google.api.expr.test.v1.proto3" +Scenario: literal_wellknown/duration + Given container is 'cel.expr.conformance.proto3' When CEL expression "TestAllTypes{single_duration: duration('123s')}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_duration:{seconds:123}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=123, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - + Then value is TestAllTypes(single_duration=celpy.celtypes.DurationType(seconds=123, nanos=0)) -Scenario: timestamp - - Given container is "google.api.expr.test.v1.proto3" +Scenario: literal_wellknown/timestamp + Given container is 'cel.expr.conformance.proto3' When CEL expression "TestAllTypes{single_timestamp: timestamp('2009-02-13T23:31:30Z')}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_timestamp:{seconds:1234567890}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=1234567890, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - + Then value is TestAllTypes(single_timestamp=celpy.celtypes.TimestampType(datetime.datetime(2009, 2, 13, 23, 31, 30, tzinfo=datetime.timezone.utc))) -Scenario: struct - - Given container is "google.api.expr.test.v1.proto3" +@wip +Scenario: literal_wellknown/struct + Given container is 'cel.expr.conformance.proto3' When CEL expression "TestAllTypes{single_struct: {'one': 1, 'two': 2}}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_struct:{fields:{key:"one" value:{number_value:1}} fields:{key:"two" value:{number_value:2}}}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({'one': DoubleType(source=1), 'two': DoubleType(source=2)}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Then value is TestAllTypes(single_struct=celpy.celtypes.MapType({'one': celpy.celtypes.DoubleType(source=1.0), 'two': celpy.celtypes.DoubleType(source=2.0)})) +Scenario: literal_wellknown/value -Scenario: value - - Given container is "google.api.expr.test.v1.proto3" - + Given container is 'cel.expr.conformance.proto3' When CEL expression "TestAllTypes{single_value: 'foo'}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_value:{string_value:"foo"}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=StringType(source='foo'), single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: int64_wrapper - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_int64_wrapper: -321}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_int64_wrapper:{value:-321}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=-321, single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: int32_wrapper + Then value is TestAllTypes(single_value=celpy.celtypes.StringType(source='foo')) - Given container is "google.api.expr.test.v1.proto3" +Scenario: literal_wellknown/int64_wrapper - When CEL expression "TestAllTypes{single_int32_wrapper: -456}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_int32_wrapper:{value:-456}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=-456, single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_int64_wrapper: -321}' is evaluated + Then value is TestAllTypes(single_int64_wrapper=celpy.celtypes.IntType(source=-321)) +Scenario: literal_wellknown/int32_wrapper -Scenario: double_wrapper + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_int32_wrapper: -456}' is evaluated + Then value is TestAllTypes(single_int32_wrapper=celpy.celtypes.IntType(source=-456)) - Given container is "google.api.expr.test.v1.proto3" +Scenario: literal_wellknown/double_wrapper - When CEL expression "TestAllTypes{single_double_wrapper: 2.71828}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_double_wrapper:{value:2.71828}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=2.71828, single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_double_wrapper: 2.71828}' is evaluated + Then value is TestAllTypes(single_double_wrapper=celpy.celtypes.DoubleType(source=2.71828)) +Scenario: literal_wellknown/float_wrapper -Scenario: float_wrapper + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_float_wrapper: 2.99792e8}' is evaluated + Then value is TestAllTypes(single_float_wrapper=celpy.celtypes.DoubleType(source=299792000.0)) - Given container is "google.api.expr.test.v1.proto3" +Scenario: literal_wellknown/uint64_wrapper - When CEL expression "TestAllTypes{single_float_wrapper: 2.99792e8}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_float_wrapper:{value:2.99792e+08}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=299792000.0, single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_uint64_wrapper: 8675309u}' is evaluated + Then value is TestAllTypes(single_uint64_wrapper=celpy.celtypes.UintType(source=8675309)) +Scenario: literal_wellknown/uint32_wrapper -Scenario: uint64_wrapper + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_uint32_wrapper: 987u}' is evaluated + Then value is TestAllTypes(single_uint32_wrapper=celpy.celtypes.UintType(source=987)) - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_uint64_wrapper: 8675309u}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_uint64_wrapper:{value:8675309}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=8675309, single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: uint32_wrapper - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_uint32_wrapper: 987u}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_uint32_wrapper:{value:987}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=987, single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: string_wrapper - - Given container is "google.api.expr.test.v1.proto3" +Scenario: literal_wellknown/string_wrapper + Given container is 'cel.expr.conformance.proto3' When CEL expression "TestAllTypes{single_string_wrapper: 'hubba'}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_string_wrapper:{value:"hubba"}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper='hubba', single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: bool_wrapper - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_bool_wrapper: true}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_bool_wrapper:{value:true}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=True, single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - -Scenario: bytes_wrapper - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{single_bytes_wrapper: b'\301\103'}" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_bytes_wrapper:{value:"\xc1C"}}} - Then value is TestAllTypes(single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper='ÁC', list_value=[]) + Then value is TestAllTypes(single_string_wrapper=celpy.celtypes.StringType(source='hubba')) +Scenario: literal_wellknown/bool_wrapper + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_bool_wrapper: true}' is evaluated + Then value is TestAllTypes(single_bool_wrapper=celpy.celtypes.BoolType(source=True)) -# singular_bind -- Binding the singlular fields. +Scenario: literal_wellknown/bytes_wrapper -Scenario: int32 + Given container is 'cel.expr.conformance.proto3' + When CEL expression "TestAllTypes{single_bytes_wrapper: b'\\301\\103'}" is evaluated + Then value is TestAllTypes(single_bytes_wrapper=celpy.celtypes.BytesType(source=b'\xc1C')) - # type:{message_type:"google.api.expr.test.v1.proto3.TestAllTypes"} - Given type_env parameter "x" is TypeType(value='google.api.expr.test.v1.proto3.TestAllTypes') - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_int32:17}} - Given bindings parameter "x" is TestAllTypes(single_int32=17, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) +# singular_bind -- Binding the singular fields. - When CEL expression "x.single_int32" is evaluated - # int64_value:17 - Then value is IntType(source=17) +Scenario: singular_bind/int32 + Given type_env parameter "x" is celpy.celtypes.MessageType + and bindings parameter "x" is TestAllTypes(single_int32=17) + When CEL expression 'x.single_int32' is evaluated + Then value is celpy.celtypes.IntType(source=17) -Scenario: int64 - - # type:{message_type:"google.api.expr.test.v1.proto3.TestAllTypes"} - Given type_env parameter "x" is TypeType(value='google.api.expr.test.v1.proto3.TestAllTypes') - - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_int64:-99}} - Given bindings parameter "x" is TestAllTypes(single_int32=0, single_int64=-99, single_uint32=0, single_uint64=0, single_sint32=0, single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, single_struct=MapType({}), single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), list_value=[]) - - When CEL expression "x.single_int64" is evaluated - # int64_value:-99 - Then value is IntType(source=-99) +Scenario: singular_bind/int64 + Given type_env parameter "x" is celpy.celtypes.MessageType + and bindings parameter "x" is TestAllTypes(single_int64=-99) + When CEL expression 'x.single_int64' is evaluated + Then value is celpy.celtypes.IntType(source=-99) # empty_field -- Tests on empty fields. -Scenario: scalar - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{}.single_fixed32" is evaluated - # uint64_value:0 - Then value is UintType(source=0) - +@wip +Scenario: empty_field/scalar -Scenario: nested_message + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{}.single_fixed32' is evaluated + Then value is celpy.celtypes.UintType(source=0) - Given container is "google.api.expr.test.v1.proto3" +Scenario: empty_field/nested_message - When CEL expression "TestAllTypes{}.single_nested_message" is evaluated - # object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes.NestedMessage]:{}} + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{}.single_nested_message' is evaluated Then value is NestedMessage() +@wip +Scenario: empty_field/nested_message_subfield -Scenario: nested_message_subfield - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{}.single_nested_message.bb" is evaluated - # int64_value:0 - Then value is IntType(source=0) - - -Scenario: wkt + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{}.single_nested_message.bb' is evaluated + Then value is celpy.celtypes.IntType(source=0) - Given container is "google.api.expr.test.v1.proto3" +@wip +Scenario: empty_field/wkt - When CEL expression "TestAllTypes{}.single_int64_wrapper" is evaluated - # null_value:NULL_VALUE + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{}.single_int64_wrapper' is evaluated Then value is None +@wip +Scenario: empty_field/repeated_scalar -Scenario: repeated_scalar - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{}.repeated_int64" is evaluated - # list_value:{} + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{}.repeated_int64' is evaluated Then value is [] +@wip +Scenario: empty_field/repeated_enum -Scenario: repeated_nested - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "TestAllTypes{}.repeated_nested_message" is evaluated - # list_value:{} + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{}.repeated_nested_enum' is evaluated Then value is [] +@wip +Scenario: empty_field/repeated_nested -Scenario: map - - Given container is "google.api.expr.test.v1.proto3" + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{}.repeated_nested_message' is evaluated + Then value is [] - When CEL expression "TestAllTypes{}.map_string_string" is evaluated - # map_value:{} - Then value is MapType({}) +Scenario: empty_field/map + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{}.map_string_string' is evaluated + Then value is celpy.celtypes.MapType({}) # has -- Tests for the has() macro on proto3 messages. -Scenario: undefined - - Given container is "google.api.expr.test.v1.proto3" +@wip +Scenario: has/undefined - When CEL expression "has(TestAllTypes{}.no_such_field)" is evaluated - # errors:{message:"no_such_field"} + Given disable_check parameter is True + and container is 'cel.expr.conformance.proto3' + When CEL expression 'has(TestAllTypes{}.no_such_field)' is evaluated Then eval_error is 'no_such_field' +@wip +Scenario: has/repeated_none_implicit -Scenario: repeated_none_implicit - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "has(TestAllTypes{}.repeated_int32)" is evaluated - # bool_value:false - Then value is BoolType(source=False) - - -Scenario: repeated_none_explicit - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "has(TestAllTypes{repeated_int32: []}.repeated_int32)" is evaluated - # bool_value:false - Then value is BoolType(source=False) - - -Scenario: repeated_one - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "has(TestAllTypes{repeated_int32: [1]}.repeated_int32)" is evaluated - # bool_value:true - Then value is BoolType(source=True) - - -Scenario: repeated_many - - Given container is "google.api.expr.test.v1.proto3" - - When CEL expression "has(TestAllTypes{repeated_int32: [1, 2, 3]}.repeated_int32)" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'has(TestAllTypes{}.repeated_int32)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +@wip +Scenario: has/repeated_none_explicit -Scenario: map_none_implicit + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'has(TestAllTypes{repeated_int32: []}.repeated_int32)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - Given container is "google.api.expr.test.v1.proto3" +Scenario: has/repeated_one - When CEL expression "has(TestAllTypes{}.map_string_string)" is evaluated - # bool_value:false - Then value is BoolType(source=False) + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'has(TestAllTypes{repeated_int32: [1]}.repeated_int32)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: has/repeated_many -Scenario: map_none_explicit + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'has(TestAllTypes{repeated_int32: [1, 2, 3]}.repeated_int32)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - Given container is "google.api.expr.test.v1.proto3" +@wip +Scenario: has/map_none_implicit - When CEL expression "has(TestAllTypes{map_string_string: {}}.map_string_string)" is evaluated - # bool_value:false - Then value is BoolType(source=False) + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'has(TestAllTypes{}.map_string_string)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +@wip +Scenario: has/map_none_explicit -Scenario: map_one_default + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'has(TestAllTypes{map_string_string: {}}.map_string_string)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - Given container is "google.api.expr.test.v1.proto3" +Scenario: has/map_one_default + Given container is 'cel.expr.conformance.proto3' When CEL expression "has(TestAllTypes{map_string_string: {'MT': ''}}.map_string_string)" is evaluated - # bool_value:true - Then value is BoolType(source=True) - + Then value is celpy.celtypes.BoolType(source=True) -Scenario: map_one - - Given container is "google.api.expr.test.v1.proto3" +Scenario: has/map_one + Given container is 'cel.expr.conformance.proto3' When CEL expression "has(TestAllTypes{map_string_string: {'one': 'uno'}}.map_string_string)" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Then value is celpy.celtypes.BoolType(source=True) +Scenario: has/map_many -Scenario: map_many + Given container is 'cel.expr.conformance.proto3' + When CEL expression "has(TestAllTypes{map_string_string: {'one': 'uno', 'two': 'dos'}}.map_string_string)" is evaluated + Then value is celpy.celtypes.BoolType(source=True) - Given container is "google.api.expr.test.v1.proto3" +@wip +Scenario: has/single_unset - When CEL expression "has(TestAllTypes{map_string_string: {'one': 'uno', 'two': 'dos'}}.map_string_string)" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'has(TestAllTypes{}.single_int32)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +Scenario: has/single_set -Scenario: single_unset + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'has(TestAllTypes{single_int32: 16}.single_int32)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - Given container is "google.api.expr.test.v1.proto3" +@wip +Scenario: has/single_set_to_default - When CEL expression "has(TestAllTypes{}.single_int32)" is evaluated - # bool_value:false - Then value is BoolType(source=False) + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'has(TestAllTypes{single_int32: 0}.single_int32)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) +@wip +Scenario: has/single_message_unset -Scenario: single_set + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'has(TestAllTypes{}.standalone_message)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - Given container is "google.api.expr.test.v1.proto3" +@wip +Scenario: has/single_message_set - When CEL expression "has(TestAllTypes{single_int32: 16}.single_int32)" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'has(TestAllTypes{standalone_message: TestAllTypes.NestedMessage{bb: 123}}.standalone_message)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) +@wip +Scenario: has/single_message_set_to_default -Scenario: single_set_to_default + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'has(TestAllTypes{standalone_message: TestAllTypes.NestedMessage{}}.standalone_message)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - Given container is "google.api.expr.test.v1.proto3" +@wip +Scenario: has/single_enum_unset + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'has(TestAllTypes{}.standalone_enum)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "has(TestAllTypes{single_int32: 0}.single_int32)" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: has/single_enum_set + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'has(TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.BAR}.standalone_enum)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: single_message_unset +Scenario: has/single_enum_set_zero - Given container is "google.api.expr.test.v1.proto3" + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'has(TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.FOO}.standalone_enum)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "has(TestAllTypes{}.standalone_message)" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: has/oneof_unset + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'has(TestAllTypes{}.single_nested_message)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: single_message_set +@wip +Scenario: has/oneof_other_set - Given container is "google.api.expr.test.v1.proto3" + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'has(TestAllTypes{single_nested_enum: TestAllTypes.NestedEnum.BAZ}.single_nested_message)' is evaluated + Then value is celpy.celtypes.BoolType(source=False) - When CEL expression "has(TestAllTypes{standalone_message: TestAllTypes.NestedMessage{bb: 123}}.standalone_message)" is evaluated - # bool_value:true - Then value is BoolType(source=True) +@wip +Scenario: has/oneof_set + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'has(TestAllTypes{single_nested_message: TestAllTypes.NestedMessage{}}.single_nested_message)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: single_message_set_to_default +@wip +Scenario: has/oneof_set_default - Given container is "google.api.expr.test.v1.proto3" + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'has(TestAllTypes{single_nested_enum: TestAllTypes.NestedEnum.FOO}.single_nested_enum)' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "has(TestAllTypes{standalone_message: TestAllTypes.NestedMessage{}}.standalone_message)" is evaluated - # bool_value:true - Then value is BoolType(source=True) +# set_null -- -Scenario: single_enum_unset +Scenario: set_null/single_message - Given container is "google.api.expr.test.v1.proto3" + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_nested_message: null} == TestAllTypes{}' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "has(TestAllTypes{}.standalone_enum)" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: set_null/single_any + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_any: null}.single_any' is evaluated + Then value is None -Scenario: single_enum_set +Scenario: set_null/single_value - Given container is "google.api.expr.test.v1.proto3" + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_value: null}.single_value' is evaluated + Then value is None - When CEL expression "has(TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.BAR}.standalone_enum)" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: set_null/single_duration + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_duration: null} == TestAllTypes{}' is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: single_enum_set_zero +Scenario: set_null/single_timestamp - Given container is "google.api.expr.test.v1.proto3" + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_timestamp: null} == TestAllTypes{}' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "has(TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.FOO}.standalone_enum)" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: set_null/single_scalar + Given disable_check parameter is True + and container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_bool: null} == TestAllTypes{}' is evaluated + Then eval_error is 'unsupported field type' -Scenario: oneof_unset +@wip +Scenario: set_null/repeated - Given container is "google.api.expr.test.v1.proto3" + Given disable_check parameter is True + and container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{repeated_int32: null} == TestAllTypes{}' is evaluated + Then eval_error is 'unsupported field type' - When CEL expression "has(TestAllTypes{}.single_nested_message)" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: set_null/map + Given disable_check parameter is True + and container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{map_string_string: null} == TestAllTypes{}' is evaluated + Then eval_error is 'unsupported field type' -Scenario: oneof_other_set +@wip +Scenario: set_null/list_value - Given container is "google.api.expr.test.v1.proto3" + Given disable_check parameter is True + and container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{list_value: null} == TestAllTypes{}' is evaluated + Then eval_error is 'unsupported field type' - When CEL expression "has(TestAllTypes{single_nested_enum: TestAllTypes.NestedEnum.BAZ}.single_nested_message)" is evaluated - # bool_value:false - Then value is BoolType(source=False) +@wip +Scenario: set_null/single_struct + Given disable_check parameter is True + and container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_struct: null} == TestAllTypes{}' is evaluated + Then eval_error is 'unsupported field type' -Scenario: oneof_set - Given container is "google.api.expr.test.v1.proto3" +# quoted_fields -- - When CEL expression "has(TestAllTypes{single_nested_message: TestAllTypes.NestedMessage{}}.single_nested_message)" is evaluated - # bool_value:true - Then value is BoolType(source=True) +@wip +Scenario: quoted_fields/set_field + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{`in`: true} == TestAllTypes{}' is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: oneof_set_default +@wip +Scenario: quoted_fields/get_field - Given container is "google.api.expr.test.v1.proto3" + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{`in`: true}.`in`' is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "has(TestAllTypes{single_nested_enum: TestAllTypes.NestedEnum.FOO}.single_nested_enum)" is evaluated - # bool_value:true - Then value is BoolType(source=True) diff --git a/features/proto3.textproto b/features/proto3.textproto index 363b3ec..2a0378d 100644 --- a/features/proto3.textproto +++ b/features/proto3.textproto @@ -1,3 +1,6 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: cel.expr.conformance.test.SimpleTestFile + name: "proto3" description: "Protocol buffer version 3 tests. See notes for the available set of protos for tests." @@ -7,191 +10,175 @@ section { test { name: "int64_nocontainer" - expr: "google.api.expr.test.v1.proto3.TestAllTypes{single_int64: 17}" + expr: "cel.expr.conformance.proto3.TestAllTypes{single_int64: 17}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] - { single_int64: 17 } + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_int64: 17 } } } } test { name: "int32" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_int32: -34}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] - { single_int32: -34 } + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_int32: -34 } } } } test { name: "int64" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_int64: 17}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] - { single_int64: 17 } + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_int64: 17 } } } } test { name: "uint32" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_uint32: 1u}" value { object_value: { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] - { single_uint32: 1 } + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_uint32: 1 } } } } test { name: "uint64" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_uint64: 9999u}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] - { single_uint64: 9999 } + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_uint64: 9999 } } } } test { name: "sint32" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_sint32: -3}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] - { single_sint32: -3 } + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_sint32: -3 } } } } test { name: "sint64" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_sint64: 255}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] - { single_sint64: 255 } + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_sint64: 255 } } } } test { name: "fixed32" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_fixed32: 43u}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] - { single_fixed32: 43 } + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_fixed32: 43 } } } } test { name: "fixed64" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_fixed64: 1880u}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] - { single_fixed64: 1880 } + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_fixed64: 1880 } } } } test { name: "sfixed32" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_sfixed32: -404}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] - { single_sfixed32: -404 } + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_sfixed32: -404 } } } } test { name: "sfixed64" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_sfixed64: -1}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] - { single_sfixed64: -1 } + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_sfixed64: -1 } } } } test { name: "float" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_float: 3.1416}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] - { single_float: 3.1416 } + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_float: 3.1416 } } } } test { name: "double" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_double: 6.022e23}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] - { single_double: 6.022e23 } + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_double: 6.022e23 } } } } test { name: "bool" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_bool: true}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] - { single_bool: true } + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_bool: true } } } } test { name: "string" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_string: 'foo'}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] - { single_string: 'foo' } + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_string: "foo" } } } } test { name: "bytes" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_bytes: b'\\377'}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] - { single_bytes: '\377' } + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_bytes: "\377" } } } } @@ -203,14 +190,14 @@ section { test { name: "any" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_any: TestAllTypes{single_int32: 1}}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] { - single_any { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] { - single_int32: 1 + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + single_any { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + single_int32: 1 } } } @@ -220,11 +207,11 @@ section { test { name: "duration" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_duration: duration('123s')}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_duration { seconds: 123 } @@ -235,11 +222,11 @@ section { test { name: "timestamp" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_timestamp: timestamp('2009-02-13T23:31:30Z')}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_timestamp { seconds: 1234567890 } @@ -250,11 +237,11 @@ section { test { name: "struct" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_struct: {'one': 1, 'two': 2}}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_struct { fields { key: "one" @@ -272,11 +259,11 @@ section { test { name: "value" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_value: 'foo'}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_value { string_value: "foo" } @@ -287,11 +274,11 @@ section { test { name: "int64_wrapper" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_int64_wrapper: -321}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_int64_wrapper { value: -321 } @@ -302,11 +289,11 @@ section { test { name: "int32_wrapper" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_int32_wrapper: -456}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_int32_wrapper { value: -456 } @@ -317,11 +304,11 @@ section { test { name: "double_wrapper" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_double_wrapper: 2.71828}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_double_wrapper { value: 2.71828 } @@ -332,11 +319,11 @@ section { test { name: "float_wrapper" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_float_wrapper: 2.99792e8}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_float_wrapper { value: 2.99792e8 } @@ -345,14 +332,13 @@ section { } } - test { name: "uint64_wrapper" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_uint64_wrapper: 8675309u}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_uint64_wrapper { value: 8675309 } @@ -361,14 +347,13 @@ section { } } - test { name: "uint32_wrapper" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_uint32_wrapper: 987u}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_uint32_wrapper { value: 987 } @@ -377,14 +362,13 @@ section { } } - test { name: "string_wrapper" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_string_wrapper: 'hubba'}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_string_wrapper { value: "hubba" } @@ -393,14 +377,13 @@ section { } } - test { name: "bool_wrapper" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_bool_wrapper: true}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_bool_wrapper { value: true } @@ -409,14 +392,13 @@ section { } } - test { name: "bytes_wrapper" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{single_bytes_wrapper: b'\\301\\103'}" value { object_value { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_bytes_wrapper { value: "\301\103" } @@ -429,21 +411,24 @@ section { section { name: "singular_bind" - description: "Binding the singlular fields." + description: "Binding the singular fields." test { name: "int32" expr: "x.single_int32" type_env: { name: "x" - ident: { type: { message_type: "google.api.expr.test.v1.proto3.TestAllTypes" } } + ident: { type: { message_type: "cel.expr.conformance.proto3.TestAllTypes" } } } bindings: { key: "x" - value: { value: { object_value: { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] - { single_int32: 17 } - }}} + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_int32: 17 } + } + } + } } value: { int64_value: 17 } } @@ -453,14 +438,17 @@ section { expr: "x.single_int64" type_env: { name: "x" - ident { type { message_type: "google.api.expr.test.v1.proto3.TestAllTypes" } } + ident { type { message_type: "cel.expr.conformance.proto3.TestAllTypes" } } } bindings: { key: "x" - value: { value: { object_value: { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes] - { single_int64: -99 } - }}} + value: { + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { single_int64: -99 } + } + } + } } value: { int64_value: -99 } } @@ -472,51 +460,60 @@ section { test { name: "scalar" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{}.single_fixed32" value: { uint64_value: 0 } } test { name: "nested_message" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{}.single_nested_message" - value: { object_value: { - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes.NestedMessage] - { }}} + value: { + object_value: { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes.NestedMessage] {} + } + } } test { name: "nested_message_subfield" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{}.single_nested_message.bb" value: { int64_value: 0 } } test { name: "wkt" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{}.single_int64_wrapper" value: { null_value: NULL_VALUE } } test { name: "repeated_scalar" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{}.repeated_int64" value: { list_value: {} } } + test { + name: "repeated_enum" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{}.repeated_nested_enum" + value: { list_value: {} } + } + test { name: "repeated_nested" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{}.repeated_nested_message" value: { list_value: {} } } test { name: "map" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "TestAllTypes{}.map_string_string" value: { map_value: {} } } @@ -526,7 +523,7 @@ section { description: "Tests for the has() macro on proto3 messages." test { name: "undefined" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{}.no_such_field)" disable_check: true eval_error: { @@ -535,134 +532,227 @@ section { } test { name: "repeated_none_implicit" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{}.repeated_int32)" value { bool_value: false } } test { name: "repeated_none_explicit" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{repeated_int32: []}.repeated_int32)" value { bool_value: false } } test { name: "repeated_one" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{repeated_int32: [1]}.repeated_int32)" value { bool_value: true } } test { name: "repeated_many" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{repeated_int32: [1, 2, 3]}.repeated_int32)" value { bool_value: true } } test { name: "map_none_implicit" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{}.map_string_string)" value { bool_value: false } } test { name: "map_none_explicit" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{map_string_string: {}}.map_string_string)" value { bool_value: false } } test { name: "map_one_default" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{map_string_string: {'MT': ''}}.map_string_string)" value { bool_value: true } } test { name: "map_one" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{map_string_string: {'one': 'uno'}}.map_string_string)" value { bool_value: true } } test { name: "map_many" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{map_string_string: {'one': 'uno', 'two': 'dos'}}.map_string_string)" value { bool_value: true } } test { name: "single_unset" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{}.single_int32)" value { bool_value: false } } test { name: "single_set" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{single_int32: 16}.single_int32)" value { bool_value: true } } test { name: "single_set_to_default" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{single_int32: 0}.single_int32)" value { bool_value: false } } test { name: "single_message_unset" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{}.standalone_message)" value { bool_value: false } } test { name: "single_message_set" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{standalone_message: TestAllTypes.NestedMessage{bb: 123}}.standalone_message)" value { bool_value: true } } test { name: "single_message_set_to_default" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{standalone_message: TestAllTypes.NestedMessage{}}.standalone_message)" value { bool_value: true } } test { name: "single_enum_unset" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{}.standalone_enum)" value { bool_value: false } } test { name: "single_enum_set" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.BAR}.standalone_enum)" value { bool_value: true } } test { name: "single_enum_set_zero" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.FOO}.standalone_enum)" value { bool_value: false } } test { name: "oneof_unset" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{}.single_nested_message)" value { bool_value: false } } test { name: "oneof_other_set" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{single_nested_enum: TestAllTypes.NestedEnum.BAZ}.single_nested_message)" value { bool_value: false } } test { name: "oneof_set" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{single_nested_message: TestAllTypes.NestedMessage{}}.single_nested_message)" value { bool_value: true } } test { name: "oneof_set_default" - container: "google.api.expr.test.v1.proto3" + container: "cel.expr.conformance.proto3" expr: "has(TestAllTypes{single_nested_enum: TestAllTypes.NestedEnum.FOO}.single_nested_enum)" value { bool_value: true } } } +section { + name: "set_null" + test { + name: "single_message" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_nested_message: null} == TestAllTypes{}" + value: { bool_value: true } + } + test { + name: "single_any" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_any: null}.single_any" + value { null_value: NULL_VALUE } + } + test { + name: "single_value" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_value: null}.single_value" + value { null_value: NULL_VALUE } + } + test { + name: "single_duration" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_duration: null} == TestAllTypes{}" + value: { bool_value: true } + } + test { + name: "single_timestamp" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_timestamp: null} == TestAllTypes{}" + value: { bool_value: true } + } + test { + name: "single_scalar" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_bool: null} == TestAllTypes{}" + disable_check: true + eval_error: { + errors: { message: "unsupported field type" } + } + } + test { + name: "repeated" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{repeated_int32: null} == TestAllTypes{}" + disable_check: true + eval_error: { + errors: { message: "unsupported field type" } + } + } + test { + name: "map" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{map_string_string: null} == TestAllTypes{}" + disable_check: true + eval_error: { + errors: { message: "unsupported field type" } + } + } + test { + name: "list_value" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{list_value: null} == TestAllTypes{}" + disable_check: true + eval_error: { + errors: { message: "unsupported field type" } + } + } + test { + name: "single_struct" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_struct: null} == TestAllTypes{}" + disable_check: true + eval_error: { + errors: { message: "unsupported field type" } + } + } +} +section { + name: "quoted_fields" + test { + name: "set_field" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{`in`: true} == TestAllTypes{}" + value: { bool_value: false } + } + test { + name: "get_field" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{`in`: true}.`in`" + value: { bool_value: true } + } +} diff --git a/features/steps/integration_binding.py b/features/steps/integration_binding.py index 6990170..d07f86b 100644 --- a/features/steps/integration_binding.py +++ b/features/steps/integration_binding.py @@ -72,21 +72,12 @@ import celpy.celtypes import celpy.evaluation from celpy import CELEvalError, Environment +from celpy.celparser import CELParseError from celpy.celtypes import * logger = logging.getLogger(__name__) -class TypeKind(str, Enum): - PRIMITIVE = "primitive" - MAP_TYPE = "map_type" - STRING = "STRING" - INT64 = "INT64" - MAP_TYPE_SPEC = "map_type_spec" - ELEM_TYPE = "elem_type" - TYPE_SPEC = "type_spec" - - class Bindings(NamedTuple): bindings: List[Dict[str, Any]] @@ -341,78 +332,25 @@ class NestedMessage(celpy.celtypes.MessageType): """ pass -# From Protobuf definitions, these are the CEL types implement them. -TYPE_NAMES = { - "google.protobuf.Any": MessageType, - "google.protubuf.Any": MessageType, # Note spelling anomaly. - "google.protobuf.BoolValue": BoolType, - "google.protobuf.BytesValue": BytesType, - "google.protobuf.DoubleValue": DoubleType, - "google.protobuf.Duration": DurationType, - "google.protobuf.FloatValue": DoubleType, - "google.protobuf.Int32Value": IntType, - "google.protobuf.Int64Value": IntType, - "google.protobuf.ListValue": ListType, - "google.protobuf.StringValue": StringType, - "google.protobuf.Struct": MessageType, - "google.protobuf.Timestamp": TimestampType, - "google.protobuf.UInt32Value": UintType, - "google.protobuf.UInt64Value": UintType, - "google.protobuf.Value": MessageType, - "type": TypeType, - "list_type": ListType, - "map_type": MapType, - "map": MapType, - "list": ListType, - "string": StringType, - "bytes": BytesType, - "bool": BoolType, - "int": IntType, - "uint": UintType, - "double": DoubleType, - "null_type": NoneType, - "STRING": StringType, - "BOOL": BoolType, - "INT64": IntType, - "UINT64": UintType, - "INT32": IntType, - "UINT32": UintType, - "BYTES": BytesType, - "DOUBLE": DoubleType, -} @given(u'disable_check parameter is {disable_check}') def step_impl(context, disable_check): - context.data['disable_check'] = disable_check == "true" + context.data['disable_check'] = eval(disable_check) -@given(u'type_env parameter "{name}" is {type_env}') +@given(u'type_env parameter {name} is {type_env}') def step_impl(context, name, type_env): - """ - type_env has name and type information used to create the environment. - Generally, it should be one of the type names, e.g. ``INT64``. - These need to be mapped to celpy.celtypes types. - - Sometimes it already is a ``celpy.celtypes`` name. - """ - if type_env.startswith("celpy"): - context.data['type_env'][name] = eval(type_env) - if type_env.startswith('"'): - context.data['type_env'][name] = TYPE_NAMES[type_env[1:-1]] - else: - context.data['type_env'][name] = TYPE_NAMES[type_env] + context.data['type_env'][eval(name)] = eval(type_env) -@given(u'bindings parameter "{name}" is {binding}') +@given(u'bindings parameter {name} is {binding}') def step_impl(context, name, binding): - # Bindings is a Bindings literal value, interpret it to create a Value object. - new_binding = eval(binding) - context.data['bindings'][name] = new_binding + context.data['bindings'][eval(name)] = eval(binding) -@given(u'container is "{container}"') +@given(u'container is {container}') def step_impl(context, container): - context.data['container'] = container + context.data['container'] = eval(container) def cel(context): @@ -438,8 +376,13 @@ def cel(context): package=context.data['container'], annotations=context.data['type_env'], runner_class=context.data['runner']) - ast = env.compile(context.data['expr']) - prgm = env.program(ast) + try: + ast = env.compile(context.data['expr']) + prgm = env.program(ast) + except CELParseError as ex: + context.data['exc_info'] = sys.exc_info() + context.data['error'] = ex.args[0] + return None activation = context.data['bindings'] print(f"GIVEN activation={activation!r}") @@ -454,15 +397,9 @@ def cel(context): context.data['error'] = ex.args[0] -@when(u'CEL expression "{expr}" is evaluated') -def step_impl(context, expr): - context.data['expr'] = expr - cel(context) - - -@when(u'CEL expression \'{expr}\' is evaluated') +@when(u'CEL expression {expr} is evaluated') def step_impl(context, expr): - context.data['expr'] = expr + context.data['expr'] = eval(expr) cel(context) @@ -552,22 +489,14 @@ def error_category(text: str) -> ErrorCategory: print(f"***No error category for {text!r}***") return ErrorCategory.other -@then(u"eval_error is {quoted_text}") -def step_impl(context, quoted_text): - """Tests appear to have inconsistent identifcation for exceptions. - - Option 1 -- (default) any error will do. - - Option 2 -- exact match required. This can be difficult in a few cases. - Use -D match=exact to enable this - - """ - if quoted_text == "None": +@then(u"eval_error is {error_text}") +def step_impl(context, error_text): + error = eval(error_text) + if error is None: assert context.data['error'] is None, f"error not None in {context.data}" else: print(f"*** Analyzing context.data = {context.data!r}***") - text = quoted_text[1:-1] if quoted_text[0] in ["'", '"'] else quoted_text - expected_ec = error_category(text) + expected_ec = error_category(error) actual_ec = error_category(context.data['error'] or "") if context.config.userdata.get("match", "any") == "exact": assert expected_ec == actual_ec, f"{expected_ec} != {actual_ec} in {context.data}" diff --git a/features/string.feature b/features/string.feature index e284c8f..ffddd27 100644 --- a/features/string.feature +++ b/features/string.feature @@ -1,344 +1,280 @@ - +@conformance Feature: string Tests for string and bytes operations. + # size -- Tests for the size() function. -Scenario: empty +Scenario: size/empty When CEL expression "size('')" is evaluated - # int64_value:0 - Then value is IntType(source=0) - + Then value is celpy.celtypes.IntType(source=0) -Scenario: one_ascii +Scenario: size/one_ascii When CEL expression "size('A')" is evaluated - # int64_value:1 - Then value is IntType(source=1) + Then value is celpy.celtypes.IntType(source=1) - -Scenario: one_unicode +Scenario: size/one_unicode When CEL expression "size('ÿ')" is evaluated - # int64_value:1 - Then value is IntType(source=1) - + Then value is celpy.celtypes.IntType(source=1) -Scenario: ascii +Scenario: size/ascii When CEL expression "size('four')" is evaluated - # int64_value:4 - Then value is IntType(source=4) - + Then value is celpy.celtypes.IntType(source=4) -Scenario: unicode +Scenario: size/unicode When CEL expression "size('πέντε')" is evaluated - # int64_value:5 - Then value is IntType(source=5) + Then value is celpy.celtypes.IntType(source=5) - -Scenario: bytes_empty +Scenario: size/bytes_empty When CEL expression "size(b'')" is evaluated - # int64_value:0 - Then value is IntType(source=0) - + Then value is celpy.celtypes.IntType(source=0) -Scenario: bytes +Scenario: size/bytes When CEL expression "size(b'abc')" is evaluated - # int64_value:3 - Then value is IntType(source=3) - + Then value is celpy.celtypes.IntType(source=3) # starts_with -- Tests for the startsWith() function. -Scenario: basic_true +Scenario: starts_with/basic_true When CEL expression "'foobar'.startsWith('foo')" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Then value is celpy.celtypes.BoolType(source=True) - -Scenario: basic_false +Scenario: starts_with/basic_false When CEL expression "'foobar'.startsWith('bar')" is evaluated - # bool_value:false - Then value is BoolType(source=False) - + Then value is celpy.celtypes.BoolType(source=False) -Scenario: empty_target +Scenario: starts_with/empty_target When CEL expression "''.startsWith('foo')" is evaluated - # bool_value:false - Then value is BoolType(source=False) - + Then value is celpy.celtypes.BoolType(source=False) -Scenario: empty_arg +Scenario: starts_with/empty_arg When CEL expression "'foobar'.startsWith('')" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Then value is celpy.celtypes.BoolType(source=True) - -Scenario: empty_empty +Scenario: starts_with/empty_empty When CEL expression "''.startsWith('')" is evaluated - # bool_value:true - Then value is BoolType(source=True) - + Then value is celpy.celtypes.BoolType(source=True) -Scenario: unicode +Scenario: starts_with/unicode When CEL expression "'завтра'.startsWith('за')" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: starts_with/unicode_smp + When CEL expression "'🐱😀😛'.startsWith('🐱')" is evaluated + Then value is celpy.celtypes.BoolType(source=True) # ends_with -- Tests for the endsWith() function. -Scenario: basic_true +Scenario: ends_with/basic_true When CEL expression "'foobar'.endsWith('bar')" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Then value is celpy.celtypes.BoolType(source=True) - -Scenario: basic_false +Scenario: ends_with/basic_false When CEL expression "'foobar'.endsWith('foo')" is evaluated - # bool_value:false - Then value is BoolType(source=False) - + Then value is celpy.celtypes.BoolType(source=False) -Scenario: empty_target +Scenario: ends_with/empty_target When CEL expression "''.endsWith('foo')" is evaluated - # bool_value:false - Then value is BoolType(source=False) - + Then value is celpy.celtypes.BoolType(source=False) -Scenario: empty_arg +Scenario: ends_with/empty_arg When CEL expression "'foobar'.endsWith('')" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Then value is celpy.celtypes.BoolType(source=True) - -Scenario: empty_empty +Scenario: ends_with/empty_empty When CEL expression "''.endsWith('')" is evaluated - # bool_value:true - Then value is BoolType(source=True) - + Then value is celpy.celtypes.BoolType(source=True) -Scenario: unicode +Scenario: ends_with/unicode When CEL expression "'forté'.endsWith('té')" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: ends_with/unicode_smp + When CEL expression "'🐱😀😛'.endsWith('😛')" is evaluated + Then value is celpy.celtypes.BoolType(source=True) # matches -- Tests for regexp matching. For now, we will only test the subset of regular languages. -Scenario: basic +Scenario: matches/basic When CEL expression "'hubba'.matches('ubb')" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Then value is celpy.celtypes.BoolType(source=True) - -Scenario: empty_target +Scenario: matches/empty_target When CEL expression "''.matches('foo|bar')" is evaluated - # bool_value:false - Then value is BoolType(source=False) - + Then value is celpy.celtypes.BoolType(source=False) -Scenario: empty_arg +Scenario: matches/empty_arg When CEL expression "'cows'.matches('')" is evaluated - # bool_value:true - Then value is BoolType(source=True) - + Then value is celpy.celtypes.BoolType(source=True) -Scenario: empty_empty +Scenario: matches/empty_empty When CEL expression "''.matches('')" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Then value is celpy.celtypes.BoolType(source=True) - -Scenario: re_concat +Scenario: matches/re_concat When CEL expression "'abcd'.matches('bc')" is evaluated - # bool_value:true - Then value is BoolType(source=True) - + Then value is celpy.celtypes.BoolType(source=True) -Scenario: re_alt +Scenario: matches/re_alt When CEL expression "'grey'.matches('gr(a|e)y')" is evaluated - # bool_value:true - Then value is BoolType(source=True) - + Then value is celpy.celtypes.BoolType(source=True) -Scenario: re_rep +Scenario: matches/re_rep When CEL expression "'banana'.matches('ba(na)*')" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Then value is celpy.celtypes.BoolType(source=True) - -Scenario: unicode +Scenario: matches/unicode When CEL expression "'mañana'.matches('a+ñ+a+')" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Then value is celpy.celtypes.BoolType(source=True) +Scenario: matches/unicode_smp + When CEL expression "'🐱😀😀'.matches('(a|😀){2}')" is evaluated + Then value is celpy.celtypes.BoolType(source=True) -# concatentation -- Tests for string concatenation. -Scenario: concat_true +# concatenation -- Tests for string concatenation. - When CEL expression "'he' + 'llo'" is evaluated - # string_value:"hello" - Then value is StringType(source='hello') +Scenario: concatenation/concat_true + When CEL expression "'he' + 'llo'" is evaluated + Then value is celpy.celtypes.StringType(source='hello') -Scenario: concat_with_spaces +Scenario: concatenation/concat_with_spaces When CEL expression "'hello' + ' ' == 'hello'" is evaluated - # bool_value:false - Then value is BoolType(source=False) + Then value is celpy.celtypes.BoolType(source=False) - -Scenario: concat_empty_string_beginning +Scenario: concatenation/concat_empty_string_beginning When CEL expression "'' + 'abc'" is evaluated - # string_value:"abc" - Then value is StringType(source='abc') - + Then value is celpy.celtypes.StringType(source='abc') -Scenario: concat_empty_string_end +Scenario: concatenation/concat_empty_string_end When CEL expression "'abc' + ''" is evaluated - # string_value:"abc" - Then value is StringType(source='abc') - + Then value is celpy.celtypes.StringType(source='abc') -Scenario: concat_empty_with_empty +Scenario: concatenation/concat_empty_with_empty When CEL expression "'' + ''" is evaluated - # string_value:"" - Then value is StringType(source='') + Then value is celpy.celtypes.StringType(source='') - -Scenario: unicode_unicode +Scenario: concatenation/unicode_unicode When CEL expression "'¢' + 'ÿ' + 'Ȁ'" is evaluated - # string_value:"¢ÿȀ" - Then value is StringType(source='¢ÿȀ') - + Then value is celpy.celtypes.StringType(source='¢ÿȀ') -Scenario: ascii_unicode +Scenario: concatenation/ascii_unicode When CEL expression "'r' + 'ô' + 'le'" is evaluated - # string_value:"rôle" - Then value is StringType(source='rôle') + Then value is celpy.celtypes.StringType(source='rôle') +Scenario: concatenation/ascii_unicode_unicode_smp -Scenario: empty_unicode + When CEL expression "'a' + 'ÿ' + '🐱'" is evaluated + Then value is celpy.celtypes.StringType(source='aÿ🐱') - When CEL expression "'' + 'Ω' + ''" is evaluated - # string_value:"Ω" - Then value is StringType(source='Ω') +Scenario: concatenation/empty_unicode + When CEL expression "'' + 'Ω' + ''" is evaluated + Then value is celpy.celtypes.StringType(source='Ω') # contains -- Tests for contains. -Scenario: contains_true +Scenario: contains/contains_true When CEL expression "'hello'.contains('he')" is evaluated - # bool_value:true - Then value is BoolType(source=True) - + Then value is celpy.celtypes.BoolType(source=True) -Scenario: contains_empty +Scenario: contains/contains_empty When CEL expression "'hello'.contains('')" is evaluated - # bool_value:true - Then value is BoolType(source=True) - + Then value is celpy.celtypes.BoolType(source=True) -Scenario: contains_false +Scenario: contains/contains_false When CEL expression "'hello'.contains('ol')" is evaluated - # bool_value:false - Then value is BoolType(source=False) + Then value is celpy.celtypes.BoolType(source=False) - -Scenario: contains_multiple +Scenario: contains/contains_multiple When CEL expression "'abababc'.contains('ababc')" is evaluated - # bool_value:true - Then value is BoolType(source=True) - + Then value is celpy.celtypes.BoolType(source=True) -Scenario: contains_unicode +Scenario: contains/contains_unicode When CEL expression "'Straße'.contains('aß')" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Then value is celpy.celtypes.BoolType(source=True) +Scenario: contains/contains_unicode_smp -Scenario: empty_contains + When CEL expression "'🐱😀😁'.contains('😀')" is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "''.contains('something')" is evaluated - # bool_value:false - Then value is BoolType(source=False) +Scenario: contains/empty_contains + When CEL expression "''.contains('something')" is evaluated + Then value is celpy.celtypes.BoolType(source=False) -Scenario: empty_empty +Scenario: contains/empty_empty When CEL expression "''.contains('')" is evaluated - # bool_value:true - Then value is BoolType(source=True) - + Then value is celpy.celtypes.BoolType(source=True) # bytes_concat -- Tests for bytes concatenation. -Scenario: concat +Scenario: bytes_concat/concat When CEL expression "b'abc' + b'def'" is evaluated - # bytes_value:"abcdef" - Then value is BytesType(source=b'abcdef') - + Then value is celpy.celtypes.BytesType(source=b'abcdef') -Scenario: left_unit +Scenario: bytes_concat/left_unit - When CEL expression "b'' + b'\xffoo'" is evaluated - # bytes_value:"\xffoo" - Then value is BytesType(source=b'\xffoo') + When CEL expression "b'' + b'\\xffoo'" is evaluated + Then value is celpy.celtypes.BytesType(source=b'\xffoo') - -Scenario: right_unit +Scenario: bytes_concat/right_unit When CEL expression "b'zxy' + b''" is evaluated - # bytes_value:"zxy" - Then value is BytesType(source=b'zxy') - + Then value is celpy.celtypes.BytesType(source=b'zxy') -Scenario: empty_empty +Scenario: bytes_concat/empty_empty When CEL expression "b'' + b''" is evaluated - # bytes_value:"" - Then value is BytesType(source=b'') + Then value is celpy.celtypes.BytesType(source=b'') + diff --git a/features/string.textproto b/features/string.textproto index 10d4142..3571b11 100644 --- a/features/string.textproto +++ b/features/string.textproto @@ -1,3 +1,6 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: google.api.expr.test.v1.SimpleTestFile + name: "string" description: "Tests for string and bytes operations." section { @@ -72,6 +75,11 @@ section { expr: "'завтра'.startsWith('за')" value: { bool_value: true } } + test { + name: "unicode_smp" + expr: "'\U0001F431\U0001F600\U0001F61B'.startsWith('\U0001F431')" + value: { bool_value: true } + } } section { name: "ends_with" @@ -106,6 +114,11 @@ section { expr: "'forté'.endsWith('té')" value: { bool_value: true } } + test { + name: "unicode_smp" + expr: "'\U0001F431\U0001F600\U0001F61B'.endsWith('\U0001F61B')" + value: { bool_value: true } + } } section { name: "matches" @@ -150,19 +163,24 @@ section { expr: "'mañana'.matches('a+ñ+a+')" value: { bool_value: true } } + test { + name: "unicode_smp" + expr: "'\U0001F431\U0001F600\U0001F600'.matches('(a|\U0001F600){2}')" + value: { bool_value: true } + } } section { - name: "concatentation" + name: "concatenation" description: "Tests for string concatenation." test { name: "concat_true" expr: "'he' + 'llo'" - value: { string_value: "hello"} + value: { string_value: "hello" } } test { name: "concat_with_spaces" expr: "'hello' + ' ' == 'hello'" - value: { bool_value: false} + value: { bool_value: false } } test { name: "concat_empty_string_beginning" @@ -189,6 +207,11 @@ section { expr: "'r' + 'ô' + 'le'" value: { string_value: "rôle" } } + test { + name: "ascii_unicode_unicode_smp" + expr: "'a' + 'ÿ' + '\U0001F431'" + value: { string_value: "aÿ\xf0\x9f\x90\xb1" } + } test { name: "empty_unicode" expr: "'' + 'Ω' + ''" @@ -223,6 +246,11 @@ section { expr: "'Straße'.contains('aß')" value: { bool_value: true } } + test { + name: "contains_unicode_smp" + expr: "'\U0001F431\U0001F600\U0001F601'.contains('\U0001F600')" + value: { bool_value: true } + } test { name: "empty_contains" expr: "''.contains('something')" diff --git a/features/string_ext.feature b/features/string_ext.feature new file mode 100644 index 0000000..4e70825 --- /dev/null +++ b/features/string_ext.feature @@ -0,0 +1,1255 @@ +@conformance +Feature: string_ext + Tests for the strings extension library. + + +# char_at -- + +@wip +Scenario: char_at/middle_index + + When CEL expression "'tacocat'.charAt(3)" is evaluated + Then value is celpy.celtypes.StringType(source='o') + +@wip +Scenario: char_at/end_index + + When CEL expression "'tacocat'.charAt(7)" is evaluated + Then value is celpy.celtypes.StringType(source='') + +@wip +Scenario: char_at/multiple + + When CEL expression "'©αT'.charAt(0) == '©' && '©αT'.charAt(1) == 'α' && '©αT'.charAt(2) == 'T'" is evaluated + Then none is None + + +# index_of -- + +@wip +Scenario: index_of/empty_index + + When CEL expression "'tacocat'.indexOf('')" is evaluated + Then value is celpy.celtypes.IntType(source=0) + +@wip +Scenario: index_of/string_index + + When CEL expression "'tacocat'.indexOf('ac')" is evaluated + Then value is celpy.celtypes.IntType(source=1) + +@wip +Scenario: index_of/nomatch + + When CEL expression "'tacocat'.indexOf('none') == -1" is evaluated + Then none is None + +@wip +Scenario: index_of/empty_index + + When CEL expression "'tacocat'.indexOf('', 3) == 3" is evaluated + Then none is None + +@wip +Scenario: index_of/char_index + + When CEL expression "'tacocat'.indexOf('a', 3) == 5" is evaluated + Then none is None + +@wip +Scenario: index_of/string_index + + When CEL expression "'tacocat'.indexOf('at', 3) == 5" is evaluated + Then none is None + +@wip +Scenario: index_of/unicode_char + + When CEL expression "'ta©o©αT'.indexOf('©') == 2" is evaluated + Then none is None + +@wip +Scenario: index_of/unicode_char_index + + When CEL expression "'ta©o©αT'.indexOf('©', 3) == 4" is evaluated + Then none is None + +@wip +Scenario: index_of/unicode_string_index + + When CEL expression "'ta©o©αT'.indexOf('©αT', 3) == 4" is evaluated + Then none is None + +@wip +Scenario: index_of/unicode_string_nomatch_index + + When CEL expression "'ta©o©αT'.indexOf('©α', 5) == -1" is evaluated + Then none is None + +@wip +Scenario: index_of/char_index + + When CEL expression "'ijk'.indexOf('k') == 2" is evaluated + Then none is None + +@wip +Scenario: index_of/string_with_space_fullmatch + + When CEL expression "'hello wello'.indexOf('hello wello') == 0" is evaluated + Then none is None + +@wip +Scenario: index_of/string_with_space_index + + When CEL expression "'hello wello'.indexOf('ello', 6) == 7" is evaluated + Then none is None + +@wip +Scenario: index_of/string_nomatch_index + + When CEL expression "'hello wello'.indexOf('elbo room!!') == -1" is evaluated + Then none is None + + +# last_index_of -- + +@wip +Scenario: last_index_of/empty + + When CEL expression "'tacocat'.lastIndexOf('') == 7" is evaluated + Then none is None + +@wip +Scenario: last_index_of/string + + When CEL expression "'tacocat'.lastIndexOf('at') == 5" is evaluated + Then none is None + +@wip +Scenario: last_index_of/string_nomatch + + When CEL expression "'tacocat'.lastIndexOf('none') == -1" is evaluated + Then none is None + +@wip +Scenario: last_index_of/empty_index + + When CEL expression "'tacocat'.lastIndexOf('', 3) == 3" is evaluated + Then none is None + +@wip +Scenario: last_index_of/char_index + + When CEL expression "'tacocat'.lastIndexOf('a', 3) == 1" is evaluated + Then none is None + +@wip +Scenario: last_index_of/unicode_char + + When CEL expression "'ta©o©αT'.lastIndexOf('©') == 4" is evaluated + Then none is None + +@wip +Scenario: last_index_of/unicode_char_index + + When CEL expression "'ta©o©αT'.lastIndexOf('©', 3) == 2" is evaluated + Then none is None + +@wip +Scenario: last_index_of/unicode_string_index + + When CEL expression "'ta©o©αT'.lastIndexOf('©α', 4) == 4" is evaluated + Then none is None + +@wip +Scenario: last_index_of/string_with_space_string_index + + When CEL expression "'hello wello'.lastIndexOf('ello', 6) == 1" is evaluated + Then none is None + +@wip +Scenario: last_index_of/string_with_space_string_nomatch + + When CEL expression "'hello wello'.lastIndexOf('low') == -1" is evaluated + Then none is None + +@wip +Scenario: last_index_of/string_with_space_string_with_space_nomatch + + When CEL expression "'hello wello'.lastIndexOf('elbo room!!') == -1" is evaluated + Then none is None + +@wip +Scenario: last_index_of/string_with_space_fullmatch + + When CEL expression "'hello wello'.lastIndexOf('hello wello') == 0" is evaluated + Then none is None + +@wip +Scenario: last_index_of/repeated_string + + When CEL expression "'bananananana'.lastIndexOf('nana', 7) == 6" is evaluated + Then none is None + + +# ascii_casing -- + +@wip +Scenario: ascii_casing/lowerascii + + When CEL expression "'TacoCat'.lowerAscii() == 'tacocat'" is evaluated + Then none is None + +@wip +Scenario: ascii_casing/lowerascii_unicode + + When CEL expression "'TacoCÆt'.lowerAscii() == 'tacocÆt'" is evaluated + Then none is None + +@wip +Scenario: ascii_casing/lowerascii_unicode_with_space + + When CEL expression "'TacoCÆt Xii'.lowerAscii() == 'tacocÆt xii'" is evaluated + Then none is None + +@wip +Scenario: ascii_casing/upperascii + + When CEL expression "'tacoCat'.upperAscii() == 'TACOCAT'" is evaluated + Then none is None + +@wip +Scenario: ascii_casing/upperascii_unicode + + When CEL expression "'tacoCαt'.upperAscii() == 'TACOCαT'" is evaluated + Then none is None + +@wip +Scenario: ascii_casing/upperascii_unicode_with_space + + When CEL expression "'TacoCÆt Xii'.upperAscii() == 'TACOCÆT XII'" is evaluated + Then none is None + + +# replace -- + +@wip +Scenario: replace/no_placeholder + + When CEL expression "'12 days 12 hours'.replace('{0}', '2') == '12 days 12 hours'" is evaluated + Then none is None + +@wip +Scenario: replace/basic + + When CEL expression "'{0} days {0} hours'.replace('{0}', '2') == '2 days 2 hours'" is evaluated + Then none is None + +@wip +Scenario: replace/chained + + When CEL expression "'{0} days {0} hours'.replace('{0}', '2', 1).replace('{0}', '23') == '2 days 23 hours'" is evaluated + Then none is None + +@wip +Scenario: replace/unicode + + When CEL expression "'1 ©αT taco'.replace('αT', 'o©α') == '1 ©o©α taco'" is evaluated + Then none is None + + +# split -- + +@wip +Scenario: split/empty + + When CEL expression "'hello world'.split(' ') == ['hello', 'world']" is evaluated + Then none is None + +@wip +Scenario: split/zero_limit + + When CEL expression "'hello world events!'.split(' ', 0) == []" is evaluated + Then none is None + +@wip +Scenario: split/one_limit + + When CEL expression "'hello world events!'.split(' ', 1) == ['hello world events!']" is evaluated + Then none is None + +@wip +Scenario: split/unicode_negative_limit + + When CEL expression "'o©o©o©o'.split('©', -1) == ['o', 'o', 'o', 'o']" is evaluated + Then none is None + + +# substring -- + +@wip +Scenario: substring/start + + When CEL expression "'tacocat'.substring(4) == 'cat'" is evaluated + Then none is None + +@wip +Scenario: substring/start_with_max_length + + When CEL expression "'tacocat'.substring(7) == ''" is evaluated + Then none is None + +@wip +Scenario: substring/start_and_end + + When CEL expression "'tacocat'.substring(0, 4) == 'taco'" is evaluated + Then none is None + +@wip +Scenario: substring/start_and_end_equal_value + + When CEL expression "'tacocat'.substring(4, 4) == ''" is evaluated + Then none is None + +@wip +Scenario: substring/unicode_start_and_end + + When CEL expression "'ta©o©αT'.substring(2, 6) == '©o©α'" is evaluated + Then none is None + +@wip +Scenario: substring/unicode_start_and_end_equal_value + + When CEL expression "'ta©o©αT'.substring(7, 7) == ''" is evaluated + Then none is None + + +# trim -- + +@wip +Scenario: trim/blank_spaces_escaped_chars + + When CEL expression "' \\f\\n\\r\\t\\vtext '.trim() == 'text'" is evaluated + Then none is None + +@wip +Scenario: trim/unicode_space_chars_1 + + When CEL expression "'\\u0085\\u00a0\\u1680text'.trim() == 'text'" is evaluated + Then none is None + +@wip +Scenario: trim/unicode_space_chars_2 + + When CEL expression "'text\\u2000\\u2001\\u2002\\u2003\\u2004\\u2004\\u2006\\u2007\\u2008\\u2009'.trim() == 'text'" is evaluated + Then none is None + +@wip +Scenario: trim/unicode_space_chars_3 + + When CEL expression "'\\u200atext\\u2028\\u2029\\u202F\\u205F\\u3000'.trim() == 'text'" is evaluated + Then none is None + +@wip +Scenario: trim/unicode_no_trim + + When CEL expression "'\\u180etext\\u200b\\u200c\\u200d\\u2060\\ufeff'.trim() == '\\u180etext\\u200b\\u200c\\u200d\\u2060\\ufeff'" is evaluated + Then none is None + + +# join -- + +@wip +Scenario: join/empty_separator + + When CEL expression "['x', 'y'].join() == 'xy'" is evaluated + Then none is None + +@wip +Scenario: join/dash_separator + + When CEL expression "['x', 'y'].join('-') == 'x-y'" is evaluated + Then none is None + +@wip +Scenario: join/empty_string_empty_separator + + When CEL expression "[].join() == ''" is evaluated + Then none is None + +@wip +Scenario: join/empty_string_dash_separator + + When CEL expression "[].join('-') == ''" is evaluated + Then none is None + + +# quote -- + +@wip +Scenario: quote/multiline + + When CEL expression 'strings.quote("first\\nsecond") == "\\"first\\\\nsecond\\""' is evaluated + Then none is None + +@wip +Scenario: quote/escaped + + When CEL expression 'strings.quote("bell\\a") == "\\"bell\\\\a\\""' is evaluated + Then none is None + +@wip +Scenario: quote/backspace + + When CEL expression 'strings.quote("\\bbackspace") == "\\"\\\\bbackspace\\""' is evaluated + Then none is None + +@wip +Scenario: quote/form_feed + + When CEL expression 'strings.quote("\\fform feed") == "\\"\\\\fform feed\\""' is evaluated + Then none is None + +@wip +Scenario: quote/carriage_return + + When CEL expression 'strings.quote("carriage \\r return") == "\\"carriage \\\\r return\\""' is evaluated + Then none is None + +@wip +Scenario: quote/horizontal_tab + + When CEL expression 'strings.quote("horizontal tab\\t") == "\\"horizontal tab\\\\t\\""' is evaluated + Then none is None + +@wip +Scenario: quote/vertical_tab + + When CEL expression 'strings.quote("vertical \\v tab") == "\\"vertical \\\\v tab\\""' is evaluated + Then none is None + +@wip +Scenario: quote/double_slash + + When CEL expression 'strings.quote("double \\\\\\\\ slash") == "\\"double \\\\\\\\\\\\\\\\ slash\\""' is evaluated + Then none is None + +@wip +Scenario: quote/two_escape_sequences + + When CEL expression 'strings.quote("two escape sequences \\\\a\\\\n") == "\\"two escape sequences \\\\\\\\a\\\\\\\\n\\""' is evaluated + Then none is None + +@wip +Scenario: quote/verbatim + + When CEL expression 'strings.quote("verbatim") == "\\"verbatim\\""' is evaluated + Then none is None + +@wip +Scenario: quote/ends_with + + When CEL expression 'strings.quote("ends with \\\\") == "\\"ends with \\\\\\\\\\""' is evaluated + Then none is None + +@wip +Scenario: quote/starts_with + + When CEL expression 'strings.quote("\\\\ starts with") == "\\"\\\\\\\\ starts with\\""' is evaluated + Then none is None + +@wip +Scenario: quote/printable_unicode + + When CEL expression 'strings.quote("printable unicode😀") == "\\"printable unicode😀\\""' is evaluated + Then none is None + +@wip +Scenario: quote/mid_string_quote + + When CEL expression 'strings.quote("mid string \\" quote") == "\\"mid string \\\\\\" quote\\""' is evaluated + Then none is None + +@wip +Scenario: quote/single_quote_with_double_quote + + When CEL expression 'strings.quote(\'single-quote with "double quote"\') == "\\"single-quote with \\\\\\"double quote\\\\\\"\\""' is evaluated + Then none is None + +@wip +Scenario: quote/size_unicode_char + + When CEL expression 'strings.quote("size(\'ÿ\')") == "\\"size(\'ÿ\')\\""' is evaluated + Then none is None + +@wip +Scenario: quote/size_unicode_string + + When CEL expression 'strings.quote("size(\'πέντε\')") == "\\"size(\'πέντε\')\\""' is evaluated + Then none is None + +@wip +Scenario: quote/unicode + + When CEL expression 'strings.quote("завтра") == "\\"завтра\\""' is evaluated + Then none is None + +@wip +Scenario: quote/unicode_code_points + + When CEL expression 'strings.quote("\\U0001F431\\U0001F600\\U0001F61B")' is evaluated + Then value is celpy.celtypes.StringType(source='"🐱😀😛"') + +@wip +Scenario: quote/unicode_2 + + When CEL expression 'strings.quote("ta©o©αT") == "\\"ta©o©αT\\""' is evaluated + Then none is None + +@wip +Scenario: quote/empty_quote + + When CEL expression 'strings.quote("")' is evaluated + Then value is celpy.celtypes.StringType(source='""') + + +# format -- + +@wip +Scenario: format/no-op + + When CEL expression '"no substitution".format([])' is evaluated + Then value is celpy.celtypes.StringType(source='no substitution') + +@wip +Scenario: format/mid-string substitution + + When CEL expression '"str is %s and some more".format(["filler"])' is evaluated + Then value is celpy.celtypes.StringType(source='str is filler and some more') + +@wip +Scenario: format/percent escaping + + When CEL expression '"%% and also %%".format([])' is evaluated + Then value is celpy.celtypes.StringType(source='% and also %') + +@wip +Scenario: format/substitution inside escaped percent signs + + When CEL expression '"%%%s%%".format(["text"])' is evaluated + Then value is celpy.celtypes.StringType(source='%text%') + +@wip +Scenario: format/substitution with one escaped percent sign on the right + + When CEL expression '"%s%%".format(["percent on the right"])' is evaluated + Then value is celpy.celtypes.StringType(source='percent on the right%') + +@wip +Scenario: format/substitution with one escaped percent sign on the left + + When CEL expression '"%%%s".format(["percent on the left"])' is evaluated + Then value is celpy.celtypes.StringType(source='%percent on the left') + +@wip +Scenario: format/multiple substitutions + + When CEL expression '"%d %d %d, %s %s %s, %d %d %d, %s %s %s".format([1, 2, 3, "A", "B", "C", 4, 5, 6, "D", "E", "F"])' is evaluated + Then value is celpy.celtypes.StringType(source='1 2 3, A B C, 4 5 6, D E F') + +@wip +Scenario: format/percent sign escape sequence support + + When CEL expression '"%%escaped %s%%".format(["percent"])' is evaluated + Then value is celpy.celtypes.StringType(source='%escaped percent%') + +@wip +Scenario: format/fixed point formatting clause + + When CEL expression '"%.3f".format([1.2345])' is evaluated + Then value is celpy.celtypes.StringType(source='1.234') + +@wip +Scenario: format/binary formatting clause + + When CEL expression '"this is 5 in binary: %b".format([5])' is evaluated + Then value is celpy.celtypes.StringType(source='this is 5 in binary: 101') + +@wip +Scenario: format/uint support for binary formatting + + When CEL expression '"unsigned 64 in binary: %b".format([uint(64)])' is evaluated + Then value is celpy.celtypes.StringType(source='unsigned 64 in binary: 1000000') + +@wip +Scenario: format/bool support for binary formatting + + When CEL expression '"bit set from bool: %b".format([true])' is evaluated + Then value is celpy.celtypes.StringType(source='bit set from bool: 1') + +@wip +Scenario: format/octal formatting clause + + When CEL expression '"%o".format([11])' is evaluated + Then value is celpy.celtypes.StringType(source='13') + +@wip +Scenario: format/uint support for octal formatting clause + + When CEL expression '"this is an unsigned octal: %o".format([uint(65535)])' is evaluated + Then value is celpy.celtypes.StringType(source='this is an unsigned octal: 177777') + +@wip +Scenario: format/lowercase hexadecimal formatting clause + + When CEL expression '"%x is 20 in hexadecimal".format([30])' is evaluated + Then value is celpy.celtypes.StringType(source='1e is 20 in hexadecimal') + +@wip +Scenario: format/uppercase hexadecimal formatting clause + + When CEL expression '"%X is 20 in hexadecimal".format([30])' is evaluated + Then value is celpy.celtypes.StringType(source='1E is 20 in hexadecimal') + +@wip +Scenario: format/unsigned support for hexadecimal formatting clause + + When CEL expression '"%X is 6000 in hexadecimal".format([uint(6000)])' is evaluated + Then value is celpy.celtypes.StringType(source='1770 is 6000 in hexadecimal') + +@wip +Scenario: format/string support with hexadecimal formatting clause + + When CEL expression '"%x".format(["Hello world!"])' is evaluated + Then value is celpy.celtypes.StringType(source='48656c6c6f20776f726c6421') + +@wip +Scenario: format/string support with uppercase hexadecimal formatting clause + + When CEL expression '"%X".format(["Hello world!"])' is evaluated + Then value is celpy.celtypes.StringType(source='48656C6C6F20776F726C6421') + +@wip +Scenario: format/byte support with hexadecimal formatting clause + + When CEL expression '"%x".format([b"byte string"])' is evaluated + Then value is celpy.celtypes.StringType(source='6279746520737472696e67') + +@wip +Scenario: format/byte support with uppercase hexadecimal formatting clause + + When CEL expression '"%X".format([b"byte string"])' is evaluated + Then value is celpy.celtypes.StringType(source='6279746520737472696E67') + +@wip +Scenario: format/scientific notation formatting clause + + When CEL expression '"%.6e".format([1052.032911275])' is evaluated + Then value is celpy.celtypes.StringType(source='1.052033e+03') + +@wip +Scenario: format/default precision for fixed-point clause + + When CEL expression '"%f".format([2.71828])' is evaluated + Then value is celpy.celtypes.StringType(source='2.718280') + +@wip +Scenario: format/default precision for scientific notation + + When CEL expression '"%e".format([2.71828])' is evaluated + Then value is celpy.celtypes.StringType(source='2.718280e+00') + +@wip +Scenario: format/NaN support for scientific notation + + When CEL expression '"%e".format([double("NaN")])' is evaluated + Then value is celpy.celtypes.StringType(source='NaN') + +@wip +Scenario: format/positive infinity support for scientific notation + + When CEL expression '"%e".format([double("Infinity")])' is evaluated + Then value is celpy.celtypes.StringType(source='Infinity') + +@wip +Scenario: format/negative infinity support for scientific notation + + When CEL expression '"%e".format([double("-Infinity")])' is evaluated + Then value is celpy.celtypes.StringType(source='-Infinity') + +@wip +Scenario: format/NaN support for decimal + + When CEL expression '"%d".format([double("NaN")])' is evaluated + Then value is celpy.celtypes.StringType(source='NaN') + +@wip +Scenario: format/positive infinity support for decimal + + When CEL expression '"%d".format([double("Infinity")])' is evaluated + Then value is celpy.celtypes.StringType(source='Infinity') + +@wip +Scenario: format/negative infinity support for decimal + + When CEL expression '"%d".format([double("-Infinity")])' is evaluated + Then value is celpy.celtypes.StringType(source='-Infinity') + +@wip +Scenario: format/NaN support for fixed-point + + When CEL expression '"%f".format([double("NaN")])' is evaluated + Then value is celpy.celtypes.StringType(source='NaN') + +@wip +Scenario: format/positive infinity support for fixed-point + + When CEL expression '"%f".format([double("Infinity")])' is evaluated + Then value is celpy.celtypes.StringType(source='Infinity') + +@wip +Scenario: format/negative infinity support for fixed-point + + When CEL expression '"%f".format([double("-Infinity")])' is evaluated + Then value is celpy.celtypes.StringType(source='-Infinity') + +@wip +Scenario: format/uint support for decimal clause + + When CEL expression '"%d".format([uint(64)])' is evaluated + Then value is celpy.celtypes.StringType(source='64') + +@wip +Scenario: format/null support for string + + When CEL expression '"%s".format([null])' is evaluated + Then value is celpy.celtypes.StringType(source='null') + +@wip +Scenario: format/int support for string + + When CEL expression '"%s".format([999999999999])' is evaluated + Then value is celpy.celtypes.StringType(source='999999999999') + +@wip +Scenario: format/bytes support for string + + When CEL expression '"%s".format([b"xyz"])' is evaluated + Then value is celpy.celtypes.StringType(source='xyz') + +@wip +Scenario: format/type() support for string + + When CEL expression '"%s".format([type("test string")])' is evaluated + Then value is celpy.celtypes.StringType(source='string') + +@wip +Scenario: format/timestamp support for string + + When CEL expression '"%s".format([timestamp("2023-02-03T23:31:20+00:00")])' is evaluated + Then value is celpy.celtypes.StringType(source='2023-02-03T23:31:20Z') + +@wip +Scenario: format/duration support for string + + When CEL expression '"%s".format([duration("1h45m47s")])' is evaluated + Then value is celpy.celtypes.StringType(source='6347s') + +@wip +Scenario: format/list support for string + + When CEL expression '"%s".format([["abc", 3.14, null, [9, 8, 7, 6], timestamp("2023-02-03T23:31:20Z")]])' is evaluated + Then value is celpy.celtypes.StringType(source='[abc, 3.14, null, [9, 8, 7, 6], 2023-02-03T23:31:20Z]') + +@wip +Scenario: format/map support for string + + When CEL expression '"%s".format([{"key1": b"xyz", "key5": null, "key2": duration("2h"), "key4": true, "key3": 2.71828}])' is evaluated + Then value is celpy.celtypes.StringType(source='{key1: xyz, key2: 7200s, key3: 2.71828, key4: true, key5: null}') + +@wip +Scenario: format/map support (all key types) + + When CEL expression '"%s".format([{1: "value1", uint(2): "value2", true: double("NaN")}])' is evaluated + Then value is celpy.celtypes.StringType(source='{1: value1, 2: value2, true: NaN}') + +@wip +Scenario: format/boolean support for %s + + When CEL expression '"%s, %s".format([true, false])' is evaluated + Then value is celpy.celtypes.StringType(source='true, false') + +@wip +Scenario: format/dyntype support for string formatting clause + + When CEL expression '"%s".format([dyn("a string")])' is evaluated + Then value is celpy.celtypes.StringType(source='a string') + +@wip +Scenario: format/dyntype support for numbers with string formatting clause + + When CEL expression '"%s, %s".format([dyn(32), dyn(56.8)])' is evaluated + Then value is celpy.celtypes.StringType(source='32, 56.8') + +@wip +Scenario: format/dyntype support for integer formatting clause + + When CEL expression '"%d".format([dyn(128)])' is evaluated + Then value is celpy.celtypes.StringType(source='128') + +@wip +Scenario: format/dyntype support for integer formatting clause (unsigned) + + When CEL expression '"%d".format([dyn(256u)])' is evaluated + Then value is celpy.celtypes.StringType(source='256') + +@wip +Scenario: format/dyntype support for hex formatting clause + + When CEL expression '"%x".format([dyn(22)])' is evaluated + Then value is celpy.celtypes.StringType(source='16') + +@wip +Scenario: format/dyntype support for hex formatting clause (uppercase) + + When CEL expression '"%X".format([dyn(26)])' is evaluated + Then value is celpy.celtypes.StringType(source='1A') + +@wip +Scenario: format/dyntype support for unsigned hex formatting clause + + When CEL expression '"%x".format([dyn(500u)])' is evaluated + Then value is celpy.celtypes.StringType(source='1f4') + +@wip +Scenario: format/dyntype support for fixed-point formatting clause + + When CEL expression '"%.3f".format([dyn(4.5)])' is evaluated + Then value is celpy.celtypes.StringType(source='4.500') + +@wip +Scenario: format/dyntype support for scientific notation + + When CEL expression '"%e".format([dyn(2.71828)])' is evaluated + Then value is celpy.celtypes.StringType(source='2.718280e+00') + +@wip +Scenario: format/dyntype NaN/infinity support + + When CEL expression '"%s".format([[double("NaN"), double("Infinity"), double("-Infinity")]])' is evaluated + Then value is celpy.celtypes.StringType(source='[NaN, Infinity, -Infinity]') + +@wip +Scenario: format/dyntype support for timestamp + + When CEL expression '"%s".format([dyn(timestamp("2009-11-10T23:00:00Z"))])' is evaluated + Then value is celpy.celtypes.StringType(source='2009-11-10T23:00:00Z') + +@wip +Scenario: format/dyntype support for duration + + When CEL expression '"%s".format([dyn(duration("8747s"))])' is evaluated + Then value is celpy.celtypes.StringType(source='8747s') + +@wip +Scenario: format/dyntype support for lists + + When CEL expression '"%s".format([dyn([6, 4.2, "a string"])])' is evaluated + Then value is celpy.celtypes.StringType(source='[6, 4.2, a string]') + +@wip +Scenario: format/dyntype support for maps + + When CEL expression '"%s".format([{"strKey":"x", 6:duration("422s"), true:42}])' is evaluated + Then value is celpy.celtypes.StringType(source='{6: 422s, strKey: x, true: 42}') + +@wip +Scenario: format/string substitution in a string variable + + Given type_env parameter "str_var" is celpy.celtypes.StringType + and bindings parameter "str_var" is celpy.celtypes.StringType(source='%s') + When CEL expression 'str_var.format(["filler"])' is evaluated + Then value is celpy.celtypes.StringType(source='filler') + +@wip +Scenario: format/multiple substitutions in a string variable + + Given type_env parameter "str_var" is celpy.celtypes.StringType + and bindings parameter "str_var" is celpy.celtypes.StringType(source='%d %d %d, %s %s %s, %d %d %d, %s %s %s') + When CEL expression 'str_var.format([1, 2, 3, "A", "B", "C", 4, 5, 6, "D", "E", "F"])' is evaluated + Then value is celpy.celtypes.StringType(source='1 2 3, A B C, 4 5 6, D E F') + +@wip +Scenario: format/substitution inside escaped percent signs in a string variable + + Given type_env parameter "str_var" is celpy.celtypes.StringType + and bindings parameter "str_var" is celpy.celtypes.StringType(source='%%%s%%') + When CEL expression 'str_var.format(["text"])' is evaluated + Then value is celpy.celtypes.StringType(source='%text%') + +@wip +Scenario: format/fixed point formatting clause in a string variable + + Given type_env parameter "str_var" is celpy.celtypes.StringType + and bindings parameter "str_var" is celpy.celtypes.StringType(source='%.3f') + When CEL expression 'str_var.format([1.2345])' is evaluated + Then value is celpy.celtypes.StringType(source='1.234') + +@wip +Scenario: format/binary formatting clause in a string variable + + Given type_env parameter "str_var" is celpy.celtypes.StringType + and bindings parameter "str_var" is celpy.celtypes.StringType(source='%b') + When CEL expression 'str_var.format([5])' is evaluated + Then value is celpy.celtypes.StringType(source='101') + +@wip +Scenario: format/scientific notation formatting clause in a string variable + + Given type_env parameter "str_var" is celpy.celtypes.StringType + and bindings parameter "str_var" is celpy.celtypes.StringType(source='%.6e') + When CEL expression 'str_var.format([1052.032911275])' is evaluated + Then value is celpy.celtypes.StringType(source='1.052033e+03') + +@wip +Scenario: format/default precision for fixed-point clause in a string variable + + Given type_env parameter "str_var" is celpy.celtypes.StringType + and bindings parameter "str_var" is celpy.celtypes.StringType(source='%f') + When CEL expression 'str_var.format([2.71828])' is evaluated + Then value is celpy.celtypes.StringType(source='2.718280') + + +# format_errors -- + +Scenario: format_errors/unrecognized formatting clause + + Given disable_check parameter is True + When CEL expression '"%a".format([1])' is evaluated + Then eval_error is 'could not parse formatting clause: unrecognized formatting clause "a"' + +Scenario: format_errors/out of bounds arg index + + Given disable_check parameter is True + When CEL expression '"%d %d %d".format([0, 1])' is evaluated + Then eval_error is 'index 2 out of range' + +Scenario: format_errors/string substitution is not allowed with binary clause + + Given disable_check parameter is True + When CEL expression '"string is %b".format(["abc"])' is evaluated + Then eval_error is 'error during formatting: only integers and bools can be formatted as binary, was given string' + +Scenario: format_errors/duration substitution not allowed with decimal clause + + Given disable_check parameter is True + When CEL expression '"%d".format([duration("30m2s")])' is evaluated + Then eval_error is 'error during formatting: decimal clause can only be used on integers, was given google.protobuf.Duration' + +Scenario: format_errors/string substitution not allowed with octal clause + + Given disable_check parameter is True + When CEL expression '"octal: %o".format(["a string"])' is evaluated + Then eval_error is 'error during formatting: octal clause can only be used on integers, was given string' + +Scenario: format_errors/double substitution not allowed with hex clause + + Given disable_check parameter is True + When CEL expression '"double is %x".format([0.5])' is evaluated + Then eval_error is 'error during formatting: only integers, byte buffers, and strings can be formatted as hex, was given double' + +Scenario: format_errors/uppercase not allowed for scientific clause + + Given disable_check parameter is True + When CEL expression '"double is %E".format([0.5])' is evaluated + Then eval_error is 'could not parse formatting clause: unrecognized formatting clause "E"' + +Scenario: format_errors/object not allowed + + Given disable_check parameter is True + When CEL expression '"object is %s".format([cel.expr.conformance.proto3.TestAllTypes{}])' is evaluated + Then eval_error is 'error during formatting: string clause can only be used on strings, bools, bytes, ints, doubles, maps, lists, types, durations, and timestamps, was given cel.expr.conformance.proto3.TestAllTypes' + +Scenario: format_errors/object inside list + + Given disable_check parameter is True + When CEL expression '"%s".format([[1, 2, cel.expr.conformance.proto3.TestAllTypes{}]])' is evaluated + Then eval_error is 'error during formatting: string clause can only be used on strings, bools, bytes, ints, doubles, maps, lists, types, durations, and timestamps, was given cel.expr.conformance.proto3.TestAllTypes' + +Scenario: format_errors/object inside map + + Given disable_check parameter is True + When CEL expression '"%s".format([{1: "a", 2: cel.expr.conformance.proto3.TestAllTypes{}}])' is evaluated + Then eval_error is 'error during formatting: string clause can only be used on strings, bools, bytes, ints, doubles, maps, lists, types, durations, and timestamps, was given cel.expr.conformance.proto3.TestAllTypes' + +Scenario: format_errors/null not allowed for %d + + Given disable_check parameter is True + When CEL expression '"null: %d".format([null])' is evaluated + Then eval_error is 'error during formatting: decimal clause can only be used on integers, was given null_type' + +Scenario: format_errors/null not allowed for %e + + Given disable_check parameter is True + When CEL expression '"null: %e".format([null])' is evaluated + Then eval_error is 'error during formatting: scientific clause can only be used on doubles, was given null_type' + +Scenario: format_errors/null not allowed for %f + + Given disable_check parameter is True + When CEL expression '"null: %f".format([null])' is evaluated + Then eval_error is 'error during formatting: fixed-point clause can only be used on doubles, was given null_type' + +Scenario: format_errors/null not allowed for %x + + Given disable_check parameter is True + When CEL expression '"null: %x".format([null])' is evaluated + Then eval_error is 'error during formatting: only integers, byte buffers, and strings can be formatted as hex, was given null_type' + +Scenario: format_errors/null not allowed for %X + + Given disable_check parameter is True + When CEL expression '"null: %X".format([null])' is evaluated + Then eval_error is 'error during formatting: only integers, byte buffers, and strings can be formatted as hex, was given null_type' + +Scenario: format_errors/null not allowed for %b + + Given disable_check parameter is True + When CEL expression '"null: %b".format([null])' is evaluated + Then eval_error is 'error during formatting: only integers and bools can be formatted as binary, was given null_type' + +Scenario: format_errors/null not allowed for %o + + Given disable_check parameter is True + When CEL expression '"null: %o".format([null])' is evaluated + Then eval_error is 'error during formatting: octal clause can only be used on integers, was given null_type' + + +# value_errors -- + +@wip +Scenario: value_errors/charat_out_of_range + + When CEL expression "'tacocat'.charAt(30) == ''" is evaluated + Then eval_error is 'index out of range: 30' + +Scenario: value_errors/indexof_out_of_range + + When CEL expression "'tacocat'.indexOf('a', 30) == -1" is evaluated + Then eval_error is 'index out of range: 30' + +Scenario: value_errors/lastindexof_negative_index + + When CEL expression "'tacocat'.lastIndexOf('a', -1) == -1" is evaluated + Then eval_error is 'index out of range: -1' + +Scenario: value_errors/lastindexof_out_of_range + + When CEL expression "'tacocat'.lastIndexOf('a', 30) == -1" is evaluated + Then eval_error is 'index out of range: 30' + +@wip +Scenario: value_errors/substring_out_of_range + + When CEL expression "'tacocat'.substring(40) == 'cat'" is evaluated + Then eval_error is 'index out of range: 40' + +@wip +Scenario: value_errors/substring_negative_index + + When CEL expression "'tacocat'.substring(-1) == 'cat'" is evaluated + Then eval_error is 'index out of range: -1' + +@wip +Scenario: value_errors/substring_end_index_out_of_range + + When CEL expression "'tacocat'.substring(1, 50) == 'cat'" is evaluated + Then eval_error is 'index out of range: 50' + +@wip +Scenario: value_errors/substring_begin_index_out_of_range + + When CEL expression "'tacocat'.substring(49, 50) == 'cat'" is evaluated + Then eval_error is 'index out of range: 49' + +@wip +Scenario: value_errors/substring_end_index_greater_than_begin_index + + When CEL expression "'tacocat'.substring(4, 3) == ''" is evaluated + Then eval_error is 'invalid substring range. start: 4, end: 3' + + +# type_errors -- + +Scenario: type_errors/charat_invalid_type + + Given disable_check parameter is True + When CEL expression "42.charAt(2) == ''" is evaluated + Then eval_error is 'no such overload' + +@wip +Scenario: type_errors/charat_invalid_argument + + Given disable_check parameter is True + When CEL expression "'hello'.charAt(true) == ''" is evaluated + Then eval_error is 'no such overload' + +Scenario: type_errors/indexof_unary_invalid_type + + Given disable_check parameter is True + When CEL expression "24.indexOf('2') == 0" is evaluated + Then eval_error is 'no such overload' + +Scenario: type_errors/indexof_unary_invalid_argument + + Given disable_check parameter is True + When CEL expression "'hello'.indexOf(true) == 1" is evaluated + Then eval_error is 'no such overload' + +Scenario: type_errors/indexof_binary_invalid_argument + + Given disable_check parameter is True + When CEL expression "42.indexOf('4', 0) == 0" is evaluated + Then eval_error is 'no such overload' + +Scenario: type_errors/indexof_binary_invalid_argument_2 + + Given disable_check parameter is True + When CEL expression "'42'.indexOf(4, 0) == 0" is evaluated + Then eval_error is 'no such overload' + +Scenario: type_errors/indexof_binary_both_invalid_arguments + + Given disable_check parameter is True + When CEL expression "'42'.indexOf('4', '0') == 0" is evaluated + Then eval_error is 'no such overload' + +Scenario: type_errors/indexof_ternary_invalid_arguments + + Given disable_check parameter is True + When CEL expression "'42'.indexOf('4', 0, 1) == 0" is evaluated + Then eval_error is 'no such overload' + +Scenario: type_errors/split_invalid_type + + Given disable_check parameter is True + When CEL expression "42.split('2') == ['4']" is evaluated + Then eval_error is 'no such overload' + +Scenario: type_errors/replace_invalid_type + + Given disable_check parameter is True + When CEL expression "42.replace(2, 1) == '41'" is evaluated + Then eval_error is 'no such overload' + +@wip +Scenario: type_errors/replace_binary_invalid_argument + + Given disable_check parameter is True + When CEL expression "'42'.replace(2, 1) == '41'" is evaluated + Then eval_error is 'no such overload' + +@wip +Scenario: type_errors/replace_binary_invalid_argument_2 + + Given disable_check parameter is True + When CEL expression "'42'.replace('2', 1) == '41'" is evaluated + Then eval_error is 'no such overload' + +Scenario: type_errors/replace_ternary_invalid_argument + + Given disable_check parameter is True + When CEL expression "42.replace('2', '1', 1) == '41'" is evaluated + Then eval_error is 'no such overload' + +@wip +Scenario: type_errors/replace_ternary_invalid_argument_2 + + Given disable_check parameter is True + When CEL expression "'42'.replace(2, '1', 1) == '41'" is evaluated + Then eval_error is 'no such overload' + +@wip +Scenario: type_errors/replace_ternary_invalid_argument_3 + + Given disable_check parameter is True + When CEL expression "'42'.replace('2', 1, 1) == '41'" is evaluated + Then eval_error is 'no such overload' + +@wip +Scenario: type_errors/replace_ternary_invalid_argument_4 + + Given disable_check parameter is True + When CEL expression "'42'.replace('2', '1', '1') == '41'" is evaluated + Then eval_error is 'no such overload' + +@wip +Scenario: type_errors/replace_quaternary_invalid_argument + + Given disable_check parameter is True + When CEL expression "'42'.replace('2', '1', 1, false) == '41'" is evaluated + Then eval_error is 'no such overload' + +Scenario: type_errors/split_invalid_type_empty_arg + + Given disable_check parameter is True + When CEL expression "42.split('') == ['4', '2']" is evaluated + Then eval_error is 'no such overload' + +Scenario: type_errors/split_invalid_argument + + Given disable_check parameter is True + When CEL expression "'42'.split(2) == ['4']" is evaluated + Then eval_error is 'no such overload' + +Scenario: type_errors/split_binary_invalid_type + + Given disable_check parameter is True + When CEL expression "42.split('2', '1') == ['4']" is evaluated + Then eval_error is 'no such overload' + +Scenario: type_errors/split_binary_invalid_argument + + Given disable_check parameter is True + When CEL expression "'42'.split(2, 1) == ['4']" is evaluated + Then eval_error is 'no such overload' + +Scenario: type_errors/split_binary_invalid_argument_2 + + Given disable_check parameter is True + When CEL expression "'42'.split('2', '1') == ['4']" is evaluated + Then eval_error is 'no such overload' + +Scenario: type_errors/split_ternary_invalid_argument + + Given disable_check parameter is True + When CEL expression "'42'.split('2', 1, 1) == ['4']" is evaluated + Then eval_error is 'no such overload' + +@wip +Scenario: type_errors/substring_ternary_invalid_argument + + Given disable_check parameter is True + When CEL expression "'hello'.substring(1, 2, 3) == ''" is evaluated + Then eval_error is 'no such overload' + +Scenario: type_errors/substring_binary_invalid_type + + Given disable_check parameter is True + When CEL expression "30.substring(true, 3) == ''" is evaluated + Then eval_error is 'no such overload' + +@wip +Scenario: type_errors/substring_binary_invalid_argument + + Given disable_check parameter is True + When CEL expression "'tacocat'.substring(true, 3) == ''" is evaluated + Then eval_error is 'no such overload' + +@wip +Scenario: type_errors/substring_binary_invalid_argument_2 + + Given disable_check parameter is True + When CEL expression "'tacocat'.substring(0, false) == ''" is evaluated + Then eval_error is 'no such overload' + diff --git a/features/string_ext.textproto b/features/string_ext.textproto new file mode 100644 index 0000000..d245558 --- /dev/null +++ b/features/string_ext.textproto @@ -0,0 +1,1417 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: cel.expr.conformance.test.SimpleTestFile + +name: "string_ext" +description: "Tests for the strings extension library." +section: { + name: "char_at" + test: { + name: "middle_index" + expr: "'tacocat'.charAt(3)" + value: { + string_value: "o" + } + } + test: { + name: "end_index" + expr: "'tacocat'.charAt(7)" + value: { + string_value: "" + } + } + test: { + name: "multiple" + expr: "'©αT'.charAt(0) == '©' && '©αT'.charAt(1) == 'α' && '©αT'.charAt(2) == 'T'" + } +} +section: { + name: "index_of" + test: { + name: "empty_index" + expr: "'tacocat'.indexOf('')" + value: { + int64_value: 0 + } + } + test: { + name: "string_index" + expr: "'tacocat'.indexOf('ac')" + value: { + int64_value: 1 + } + } + test: { + name: "nomatch" + expr: "'tacocat'.indexOf('none') == -1" + } + test: { + name: "empty_index" + expr: "'tacocat'.indexOf('', 3) == 3" + } + test: { + name: "char_index" + expr: "'tacocat'.indexOf('a', 3) == 5" + } + test: { + name: "string_index" + expr: "'tacocat'.indexOf('at', 3) == 5" + } + test: { + name: "unicode_char" + expr: "'ta©o©αT'.indexOf('©') == 2" + } + test: { + name: "unicode_char_index" + expr: "'ta©o©αT'.indexOf('©', 3) == 4" + } + test: { + name: "unicode_string_index" + expr: "'ta©o©αT'.indexOf('©αT', 3) == 4" + } + test: { + name: "unicode_string_nomatch_index" + expr: "'ta©o©αT'.indexOf('©α', 5) == -1" + } + test: { + name: "char_index" + expr: "'ijk'.indexOf('k') == 2" + } + test: { + name: "string_with_space_fullmatch" + expr: "'hello wello'.indexOf('hello wello') == 0" + } + test: { + name: "string_with_space_index" + expr: "'hello wello'.indexOf('ello', 6) == 7" + } + test: { + name: "string_nomatch_index" + expr: "'hello wello'.indexOf('elbo room!!') == -1" + } +} +section: { + name: "last_index_of" + test: { + name: "empty" + expr: "'tacocat'.lastIndexOf('') == 7" + } + test: { + name: "string" + expr: "'tacocat'.lastIndexOf('at') == 5" + } + test: { + name: "string_nomatch" + expr: "'tacocat'.lastIndexOf('none') == -1" + } + test: { + name: "empty_index" + expr: "'tacocat'.lastIndexOf('', 3) == 3" + } + test: { + name: "char_index" + expr: "'tacocat'.lastIndexOf('a', 3) == 1" + } + test: { + name: "unicode_char" + expr: "'ta©o©αT'.lastIndexOf('©') == 4" + } + test: { + name: "unicode_char_index" + expr: "'ta©o©αT'.lastIndexOf('©', 3) == 2" + } + test: { + name: "unicode_string_index" + expr: "'ta©o©αT'.lastIndexOf('©α', 4) == 4" + } + test: { + name: "string_with_space_string_index" + expr: "'hello wello'.lastIndexOf('ello', 6) == 1" + } + test: { + name: "string_with_space_string_nomatch" + expr: "'hello wello'.lastIndexOf('low') == -1" + } + test: { + name: "string_with_space_string_with_space_nomatch" + expr: "'hello wello'.lastIndexOf('elbo room!!') == -1" + } + test: { + name: "string_with_space_fullmatch" + expr: "'hello wello'.lastIndexOf('hello wello') == 0" + } + test: { + name: "repeated_string" + expr: "'bananananana'.lastIndexOf('nana', 7) == 6" + } +} +section: { + name: "ascii_casing" + test: { + name: "lowerascii" + expr: "'TacoCat'.lowerAscii() == 'tacocat'" + } + test: { + name: "lowerascii_unicode" + expr: "'TacoCÆt'.lowerAscii() == 'tacocÆt'" + } + test: { + name: "lowerascii_unicode_with_space" + expr: "'TacoCÆt Xii'.lowerAscii() == 'tacocÆt xii'" + } + test: { + name: "upperascii" + expr: "'tacoCat'.upperAscii() == 'TACOCAT'" + } + test: { + name: "upperascii_unicode" + expr: "'tacoCαt'.upperAscii() == 'TACOCαT'" + } + test: { + name: "upperascii_unicode_with_space" + expr: "'TacoCÆt Xii'.upperAscii() == 'TACOCÆT XII'" + } +} +section: { + name: "replace" + test: { + name: "no_placeholder" + expr: "'12 days 12 hours'.replace('{0}', '2') == '12 days 12 hours'" + } + test: { + name: "basic" + expr: "'{0} days {0} hours'.replace('{0}', '2') == '2 days 2 hours'" + } + test: { + name: "chained" + expr: "'{0} days {0} hours'.replace('{0}', '2', 1).replace('{0}', '23') == '2 days 23 hours'" + } + test: { + name: "unicode" + expr: "'1 ©αT taco'.replace('αT', 'o©α') == '1 ©o©α taco'" + } +} +section: { + name: "split" + test: { + name: "empty" + expr: "'hello world'.split(' ') == ['hello', 'world']" + } + test: { + name: "zero_limit" + expr: "'hello world events!'.split(' ', 0) == []" + } + test: { + name: "one_limit" + expr: "'hello world events!'.split(' ', 1) == ['hello world events!']" + } + test: { + name: "unicode_negative_limit" + expr: "'o©o©o©o'.split('©', -1) == ['o', 'o', 'o', 'o']" + } +} +section: { + name: "substring" + test: { + name: "start" + expr: "'tacocat'.substring(4) == 'cat'" + } + test: { + name: "start_with_max_length" + expr: "'tacocat'.substring(7) == ''" + } + test: { + name: "start_and_end" + expr: "'tacocat'.substring(0, 4) == 'taco'" + } + test: { + name: "start_and_end_equal_value" + expr: "'tacocat'.substring(4, 4) == ''" + } + test: { + name: "unicode_start_and_end" + expr: "'ta©o©αT'.substring(2, 6) == '©o©α'" + } + test: { + name: "unicode_start_and_end_equal_value" + expr: "'ta©o©αT'.substring(7, 7) == ''" + } +} +section: { + name: "trim" + test: { + name: "blank_spaces_escaped_chars" + expr: "' \\f\\n\\r\\t\\vtext '.trim() == 'text'" + } + test: { + name: "unicode_space_chars_1" + expr: "'\\u0085\\u00a0\\u1680text'.trim() == 'text'" + } + test: { + name: "unicode_space_chars_2" + expr: "'text\\u2000\\u2001\\u2002\\u2003\\u2004\\u2004\\u2006\\u2007\\u2008\\u2009'.trim() == 'text'" + } + test: { + name: "unicode_space_chars_3" + expr: "'\\u200atext\\u2028\\u2029\\u202F\\u205F\\u3000'.trim() == 'text'" + } + test: { + name: "unicode_no_trim" + expr: "'\\u180etext\\u200b\\u200c\\u200d\\u2060\\ufeff'.trim() == '\\u180etext\\u200b\\u200c\\u200d\\u2060\\ufeff'" + } +} +section: { + name: "join" + test: { + name: "empty_separator" + expr: "['x', 'y'].join() == 'xy'" + } + test: { + name: "dash_separator" + expr: "['x', 'y'].join('-') == 'x-y'" + } + test: { + name: "empty_string_empty_separator" + expr: "[].join() == ''" + } + test: { + name: "empty_string_dash_separator" + expr: "[].join('-') == ''" + } +} +section: { + name: "quote" + test: { + name: "multiline" + expr: "strings.quote(\"first\\nsecond\") == \"\\\"first\\\\nsecond\\\"\"" + } + test: { + name: "escaped" + expr: "strings.quote(\"bell\\a\") == \"\\\"bell\\\\a\\\"\"" + } + test: { + name: "backspace" + expr: "strings.quote(\"\\bbackspace\") == \"\\\"\\\\bbackspace\\\"\"" + } + test: { + name: "form_feed" + expr: "strings.quote(\"\\fform feed\") == \"\\\"\\\\fform feed\\\"\"" + } + test: { + name: "carriage_return" + expr: "strings.quote(\"carriage \\r return\") == \"\\\"carriage \\\\r return\\\"\"" + } + test: { + name: "horizontal_tab" + expr: "strings.quote(\"horizontal tab\\t\") == \"\\\"horizontal tab\\\\t\\\"\"" + } + test: { + name: "vertical_tab" + expr: "strings.quote(\"vertical \\v tab\") == \"\\\"vertical \\\\v tab\\\"\"" + } + test: { + name: "double_slash" + expr: "strings.quote(\"double \\\\\\\\ slash\") == \"\\\"double \\\\\\\\\\\\\\\\ slash\\\"\"" + } + test: { + name: "two_escape_sequences" + expr: "strings.quote(\"two escape sequences \\\\a\\\\n\") == \"\\\"two escape sequences \\\\\\\\a\\\\\\\\n\\\"\"" + } + test: { + name: "verbatim" + expr: "strings.quote(\"verbatim\") == \"\\\"verbatim\\\"\"" + } + test: { + name: "ends_with" + expr: "strings.quote(\"ends with \\\\\") == \"\\\"ends with \\\\\\\\\\\"\"" + } + test: { + name: "starts_with" + expr: "strings.quote(\"\\\\ starts with\") == \"\\\"\\\\\\\\ starts with\\\"\"" + } + test: { + name: "printable_unicode" + expr: "strings.quote(\"printable unicode😀\") == \"\\\"printable unicode😀\\\"\"" + } + test: { + name: "mid_string_quote" + expr: "strings.quote(\"mid string \\\" quote\") == \"\\\"mid string \\\\\\\" quote\\\"\"" + } + test: { + name: "single_quote_with_double_quote" + expr: "strings.quote('single-quote with \"double quote\"') == \"\\\"single-quote with \\\\\\\"double quote\\\\\\\"\\\"\"" + } + test: { + name: "size_unicode_char" + expr: "strings.quote(\"size('ÿ')\") == \"\\\"size('ÿ')\\\"\"" + } + test: { + name: "size_unicode_string" + expr: "strings.quote(\"size('πέντε')\") == \"\\\"size('πέντε')\\\"\"" + } + test: { + name: "unicode" + expr: "strings.quote(\"завтра\") == \"\\\"завтра\\\"\"" + } + test: { + name: "unicode_code_points" + expr: "strings.quote(\"\\U0001F431\\U0001F600\\U0001F61B\")" + value: { + string_value: "\"🐱😀😛\"" + } + } + test: { + name: "unicode_2" + expr: "strings.quote(\"ta©o©αT\") == \"\\\"ta©o©αT\\\"\"" + } + test: { + name: "empty_quote" + expr: "strings.quote(\"\")" + value: { + string_value: "\"\"" + } + } +} +section: { + name: "format" + test: { + name: "no-op" + expr: '"no substitution".format([])' + value: { + string_value: 'no substitution', + } + } + test: { + name: "mid-string substitution" + expr: '"str is %s and some more".format(["filler"])' + value: { + string_value: 'str is filler and some more', + } + } + test: { + name: "percent escaping" + expr: '"%% and also %%".format([])' + value: { + string_value: '% and also %', + } + } + test: { + name: "substitution inside escaped percent signs" + expr: '"%%%s%%".format(["text"])' + value: { + string_value: '%text%', + } + } + test: { + name: "substitution with one escaped percent sign on the right" + expr: '"%s%%".format(["percent on the right"])' + value: { + string_value: 'percent on the right%', + } + } + test: { + name: "substitution with one escaped percent sign on the left" + expr: '"%%%s".format(["percent on the left"])' + value: { + string_value: '%percent on the left', + } + } + test: { + name: "multiple substitutions" + expr: '"%d %d %d, %s %s %s, %d %d %d, %s %s %s".format([1, 2, 3, "A", "B", "C", 4, 5, 6, "D", "E", "F"])' + value: { + string_value: '1 2 3, A B C, 4 5 6, D E F', + } + } + test: { + name: "percent sign escape sequence support" + expr: '"%%escaped %s%%".format(["percent"])' + value: { + string_value: '%escaped percent%', + } + } + test: { + name: "fixed point formatting clause" + expr: '"%.3f".format([1.2345])' + value: { + string_value: '1.234', + } + } + test: { + name: "binary formatting clause" + expr: '"this is 5 in binary: %b".format([5])' + value: { + string_value: 'this is 5 in binary: 101', + } + } + test: { + name: "uint support for binary formatting" + expr: '"unsigned 64 in binary: %b".format([uint(64)])' + value: { + string_value: 'unsigned 64 in binary: 1000000', + } + } + test: { + name: "bool support for binary formatting" + expr: '"bit set from bool: %b".format([true])' + value: { + string_value: 'bit set from bool: 1', + } + } + test: { + name: "octal formatting clause" + expr: '"%o".format([11])' + value: { + string_value: '13', + } + } + test: { + name: "uint support for octal formatting clause" + expr: '"this is an unsigned octal: %o".format([uint(65535)])' + value: { + string_value: 'this is an unsigned octal: 177777', + } + } + test: { + name: "lowercase hexadecimal formatting clause" + expr: '"%x is 20 in hexadecimal".format([30])' + value: { + string_value: '1e is 20 in hexadecimal', + } + } + test: { + name: "uppercase hexadecimal formatting clause" + expr: '"%X is 20 in hexadecimal".format([30])' + value: { + string_value: '1E is 20 in hexadecimal', + } + } + test: { + name: "unsigned support for hexadecimal formatting clause" + expr: '"%X is 6000 in hexadecimal".format([uint(6000)])' + value: { + string_value: '1770 is 6000 in hexadecimal', + } + } + test: { + name: "string support with hexadecimal formatting clause" + expr: '"%x".format(["Hello world!"])' + value: { + string_value: '48656c6c6f20776f726c6421', + } + } + test: { + name: "string support with uppercase hexadecimal formatting clause" + expr: '"%X".format(["Hello world!"])' + value: { + string_value: '48656C6C6F20776F726C6421', + } + } + test: { + name: "byte support with hexadecimal formatting clause" + expr: '"%x".format([b"byte string"])' + value: { + string_value: '6279746520737472696e67', + } + } + test: { + name: "byte support with uppercase hexadecimal formatting clause" + expr: '"%X".format([b"byte string"])' + value: { + string_value: '6279746520737472696E67', + } + } + test: { + name: "scientific notation formatting clause" + expr: '"%.6e".format([1052.032911275])' + value: { + string_value: '1.052033e+03', + } + } + test: { + name: "default precision for fixed-point clause" + expr: '"%f".format([2.71828])' + value: { + string_value: '2.718280', + } + } + test: { + name: "default precision for scientific notation" + expr: '"%e".format([2.71828])' + value: { + string_value: '2.718280e+00', + } + } + test: { + name: "NaN support for scientific notation" + expr: '"%e".format([double("NaN")])' + value: { + string_value: 'NaN', + } + } + test: { + name: "positive infinity support for scientific notation" + expr: '"%e".format([double("Infinity")])' + value: { + string_value: 'Infinity', + } + } + test: { + name: "negative infinity support for scientific notation" + expr: '"%e".format([double("-Infinity")])' + value: { + string_value: '-Infinity', + } + } + test: { + name: "NaN support for decimal" + expr: '"%d".format([double("NaN")])' + value: { + string_value: 'NaN', + } + } + test: { + name: "positive infinity support for decimal" + expr: '"%d".format([double("Infinity")])' + value: { + string_value: 'Infinity', + } + } + test: { + name: "negative infinity support for decimal" + expr: '"%d".format([double("-Infinity")])' + value: { + string_value: '-Infinity', + } + } + test: { + name: "NaN support for fixed-point" + expr: '"%f".format([double("NaN")])' + value: { + string_value: 'NaN', + } + } + test: { + name: "positive infinity support for fixed-point" + expr: '"%f".format([double("Infinity")])' + value: { + string_value: 'Infinity', + } + } + test: { + name: "negative infinity support for fixed-point" + expr: '"%f".format([double("-Infinity")])' + value: { + string_value: '-Infinity', + } + } + test: { + name: "uint support for decimal clause" + expr: '"%d".format([uint(64)])' + value: { + string_value: '64', + } + } + test: { + name: "null support for string" + expr: '"%s".format([null])' + value: { + string_value: 'null', + } + } + test: { + name: "int support for string" + expr: '"%s".format([999999999999])' + value: { + string_value: '999999999999', + } + } + test: { + name: "bytes support for string" + expr: '"%s".format([b"xyz"])' + value: { + string_value: 'xyz', + } + } + test: { + name: "type() support for string" + expr: '"%s".format([type("test string")])' + value: { + string_value: 'string', + } + } + test: { + name: "timestamp support for string" + expr: '"%s".format([timestamp("2023-02-03T23:31:20+00:00")])' + value: { + string_value: '2023-02-03T23:31:20Z', + } + } + test: { + name: "duration support for string" + expr: '"%s".format([duration("1h45m47s")])' + value: { + string_value: '6347s', + } + } + test: { + name: "list support for string" + expr: '"%s".format([["abc", 3.14, null, [9, 8, 7, 6], timestamp("2023-02-03T23:31:20Z")]])' + value: { + string_value: '[abc, 3.14, null, [9, 8, 7, 6], 2023-02-03T23:31:20Z]', + } + } + test: { + name: "map support for string" + expr: '"%s".format([{"key1": b"xyz", "key5": null, "key2": duration("2h"), "key4": true, "key3": 2.71828}])' + value: { + string_value: '{key1: xyz, key2: 7200s, key3: 2.71828, key4: true, key5: null}', + } + } + test: { + name: "map support (all key types)" + expr: '"%s".format([{1: "value1", uint(2): "value2", true: double("NaN")}])' + value: { + string_value: '{1: value1, 2: value2, true: NaN}', + } + } + test: { + name: "boolean support for %s" + expr: '"%s, %s".format([true, false])' + value: { + string_value: 'true, false', + } + } + test: { + name: "dyntype support for string formatting clause" + expr: '"%s".format([dyn("a string")])' + value: { + string_value: 'a string', + } + } + test: { + name: "dyntype support for numbers with string formatting clause" + expr: '"%s, %s".format([dyn(32), dyn(56.8)])' + value: { + string_value: '32, 56.8', + } + } + test: { + name: "dyntype support for integer formatting clause" + expr: '"%d".format([dyn(128)])' + value: { + string_value: '128', + } + } + test: { + name: "dyntype support for integer formatting clause (unsigned)" + expr: '"%d".format([dyn(256u)])' + value: { + string_value: '256', + } + } + test: { + name: "dyntype support for hex formatting clause" + expr: '"%x".format([dyn(22)])' + value: { + string_value: '16', + } + } + test: { + name: "dyntype support for hex formatting clause (uppercase)" + expr: '"%X".format([dyn(26)])' + value: { + string_value: '1A', + } + } + test: { + name: "dyntype support for unsigned hex formatting clause" + expr: '"%x".format([dyn(500u)])' + value: { + string_value: '1f4', + } + } + test: { + name: "dyntype support for fixed-point formatting clause" + expr: '"%.3f".format([dyn(4.5)])' + value: { + string_value: '4.500', + } + } + test: { + name: "dyntype support for scientific notation" + expr: '"%e".format([dyn(2.71828)])' + value: { + string_value: '2.718280e+00', + } + } + test: { + name: "dyntype NaN/infinity support" + expr: '"%s".format([[double("NaN"), double("Infinity"), double("-Infinity")]])' + value: { + string_value: '[NaN, Infinity, -Infinity]', + } + } + test: { + name: "dyntype support for timestamp" + expr: '"%s".format([dyn(timestamp("2009-11-10T23:00:00Z"))])' + value: { + string_value: '2009-11-10T23:00:00Z', + } + } + test: { + name: "dyntype support for duration" + expr: '"%s".format([dyn(duration("8747s"))])' + value: { + string_value: '8747s', + } + } + test: { + name: "dyntype support for lists" + expr: '"%s".format([dyn([6, 4.2, "a string"])])' + value: { + string_value: '[6, 4.2, a string]', + } + } + test: { + name: "dyntype support for maps" + expr: '"%s".format([{"strKey":"x", 6:duration("422s"), true:42}])' + value: { + string_value: '{6: 422s, strKey: x, true: 42}', + } + } + test: { + name: "string substitution in a string variable" + expr: 'str_var.format(["filler"])' + type_env: { + name: "str_var", + ident: { type: { primitive: STRING } } + } + bindings: { + key: "str_var" + value: { value: { string_value: "%s" } } + } + value: { + string_value: 'filler', + } + } + test: { + name: "multiple substitutions in a string variable" + expr: 'str_var.format([1, 2, 3, "A", "B", "C", 4, 5, 6, "D", "E", "F"])' + type_env: { + name: "str_var", + ident: { type: { primitive: STRING } } + } + bindings: { + key: "str_var" + value: { value: { string_value: "%d %d %d, %s %s %s, %d %d %d, %s %s %s" } } + } + value: { + string_value: '1 2 3, A B C, 4 5 6, D E F', + } + } + test: { + name: "substitution inside escaped percent signs in a string variable" + expr: 'str_var.format(["text"])' + type_env: { + name: "str_var", + ident: { type: { primitive: STRING } } + } + bindings: { + key: "str_var" + value: { value: { string_value: "%%%s%%" } } + } + value: { + string_value: '%text%', + } + } + test: { + name: "fixed point formatting clause in a string variable" + expr: 'str_var.format([1.2345])' + type_env: { + name: "str_var", + ident: { type: { primitive: STRING } } + } + bindings: { + key: "str_var" + value: { value: { string_value: "%.3f" } } + } + value: { + string_value: '1.234', + } + } + test: { + name: "binary formatting clause in a string variable" + expr: 'str_var.format([5])' + type_env: { + name: "str_var", + ident: { type: { primitive: STRING } } + } + bindings: { + key: "str_var" + value: { value: { string_value: "%b" } } + } + value: { + string_value: '101', + } + } + test: { + name: "scientific notation formatting clause in a string variable" + expr: 'str_var.format([1052.032911275])' + type_env: { + name: "str_var", + ident: { type: { primitive: STRING } } + } + bindings: { + key: "str_var" + value: { value: { string_value: "%.6e" } } + } + value: { + string_value: '1.052033e+03', + } + } + test: { + name: "default precision for fixed-point clause in a string variable" + expr: 'str_var.format([2.71828])' + type_env: { + name: "str_var", + ident: { type: { primitive: STRING } } + } + bindings: { + key: "str_var" + value: { value: { string_value: "%f" } } + } + value: { + string_value: '2.718280', + } + } +} +section: { + name: "format_errors" + test: { + name: "unrecognized formatting clause" + expr: '"%a".format([1])' + disable_check: true + eval_error: { + errors: { + message: 'could not parse formatting clause: unrecognized formatting clause "a"' + } + } + } + test: { + name: "out of bounds arg index" + expr: '"%d %d %d".format([0, 1])' + disable_check: true + eval_error: { + errors: { + message: 'index 2 out of range' + } + } + } + test: { + name: "string substitution is not allowed with binary clause" + expr: '"string is %b".format(["abc"])' + disable_check: true + eval_error: { + errors: { + message: 'error during formatting: only integers and bools can be formatted as binary, was given string' + } + } + } + test: { + name: "duration substitution not allowed with decimal clause" + expr: '"%d".format([duration("30m2s")])' + disable_check: true + eval_error: { + errors: { + message: 'error during formatting: decimal clause can only be used on integers, was given google.protobuf.Duration' + } + } + } + test: { + name: "string substitution not allowed with octal clause" + expr: '"octal: %o".format(["a string"])' + disable_check: true + eval_error: { + errors: { + message: 'error during formatting: octal clause can only be used on integers, was given string' + } + } + } + test: { + name: "double substitution not allowed with hex clause" + expr: '"double is %x".format([0.5])' + disable_check: true + eval_error: { + errors: { + message: 'error during formatting: only integers, byte buffers, and strings can be formatted as hex, was given double' + } + } + } + test: { + name: "uppercase not allowed for scientific clause" + expr: '"double is %E".format([0.5])' + disable_check: true + eval_error: { + errors: { + message: 'could not parse formatting clause: unrecognized formatting clause "E"' + } + } + } + test: { + name: "object not allowed" + expr: '"object is %s".format([cel.expr.conformance.proto3.TestAllTypes{}])' + disable_check: true + eval_error: { + errors: { + message: 'error during formatting: string clause can only be used on strings, bools, bytes, ints, doubles, maps, lists, types, durations, and timestamps, was given cel.expr.conformance.proto3.TestAllTypes' + } + } + } + test: { + name: "object inside list" + expr: '"%s".format([[1, 2, cel.expr.conformance.proto3.TestAllTypes{}]])' + disable_check: true + eval_error: { + errors: { + message: 'error during formatting: string clause can only be used on strings, bools, bytes, ints, doubles, maps, lists, types, durations, and timestamps, was given cel.expr.conformance.proto3.TestAllTypes' + } + } + } + test: { + name: "object inside map" + expr: '"%s".format([{1: "a", 2: cel.expr.conformance.proto3.TestAllTypes{}}])' + disable_check: true + eval_error: { + errors: { + message: 'error during formatting: string clause can only be used on strings, bools, bytes, ints, doubles, maps, lists, types, durations, and timestamps, was given cel.expr.conformance.proto3.TestAllTypes' + } + } + } + test: { + name: "null not allowed for %d" + expr: '"null: %d".format([null])' + disable_check: true + eval_error: { + errors: { + message: 'error during formatting: decimal clause can only be used on integers, was given null_type' + } + } + } + test: { + name: "null not allowed for %e" + expr: '"null: %e".format([null])' + disable_check: true + eval_error: { + errors: { + message: 'error during formatting: scientific clause can only be used on doubles, was given null_type' + } + } + } + test: { + name: "null not allowed for %f" + expr: '"null: %f".format([null])' + disable_check: true + eval_error: { + errors: { + message: 'error during formatting: fixed-point clause can only be used on doubles, was given null_type' + } + } + } + test: { + name: "null not allowed for %x" + expr: '"null: %x".format([null])' + disable_check: true + eval_error: { + errors: { + message: 'error during formatting: only integers, byte buffers, and strings can be formatted as hex, was given null_type' + } + } + } + test: { + name: "null not allowed for %X" + expr: '"null: %X".format([null])' + disable_check: true + eval_error: { + errors: { + message: 'error during formatting: only integers, byte buffers, and strings can be formatted as hex, was given null_type' + } + } + } + test: { + name: "null not allowed for %b" + expr: '"null: %b".format([null])' + disable_check: true + eval_error: { + errors: { + message: 'error during formatting: only integers and bools can be formatted as binary, was given null_type' + } + } + } + test: { + name: "null not allowed for %o" + expr: '"null: %o".format([null])' + disable_check: true + eval_error: { + errors: { + message: 'error during formatting: octal clause can only be used on integers, was given null_type' + } + } + } +} +section: { + name: "value_errors" + test: { + name: "charat_out_of_range" + expr: "'tacocat'.charAt(30) == ''" + eval_error: { + errors: { + message: "index out of range: 30" + } + } + } + test: { + name: "indexof_out_of_range" + expr: "'tacocat'.indexOf('a', 30) == -1" + eval_error: { + errors: { + message: "index out of range: 30" + } + } + } + test: { + name: "lastindexof_negative_index" + expr: "'tacocat'.lastIndexOf('a', -1) == -1" + eval_error: { + errors: { + message: "index out of range: -1" + } + } + } + test: { + name: "lastindexof_out_of_range" + expr: "'tacocat'.lastIndexOf('a', 30) == -1" + eval_error: { + errors: { + message: "index out of range: 30" + } + } + } + test: { + name: "substring_out_of_range" + expr: "'tacocat'.substring(40) == 'cat'" + eval_error: { + errors: { + message: "index out of range: 40" + } + } + } + test: { + name: "substring_negative_index" + expr: "'tacocat'.substring(-1) == 'cat'" + eval_error: { + errors: { + message: "index out of range: -1" + } + } + } + test: { + name: "substring_end_index_out_of_range" + expr: "'tacocat'.substring(1, 50) == 'cat'" + eval_error: { + errors: { + message: "index out of range: 50" + } + } + } + test: { + name: "substring_begin_index_out_of_range" + expr: "'tacocat'.substring(49, 50) == 'cat'" + eval_error: { + errors: { + message: "index out of range: 49" + } + } + } + test: { + name: "substring_end_index_greater_than_begin_index" + expr: "'tacocat'.substring(4, 3) == ''" + eval_error: { + errors: { + message: "invalid substring range. start: 4, end: 3" + } + } + } +} +section: { + name: "type_errors" + test: { + name: "charat_invalid_type" + expr: "42.charAt(2) == ''" + disable_check: true + eval_error: { + errors: { + message: "no such overload" + } + } + } + test: { + name: "charat_invalid_argument" + expr: "'hello'.charAt(true) == ''" + disable_check: true + eval_error: { + errors: { + message: "no such overload" + } + } + } + test: { + name: "indexof_unary_invalid_type" + expr: "24.indexOf('2') == 0" + disable_check: true + eval_error: { + errors: { + message: "no such overload" + } + } + } + test: { + name: "indexof_unary_invalid_argument" + expr: "'hello'.indexOf(true) == 1" + disable_check: true + eval_error: { + errors: { + message: "no such overload" + } + } + } + test: { + name: "indexof_binary_invalid_argument" + expr: "42.indexOf('4', 0) == 0" + disable_check: true + eval_error: { + errors: { + message: "no such overload" + } + } + } + test: { + name: "indexof_binary_invalid_argument_2" + expr: "'42'.indexOf(4, 0) == 0" + disable_check: true + eval_error: { + errors: { + message: "no such overload" + } + } + } + test: { + name: "indexof_binary_both_invalid_arguments" + expr: "'42'.indexOf('4', '0') == 0" + disable_check: true + eval_error: { + errors: { + message: "no such overload" + } + } + } + test: { + name: "indexof_ternary_invalid_arguments" + expr: "'42'.indexOf('4', 0, 1) == 0" + disable_check: true + eval_error: { + errors: { + message: "no such overload" + } + } + } + test: { + name: "split_invalid_type" + expr: "42.split('2') == ['4']" + disable_check: true + eval_error: { + errors: { + message: "no such overload" + } + } + } + test: { + name: "replace_invalid_type" + expr: "42.replace(2, 1) == '41'" + disable_check: true + eval_error: { + errors: { + message: "no such overload" + } + } + } + test: { + name: "replace_binary_invalid_argument" + expr: "'42'.replace(2, 1) == '41'" + disable_check: true + eval_error: { + errors: { + message: "no such overload" + } + } + } + test: { + name: "replace_binary_invalid_argument_2" + expr: "'42'.replace('2', 1) == '41'" + disable_check: true + eval_error: { + errors: { + message: "no such overload" + } + } + } + test: { + name: "replace_ternary_invalid_argument" + expr: "42.replace('2', '1', 1) == '41'" + disable_check: true + eval_error: { + errors: { + message: "no such overload" + } + } + } + test: { + name: "replace_ternary_invalid_argument_2" + expr: "'42'.replace(2, '1', 1) == '41'" + disable_check: true + eval_error: { + errors: { + message: "no such overload" + } + } + } + test: { + name: "replace_ternary_invalid_argument_3" + expr: "'42'.replace('2', 1, 1) == '41'" + disable_check: true + eval_error: { + errors: { + message: "no such overload" + } + } + } + test: { + name: "replace_ternary_invalid_argument_4" + expr: "'42'.replace('2', '1', '1') == '41'" + disable_check: true + eval_error: { + errors: { + message: "no such overload" + } + } + } + test: { + name: "replace_quaternary_invalid_argument" + expr: "'42'.replace('2', '1', 1, false) == '41'" + disable_check: true + eval_error: { + errors: { + message: "no such overload" + } + } + } + test: { + name: "split_invalid_type_empty_arg" + expr: "42.split('') == ['4', '2']" + disable_check: true + eval_error: { + errors: { + message: "no such overload" + } + } + } + test: { + name: "split_invalid_argument" + expr: "'42'.split(2) == ['4']" + disable_check: true + eval_error: { + errors: { + message: "no such overload" + } + } + } + test: { + name: "split_binary_invalid_type" + expr: "42.split('2', '1') == ['4']" + disable_check: true + eval_error: { + errors: { + message: "no such overload" + } + } + } + test: { + name: "split_binary_invalid_argument" + expr: "'42'.split(2, 1) == ['4']" + disable_check: true + eval_error: { + errors: { + message: "no such overload" + } + } + } + test: { + name: "split_binary_invalid_argument_2" + expr: "'42'.split('2', '1') == ['4']" + disable_check: true + eval_error: { + errors: { + message: "no such overload" + } + } + } + test: { + name: "split_ternary_invalid_argument" + expr: "'42'.split('2', 1, 1) == ['4']" + disable_check: true + eval_error: { + errors: { + message: "no such overload" + } + } + } + test: { + name: "substring_ternary_invalid_argument" + expr: "'hello'.substring(1, 2, 3) == ''" + disable_check: true + eval_error: { + errors: { + message: "no such overload" + } + } + } + test: { + name: "substring_binary_invalid_type" + expr: "30.substring(true, 3) == ''" + disable_check: true + eval_error: { + errors: { + message: "no such overload" + } + } + } + test: { + name: "substring_binary_invalid_argument" + expr: "'tacocat'.substring(true, 3) == ''" + disable_check: true + eval_error: { + errors: { + message: "no such overload" + } + } + } + test: { + name: "substring_binary_invalid_argument_2" + expr: "'tacocat'.substring(0, false) == ''" + disable_check: true + eval_error: { + errors: { + message: "no such overload" + } + } + } +} diff --git a/features/timestamps.feature b/features/timestamps.feature index 20ab516..bc9f34a 100644 --- a/features/timestamps.feature +++ b/features/timestamps.feature @@ -1,498 +1,432 @@ - +@conformance Feature: timestamps Timestamp and duration tests. + # timestamp_conversions -- Conversions of timestamps to other types. -Scenario: toInt_timestamp +Scenario: timestamp_conversions/toInt_timestamp When CEL expression "int(timestamp('2009-02-13T23:31:30Z'))" is evaluated - # int64_value:1234567890 - Then value is IntType(source=1234567890) - + Then value is celpy.celtypes.IntType(source=1234567890) -Scenario: toString_timestamp +Scenario: timestamp_conversions/toString_timestamp When CEL expression "string(timestamp('2009-02-13T23:31:30Z'))" is evaluated - # string_value:"2009-02-13T23:31:30Z" - Then value is StringType(source='2009-02-13T23:31:30Z') + Then value is celpy.celtypes.StringType(source='2009-02-13T23:31:30Z') +@wip +Scenario: timestamp_conversions/toString_timestamp_nanos -Scenario: toType_timestamp + When CEL expression "string(timestamp('9999-12-31T23:59:59.999999999Z'))" is evaluated + Then value is celpy.celtypes.StringType(source='9999-12-31T23:59:59.999999999Z') + +Scenario: timestamp_conversions/toType_timestamp When CEL expression "type(timestamp('2009-02-13T23:31:30Z'))" is evaluated - # type_value:"google.protobuf.Timestamp" - # Then value is TypeType(value='google.protobuf.Timestamp') - Then value is TimestampType + Then value is celpy.celtypes.TimestampType + +@wip +Scenario: timestamp_conversions/type_comparison + When CEL expression "google.protobuf.Timestamp == type(timestamp('2009-02-13T23:31:30Z'))" is evaluated + Then value is celpy.celtypes.BoolType(source=True) # duration_conversions -- Conversions of durations to other types. -Scenario: toString_duration +Scenario: duration_conversions/toString_duration When CEL expression "string(duration('1000000s'))" is evaluated - # string_value:"1000000s" - Then value is StringType(source='1000000s') - + Then value is celpy.celtypes.StringType(source='1000000s') -Scenario: toType_duration +Scenario: duration_conversions/toType_duration When CEL expression "type(duration('1000000s'))" is evaluated - # type_value:"google.protobuf.Duration" - # Then value is TypeType(value='google.protobuf.Duration') - Then value is DurationType + Then value is celpy.celtypes.DurationType +@wip +Scenario: duration_conversions/type_comparison + + When CEL expression "google.protobuf.Duration == type(duration('1000000s'))" is evaluated + Then value is celpy.celtypes.BoolType(source=True) # timestamp_selectors -- Timestamp selection operators without timezones -Scenario: getDate +Scenario: timestamp_selectors/getDate When CEL expression "timestamp('2009-02-13T23:31:30Z').getDate()" is evaluated - # int64_value:13 - Then value is IntType(source=13) - + Then value is celpy.celtypes.IntType(source=13) -Scenario: getDayOfMonth +Scenario: timestamp_selectors/getDayOfMonth When CEL expression "timestamp('2009-02-13T23:31:30Z').getDayOfMonth()" is evaluated - # int64_value:12 - Then value is IntType(source=12) - + Then value is celpy.celtypes.IntType(source=12) -Scenario: getDayOfWeek +Scenario: timestamp_selectors/getDayOfWeek When CEL expression "timestamp('2009-02-13T23:31:30Z').getDayOfWeek()" is evaluated - # int64_value:5 - Then value is IntType(source=5) + Then value is celpy.celtypes.IntType(source=5) - -Scenario: getDayOfYear +Scenario: timestamp_selectors/getDayOfYear When CEL expression "timestamp('2009-02-13T23:31:30Z').getDayOfYear()" is evaluated - # int64_value:43 - Then value is IntType(source=43) - + Then value is celpy.celtypes.IntType(source=43) -Scenario: getFullYear +Scenario: timestamp_selectors/getFullYear When CEL expression "timestamp('2009-02-13T23:31:30Z').getFullYear()" is evaluated - # int64_value:2009 - Then value is IntType(source=2009) + Then value is celpy.celtypes.IntType(source=2009) - -Scenario: getHours +Scenario: timestamp_selectors/getHours When CEL expression "timestamp('2009-02-13T23:31:30Z').getHours()" is evaluated - # int64_value:23 - Then value is IntType(source=23) - + Then value is celpy.celtypes.IntType(source=23) -Scenario: getMilliseconds +Scenario: timestamp_selectors/getMilliseconds When CEL expression "timestamp('2009-02-13T23:31:20.123456789Z').getMilliseconds()" is evaluated - # int64_value:123 - Then value is IntType(source=123) - + Then value is celpy.celtypes.IntType(source=123) -Scenario: getMinutes +Scenario: timestamp_selectors/getMinutes When CEL expression "timestamp('2009-02-13T23:31:30Z').getMinutes()" is evaluated - # int64_value:31 - Then value is IntType(source=31) + Then value is celpy.celtypes.IntType(source=31) - -Scenario: getMonth +Scenario: timestamp_selectors/getMonth When CEL expression "timestamp('2009-02-13T23:31:30Z').getMonth()" is evaluated - # int64_value:1 - Then value is IntType(source=1) - + Then value is celpy.celtypes.IntType(source=1) -Scenario: getSeconds +Scenario: timestamp_selectors/getSeconds When CEL expression "timestamp('2009-02-13T23:31:30Z').getSeconds()" is evaluated - # int64_value:30 - Then value is IntType(source=30) - + Then value is celpy.celtypes.IntType(source=30) # timestamp_selectors_tz -- Timestamp selection operators with timezones -Scenario: getDate +Scenario: timestamp_selectors_tz/getDate When CEL expression "timestamp('2009-02-13T23:31:30Z').getDate('Australia/Sydney')" is evaluated - # int64_value:14 - Then value is IntType(source=14) - + Then value is celpy.celtypes.IntType(source=14) -Scenario: getDayOfMonth_name_pos +Scenario: timestamp_selectors_tz/getDayOfMonth_name_pos When CEL expression "timestamp('2009-02-13T23:31:30Z').getDayOfMonth('US/Central')" is evaluated - # int64_value:12 - Then value is IntType(source=12) - + Then value is celpy.celtypes.IntType(source=12) -Scenario: getDayOfMonth_numerical_pos +Scenario: timestamp_selectors_tz/getDayOfMonth_numerical_pos When CEL expression "timestamp('2009-02-13T23:31:30Z').getDayOfMonth('+11:00')" is evaluated - # int64_value:13 - Then value is IntType(source=13) - - -Scenario: getDayOfMonth_numerical_neg + Then value is celpy.celtypes.IntType(source=13) - When CEL expression "timestamp('2009-02-13T02:00:00Z').getDayOfMonth('-2:30')" is evaluated - # int64_value:11 - Then value is IntType(source=11) +Scenario: timestamp_selectors_tz/getDayOfMonth_numerical_neg + When CEL expression "timestamp('2009-02-13T02:00:00Z').getDayOfMonth('-02:30')" is evaluated + Then value is celpy.celtypes.IntType(source=11) -Scenario: getDayOfMonth_name_neg +Scenario: timestamp_selectors_tz/getDayOfMonth_name_neg When CEL expression "timestamp('2009-02-13T02:00:00Z').getDayOfMonth('America/St_Johns')" is evaluated - # int64_value:11 - Then value is IntType(source=11) + Then value is celpy.celtypes.IntType(source=11) - -Scenario: getDayOfWeek +Scenario: timestamp_selectors_tz/getDayOfWeek When CEL expression "timestamp('2009-02-13T23:31:30Z').getDayOfWeek('UTC')" is evaluated - # int64_value:5 - Then value is IntType(source=5) - + Then value is celpy.celtypes.IntType(source=5) -Scenario: getDayOfYear +Scenario: timestamp_selectors_tz/getDayOfYear When CEL expression "timestamp('2009-02-13T23:31:30Z').getDayOfYear('US/Central')" is evaluated - # int64_value:43 - Then value is IntType(source=43) - - -Scenario: getFullYear - - When CEL expression "timestamp('2009-02-13T23:31:30Z').getFullYear('-9:30')" is evaluated - # int64_value:2009 - Then value is IntType(source=2009) + Then value is celpy.celtypes.IntType(source=43) +Scenario: timestamp_selectors_tz/getFullYear -Scenario: getHours + When CEL expression "timestamp('2009-02-13T23:31:30Z').getFullYear('-09:30')" is evaluated + Then value is celpy.celtypes.IntType(source=2009) - When CEL expression "timestamp('2009-02-13T23:31:30Z').getHours('2:00')" is evaluated - # int64_value:1 - Then value is IntType(source=1) +Scenario: timestamp_selectors_tz/getHours + When CEL expression "timestamp('2009-02-13T23:31:30Z').getHours('02:00')" is evaluated + Then value is celpy.celtypes.IntType(source=1) -Scenario: getMinutes +Scenario: timestamp_selectors_tz/getMinutes When CEL expression "timestamp('2009-02-13T23:31:30Z').getMinutes('Asia/Kathmandu')" is evaluated - # int64_value:16 - Then value is IntType(source=16) + Then value is celpy.celtypes.IntType(source=16) - -Scenario: getMonth +Scenario: timestamp_selectors_tz/getMonth When CEL expression "timestamp('2009-02-13T23:31:30Z').getMonth('UTC')" is evaluated - # int64_value:1 - Then value is IntType(source=1) - + Then value is celpy.celtypes.IntType(source=1) -Scenario: getSeconds +Scenario: timestamp_selectors_tz/getSeconds When CEL expression "timestamp('2009-02-13T23:31:30Z').getSeconds('-00:00')" is evaluated - # int64_value:30 - Then value is IntType(source=30) - + Then value is celpy.celtypes.IntType(source=30) # timestamp_equality -- Equality operations on timestamps. -Scenario: eq_same +Scenario: timestamp_equality/eq_same When CEL expression "timestamp('2009-02-13T23:31:30Z') == timestamp('2009-02-13T23:31:30Z')" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Then value is celpy.celtypes.BoolType(source=True) - -Scenario: eq_diff +Scenario: timestamp_equality/eq_diff When CEL expression "timestamp('2009-02-13T23:31:29Z') == timestamp('2009-02-13T23:31:30Z')" is evaluated - # bool_value:false - Then value is BoolType(source=False) - + Then value is celpy.celtypes.BoolType(source=False) -Scenario: neq_same +Scenario: timestamp_equality/neq_same When CEL expression "timestamp('1945-05-07T02:41:00Z') != timestamp('1945-05-07T02:41:00Z')" is evaluated - # bool_value:false - Then value is BoolType(source=False) + Then value is celpy.celtypes.BoolType(source=False) - -Scenario: neq_diff +Scenario: timestamp_equality/neq_diff When CEL expression "timestamp('2000-01-01T00:00:00Z') != timestamp('2001-01-01T00:00:00Z')" is evaluated - # bool_value:true - Then value is BoolType(source=True) - + Then value is celpy.celtypes.BoolType(source=True) # duration_equality -- Equality tests for durations. -Scenario: eq_same +Scenario: duration_equality/eq_same When CEL expression "duration('123s') == duration('123s')" is evaluated - # bool_value:true - Then value is BoolType(source=True) - + Then value is celpy.celtypes.BoolType(source=True) -Scenario: eq_diff +Scenario: duration_equality/eq_diff When CEL expression "duration('60s') == duration('3600s')" is evaluated - # bool_value:false - Then value is BoolType(source=False) + Then value is celpy.celtypes.BoolType(source=False) - -Scenario: neq_same +Scenario: duration_equality/neq_same When CEL expression "duration('604800s') != duration('604800s')" is evaluated - # bool_value:false - Then value is BoolType(source=False) - + Then value is celpy.celtypes.BoolType(source=False) -Scenario: neq_diff +Scenario: duration_equality/neq_diff When CEL expression "duration('86400s') != duration('86164s')" is evaluated - # bool_value:true - Then value is BoolType(source=True) - + Then value is celpy.celtypes.BoolType(source=True) # timestamp_arithmetic -- Arithmetic operations on timestamps and/or durations. -Scenario: add_duration_to_time +Scenario: timestamp_arithmetic/add_duration_to_time When CEL expression "timestamp('2009-02-13T23:00:00Z') + duration('240s') == timestamp('2009-02-13T23:04:00Z')" is evaluated - # bool_value:true - Then value is BoolType(source=True) - + Then value is celpy.celtypes.BoolType(source=True) -Scenario: add_time_to_duration +Scenario: timestamp_arithmetic/add_time_to_duration When CEL expression "duration('120s') + timestamp('2009-02-13T23:01:00Z') == timestamp('2009-02-13T23:03:00Z')" is evaluated - # bool_value:true - Then value is BoolType(source=True) - + Then value is celpy.celtypes.BoolType(source=True) -Scenario: add_duration_to_duration +Scenario: timestamp_arithmetic/add_duration_to_duration When CEL expression "duration('600s') + duration('50s') == duration('650s')" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Then value is celpy.celtypes.BoolType(source=True) +Scenario: timestamp_arithmetic/add_time_to_duration_nanos_negative -Scenario: subtract_duration_from_time + When CEL expression "timestamp('0001-01-01T00:00:01.000000001Z') + duration('-999999999ns') == timestamp('0001-01-01T00:00:00.000000002Z')" is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "timestamp('2009-02-13T23:10:00Z') - duration('600s') == timestamp('2009-02-13T23:00:00Z')" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: timestamp_arithmetic/add_time_to_duration_nanos_positive + When CEL expression "timestamp('0001-01-01T00:00:01.999999999Z') + duration('999999999ns') == timestamp('0001-01-01T00:00:02.999999998Z')" is evaluated + Then value is celpy.celtypes.BoolType(source=True) -Scenario: subtract_time_from_time +Scenario: timestamp_arithmetic/subtract_duration_from_time - When CEL expression "timestamp('2009-02-13T23:31:00Z') - timestamp('2009-02-13T23:29:00Z') == duration('120s')" is evaluated - # bool_value:true - Then value is BoolType(source=True) + When CEL expression "timestamp('2009-02-13T23:10:00Z') - duration('600s') == timestamp('2009-02-13T23:00:00Z')" is evaluated + Then value is celpy.celtypes.BoolType(source=True) +Scenario: timestamp_arithmetic/subtract_time_from_time -Scenario: subtract_duration_from_duration + When CEL expression "timestamp('2009-02-13T23:31:00Z') - timestamp('2009-02-13T23:29:00Z') == duration('120s')" is evaluated + Then value is celpy.celtypes.BoolType(source=True) - When CEL expression "duration('900s') - duration('42s') == duration('858s')" is evaluated - # bool_value:true - Then value is BoolType(source=True) +Scenario: timestamp_arithmetic/subtract_duration_from_duration + When CEL expression "duration('900s') - duration('42s') == duration('858s')" is evaluated + Then value is celpy.celtypes.BoolType(source=True) # comparisons -- Comparisons on timestamps and/or durations. -Scenario: leq_timestamp_true +Scenario: comparisons/leq_timestamp_true When CEL expression "timestamp('2009-02-13T23:00:00Z') <= timestamp('2009-02-13T23:00:00Z')" is evaluated - # bool_value:true - Then value is BoolType(source=True) - + Then value is celpy.celtypes.BoolType(source=True) -Scenario: leq_timestamp_false +Scenario: comparisons/leq_timestamp_false When CEL expression "timestamp('2009-02-13T23:00:00Z') <= timestamp('2009-02-13T22:59:59Z')" is evaluated - # bool_value:false - Then value is BoolType(source=False) - + Then value is celpy.celtypes.BoolType(source=False) -Scenario: leq_duration_true +Scenario: comparisons/leq_duration_true When CEL expression "duration('200s') <= duration('200s')" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Then value is celpy.celtypes.BoolType(source=True) - -Scenario: leq_duration_false +Scenario: comparisons/leq_duration_false When CEL expression "duration('300s') <= duration('200s')" is evaluated - # bool_value:false - Then value is BoolType(source=False) - + Then value is celpy.celtypes.BoolType(source=False) -Scenario: less_timestamp_true +Scenario: comparisons/less_timestamp_true When CEL expression "timestamp('2009-02-13T23:00:00Z') < timestamp('2009-03-13T23:00:00Z')" is evaluated - # bool_value:true - Then value is BoolType(source=True) - + Then value is celpy.celtypes.BoolType(source=True) -Scenario: less_duration_true +Scenario: comparisons/less_duration_true When CEL expression "duration('200s') < duration('300s')" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Then value is celpy.celtypes.BoolType(source=True) - -Scenario: geq_timestamp_true +Scenario: comparisons/geq_timestamp_true When CEL expression "timestamp('2009-02-13T23:00:00Z') >= timestamp('2009-02-13T23:00:00Z')" is evaluated - # bool_value:true - Then value is BoolType(source=True) - + Then value is celpy.celtypes.BoolType(source=True) -Scenario: geq_timestamp_false +Scenario: comparisons/geq_timestamp_false When CEL expression "timestamp('2009-02-13T22:58:00Z') >= timestamp('2009-02-13T23:00:00Z')" is evaluated - # bool_value:false - Then value is BoolType(source=False) + Then value is celpy.celtypes.BoolType(source=False) - -Scenario: geq_duration_true +Scenario: comparisons/geq_duration_true When CEL expression "duration('200s') >= duration('200s')" is evaluated - # bool_value:true - Then value is BoolType(source=True) - + Then value is celpy.celtypes.BoolType(source=True) -Scenario: geq_duration_false +Scenario: comparisons/geq_duration_false When CEL expression "duration('120s') >= duration('200s')" is evaluated - # bool_value:false - Then value is BoolType(source=False) - + Then value is celpy.celtypes.BoolType(source=False) -Scenario: greater_timestamp_true +Scenario: comparisons/greater_timestamp_true When CEL expression "timestamp('2009-02-13T23:59:00Z') > timestamp('2009-02-13T23:00:00Z')" is evaluated - # bool_value:true - Then value is BoolType(source=True) + Then value is celpy.celtypes.BoolType(source=True) - -Scenario: greater_duration_true +Scenario: comparisons/greater_duration_true When CEL expression "duration('300s') > duration('200s')" is evaluated - # bool_value:true - Then value is BoolType(source=True) - + Then value is celpy.celtypes.BoolType(source=True) # duration_converters -- Conversion functions on durations. Unlike timestamps, we don't, e.g. select the 'minutes' field - we convert the duration to integer minutes. -Scenario: get_hours +Scenario: duration_converters/get_hours When CEL expression "duration('10000s').getHours()" is evaluated - # int64_value:2 - Then value is IntType(source=2) + Then value is celpy.celtypes.IntType(source=2) +@wip +Scenario: duration_converters/get_milliseconds + Obtain the milliseconds component of the duration. Note, this is not + the same as converting the duration to milliseconds. This behavior + will be deprecated. -Scenario: get_milliseconds - Need to import a variable to get milliseconds. - # type:{message_type:"google.protobuf.Duration"} - # Given type_env parameter "x" is TypeType(value='google.protobuf.Duration') - Given type_env parameter "x" is google.protobuf.Duration + Given type_env parameter "x" is celpy.celtypes.DurationType + and bindings parameter "x" is celpy.celtypes.DurationType(seconds=123, nanos=321456789) + When CEL expression 'x.getMilliseconds()' is evaluated + Then value is celpy.celtypes.IntType(source=321) - # object_value:{[type.googleapis.com/google.protobuf.Duration]:{seconds:123 nanos:123456789}} - Given bindings parameter "x" is DurationType(seconds=123, nanos=123456789) - - When CEL expression "x.getMilliseconds()" is evaluated - # int64_value:123123 - Then value is IntType(source=123123) - - -Scenario: get_minutes +Scenario: duration_converters/get_minutes When CEL expression "duration('3730s').getMinutes()" is evaluated - # int64_value:62 - Then value is IntType(source=62) + Then value is celpy.celtypes.IntType(source=62) - -Scenario: get_seconds +Scenario: duration_converters/get_seconds When CEL expression "duration('3730s').getSeconds()" is evaluated - # int64_value:3730 - Then value is IntType(source=3730) - + Then value is celpy.celtypes.IntType(source=3730) # timestamp_range -- Tests for out-of-range operations on timestamps. -Scenario: from_string_under +Scenario: timestamp_range/from_string_under When CEL expression "timestamp('0000-01-01T00:00:00Z')" is evaluated - # errors:{message:"range"} Then eval_error is 'range' - -Scenario: from_string_over +Scenario: timestamp_range/from_string_over When CEL expression "timestamp('10000-01-01T00:00:00Z')" is evaluated - # errors:{message:"range"} Then eval_error is 'range' +Scenario: timestamp_range/add_duration_under + + When CEL expression "timestamp('0001-01-01T00:00:00Z') + duration('-1s')" is evaluated + Then eval_error is 'range' + +Scenario: timestamp_range/add_duration_over + + When CEL expression "timestamp('9999-12-31T23:59:59Z') + duration('1s')" is evaluated + Then eval_error is 'range' -Scenario: add_duration_under +@wip +Scenario: timestamp_range/add_duration_nanos_over - When CEL expression "timestamp('0001-01-01T00:00:00Z') - duration('10s')" is evaluated - # errors:{message:"range"} + When CEL expression "timestamp('9999-12-31T23:59:59.999999999Z') + duration('1ns')" is evaluated Then eval_error is 'range' +@wip +Scenario: timestamp_range/add_duration_nanos_under + + When CEL expression "timestamp('0001-01-01T00:00:00Z') + duration('-1ns')" is evaluated + Then eval_error is 'range' -Scenario: add_duration_over +@wip +Scenario: timestamp_range/sub_time_duration_over - When CEL expression "timestamp('9999-12-31T23:59:59Z') + duration('10s')" is evaluated - # errors:{message:"range"} + When CEL expression "timestamp('9999-12-31T23:59:59Z') - timestamp('0001-01-01T00:00:00Z')" is evaluated Then eval_error is 'range' +@wip +Scenario: timestamp_range/sub_time_duration_under + + When CEL expression "timestamp('0001-01-01T00:00:00Z') - timestamp('9999-12-31T23:59:59Z')" is evaluated + Then eval_error is 'range' # duration_range -- Tests for out-of-range operations on durations. -Scenario: from_string_under +Scenario: duration_range/from_string_under When CEL expression "duration('-320000000000s')" is evaluated - # errors:{message:"range"} Then eval_error is 'range' - -Scenario: from_string_over +Scenario: duration_range/from_string_over When CEL expression "duration('320000000000s')" is evaluated - # errors:{message:"range"} Then eval_error is 'range' - -Scenario: add_under +Scenario: duration_range/add_under When CEL expression "duration('-200000000000s') + duration('-200000000000s')" is evaluated - # errors:{message:"range"} Then eval_error is 'range' - -Scenario: add_over +Scenario: duration_range/add_over When CEL expression "duration('200000000000s') + duration('200000000000s')" is evaluated - # errors:{message:"range"} Then eval_error is 'range' + +@wip +Scenario: duration_range/sub_under + + When CEL expression "duration('-200000000000s') - duration('200000000000s')" is evaluated + Then eval_error is 'range' + +@wip +Scenario: duration_range/sub_over + + When CEL expression "duration('200000000000s') - duration('-200000000000s')" is evaluated + Then eval_error is 'range' + diff --git a/features/timestamps.textproto b/features/timestamps.textproto index d810ad7..d3d0584 100644 --- a/features/timestamps.textproto +++ b/features/timestamps.textproto @@ -1,3 +1,6 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: cel.expr.conformance.test.SimpleTestFile + name: "timestamps" description: "Timestamp and duration tests." section { @@ -13,11 +16,21 @@ section { expr: "string(timestamp('2009-02-13T23:31:30Z'))" value: { string_value: "2009-02-13T23:31:30Z" } } + test { + name: "toString_timestamp_nanos" + expr: "string(timestamp('9999-12-31T23:59:59.999999999Z'))" + value: { string_value: "9999-12-31T23:59:59.999999999Z" } + } test { name: "toType_timestamp" expr: "type(timestamp('2009-02-13T23:31:30Z'))" value: { type_value: "google.protobuf.Timestamp" } } + test { + name: "type_comparison" + expr: "google.protobuf.Timestamp == type(timestamp('2009-02-13T23:31:30Z'))" + value: { bool_value: true } + } } section { name: "duration_conversions" @@ -32,6 +45,11 @@ section { expr: "type(duration('1000000s'))" value: { type_value: "google.protobuf.Duration" } } + test { + name: "type_comparison" + expr: "google.protobuf.Duration == type(duration('1000000s'))" + value: { bool_value: true } + } } section { @@ -110,7 +128,7 @@ section { } test { name: "getDayOfMonth_numerical_neg" - expr: "timestamp('2009-02-13T02:00:00Z').getDayOfMonth('-2:30')" + expr: "timestamp('2009-02-13T02:00:00Z').getDayOfMonth('-02:30')" value: { int64_value: 11 } } test { @@ -130,12 +148,12 @@ section { } test { name: "getFullYear" - expr: "timestamp('2009-02-13T23:31:30Z').getFullYear('-9:30')" + expr: "timestamp('2009-02-13T23:31:30Z').getFullYear('-09:30')" value: { int64_value: 2009 } } test { name: "getHours" - expr: "timestamp('2009-02-13T23:31:30Z').getHours('2:00')" + expr: "timestamp('2009-02-13T23:31:30Z').getHours('02:00')" value: { int64_value: 1 } } test { @@ -208,27 +226,37 @@ section { test { name: "add_duration_to_time" expr: "timestamp('2009-02-13T23:00:00Z') + duration('240s') == timestamp('2009-02-13T23:04:00Z')" - value: { bool_value: true} + value: { bool_value: true } } test { name: "add_time_to_duration" expr: "duration('120s') + timestamp('2009-02-13T23:01:00Z') == timestamp('2009-02-13T23:03:00Z')" - value: { bool_value: true} + value: { bool_value: true } } test { name: "add_duration_to_duration" expr: "duration('600s') + duration('50s') == duration('650s')" value: { bool_value: true } } + test { + name: "add_time_to_duration_nanos_negative" + expr: "timestamp('0001-01-01T00:00:01.000000001Z') + duration('-999999999ns') == timestamp('0001-01-01T00:00:00.000000002Z')" + value: { bool_value: true } + } + test { + name: "add_time_to_duration_nanos_positive" + expr: "timestamp('0001-01-01T00:00:01.999999999Z') + duration('999999999ns') == timestamp('0001-01-01T00:00:02.999999998Z')" + value: { bool_value: true } + } test { name: "subtract_duration_from_time" expr: "timestamp('2009-02-13T23:10:00Z') - duration('600s') == timestamp('2009-02-13T23:00:00Z')" - value: { bool_value: true} + value: { bool_value: true } } test { name: "subtract_time_from_time" expr: "timestamp('2009-02-13T23:31:00Z') - timestamp('2009-02-13T23:29:00Z') == duration('120s')" - value: { bool_value: true} + value: { bool_value: true } } test { name: "subtract_duration_from_duration" @@ -310,7 +338,7 @@ section { } test { name: "get_milliseconds" - description: "Need to import a variable to get milliseconds." + description: "Obtain the milliseconds component of the duration. Note, this is not the same as converting the duration to milliseconds. This behavior will be deprecated." expr: "x.getMilliseconds()" type_env { name: "x" @@ -321,16 +349,15 @@ section { value { value { object_value { - [type.googleapis.com/google.protobuf.Duration] - { + [type.googleapis.com/google.protobuf.Duration] { seconds: 123 - nanos: 123456789 + nanos: 321456789 } } } } } - value: { int64_value: 123123 } + value: { int64_value: 321 } } test { name: "get_minutes" @@ -362,14 +389,42 @@ section { } test { name: "add_duration_under" - expr: "timestamp('0001-01-01T00:00:00Z') - duration('10s')" + expr: "timestamp('0001-01-01T00:00:00Z') + duration('-1s')" eval_error { errors { message: "range" } } } test { name: "add_duration_over" - expr: "timestamp('9999-12-31T23:59:59Z') + duration('10s')" + expr: "timestamp('9999-12-31T23:59:59Z') + duration('1s')" + eval_error { + errors { message: "range" } + } + } + test { + name: "add_duration_nanos_over" + expr: "timestamp('9999-12-31T23:59:59.999999999Z') + duration('1ns')" + eval_error { + errors { message: "range" } + } + } + test { + name: "add_duration_nanos_under" + expr: "timestamp('0001-01-01T00:00:00Z') + duration('-1ns')" + eval_error { + errors { message: "range" } + } + } + test { + name: "sub_time_duration_over" + expr: "timestamp('9999-12-31T23:59:59Z') - timestamp('0001-01-01T00:00:00Z')" + eval_error { + errors { message: "range" } + } + } + test { + name: "sub_time_duration_under" + expr: "timestamp('0001-01-01T00:00:00Z') - timestamp('9999-12-31T23:59:59Z')" eval_error { errors { message: "range" } } @@ -406,4 +461,18 @@ section { errors { message: "range" } } } + test { + name: "sub_under" + expr: "duration('-200000000000s') - duration('200000000000s')" + eval_error { + errors { message: "range" } + } + } + test { + name: "sub_over" + expr: "duration('200000000000s') - duration('-200000000000s')" + eval_error { + errors { message: "range" } + } + } } diff --git a/features/type_deduction.feature b/features/type_deduction.feature new file mode 100644 index 0000000..03afae8 --- /dev/null +++ b/features/type_deduction.feature @@ -0,0 +1,31 @@ +@conformance +Feature: type_deductions + Tests for type checker deduced types + + +# constant_literals -- + + +# complex_initializers -- + + +# field_access -- + + +# indexing -- + + +# functions -- + + +# flexible_type_parameter_assignment -- + + +# wrappers -- + + +# type_parameters -- + + +# legacy_nullable_types -- + diff --git a/features/type_deduction.textproto b/features/type_deduction.textproto new file mode 100644 index 0000000..1a0e261 --- /dev/null +++ b/features/type_deduction.textproto @@ -0,0 +1,953 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: cel.expr.conformance.test.SimpleTestFile + +name: "type_deductions" +description: "Tests for type checker deduced types" + +section { + name: "constant_literals" + test { + name: "bool" + expr: "true" + typed_result { + result { + bool_value: true + } + deduced_type { + primitive: BOOL + } + } + } + test { + name: "int" + expr: "42" + typed_result { + result { + int64_value: 42 + } + deduced_type { + primitive: INT64 + } + } + } + test { + name: "uint" + expr: "42u" + typed_result { + result { + uint64_value: 42 + } + deduced_type { + primitive: UINT64 + } + } + } + test { + name: "double" + expr: "0.1" + typed_result { + result { + double_value: 0.1 + } + deduced_type { + primitive: DOUBLE + } + } + } + test { + name: "string" + expr: "\"test\"" + typed_result { + result { + string_value: "test" + } + deduced_type { + primitive: STRING + } + } + } + test { + name: "bytes" + expr: "b\"test\"" + typed_result { + result { + bytes_value: "test" + } + deduced_type { + primitive: BYTES + } + } + } + test { + name: "null" + expr: "null" + typed_result { + result { + null_value: NULL_VALUE + } + deduced_type { + null: NULL_VALUE + } + } + } +} + +section { + name: "complex_initializers" + test { + name: "list" + expr: "[1]" + typed_result { + result { + list_value { + values { + int64_value: 1 + } + } + } + deduced_type { + list_type { elem_type { primitive: INT64 } } + } + } + } + test { + name: "map" + expr: "{'abc': 123}" + typed_result { + result { + map_value { + entries { + key { string_value: "abc" } + value { int64_value: 123 } + } + } + } + deduced_type { + map_type { + key_type { primitive: STRING } + value_type { primitive: INT64 } + } + } + } + } + test { + name: "struct" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_int64: 1}" + typed_result { + result { + object_value { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] { + single_int64: 1 + } + } + } + deduced_type { + message_type: "cel.expr.conformance.proto3.TestAllTypes" + } + } + } +} + +section { + name: "field_access" + test { + name: "int_field" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_int64: 1}.single_int64" + typed_result { + result { + int64_value: 1 + } + deduced_type { + primitive: INT64 + } + } + } + test { + name: "repeated_int_field" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{}.repeated_int64" + typed_result { + result { + list_value {} + } + deduced_type { + list_type { elem_type { primitive: INT64 } } + } + } + } + test { + name: "map_bool_int" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{}.map_bool_int64" + typed_result { + result { + map_value {} + } + deduced_type { + map_type { + key_type { primitive: BOOL } + value_type { primitive: INT64 } + } + } + } + } + test { + name: "enum_field" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{}.standalone_enum" + typed_result { + result { + int64_value: 0 + } + deduced_type { primitive: INT64 } + } + } + test { + name: "repeated_enum_field" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{}.repeated_nested_enum" + typed_result { + result { + list_value {} + } + deduced_type { + list_type { elem_type { primitive: INT64 } } + } + } + } + test { + name: "enum_map_field" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{}.map_int32_enum" + typed_result { + result { + map_value {} + } + deduced_type { + map_type { + key_type { primitive: INT64 } + value_type { primitive: INT64 } + } + } + } + } +} + +section { + name: "indexing" + test { + name: "list" + expr: "['foo'][0]" + typed_result { + result { + string_value: "foo" + } + deduced_type { + primitive: STRING + } + } + } + test { + name: "map" + expr: "{'abc': 123}['abc']" + typed_result { + result { + int64_value: 123 + } + deduced_type { + primitive: INT64 + } + } + } +} + +section { + name: "functions" + test { + name: "nested_calls" + expr: "('foo' + 'bar').startsWith('foo')" + typed_result { + result { + bool_value: true + } + deduced_type { + primitive: BOOL + } + } + } + test { + name: "function_result_type" + expr: "fn('abc', 123)" + check_only: true + type_env { + name: "fn" + function { + overloads { + overload_id: "fn_string_int" + result_type { primitive: STRING } + params { primitive: STRING } + params { primitive: INT64 } + } + } + } + typed_result { + deduced_type { + primitive: STRING + } + } + } +} + +# These are somewhat complex expressions for edge cases in type inference. The +# result values are not interesting, but the inferred types are. +section { + name: "flexible_type_parameter_assignment" + test { + name: "list_parameter" + expr: "[[], [[]], [[[]]], [[[[]]]]]" + check_only: true + typed_result { + deduced_type { + list_type { + elem_type { + list_type { + elem_type { + list_type { + elem_type { + list_type { + elem_type { + list_type { + elem_type { dyn {} } + } + } + } + } + } + } + } + } + } + } + } + } + test { + name: "list_parameter_order_independent" + expr: "[[[[[]]]], [], [[[]]]]" + check_only: true + typed_result { + deduced_type { + list_type { + elem_type { + list_type { + elem_type { + list_type { + elem_type { + list_type { + elem_type { + list_type { + elem_type { dyn {} } + } + } + } + } + } + } + } + } + } + } + } + } + test { + name: "comprehension_type_var_aliasing" + expr: "msg.repeated_nested_message.map(x, x).map(y, y.bb)" + check_only: true + type_env { + name: "msg" + ident { + type { + message_type: "cel.expr.conformance.proto3.TestAllTypes" + } + } + } + typed_result { + deduced_type { + list_type { + elem_type { + primitive: INT64 + } + } + } + } + } + test { + name: "overload_type_var_aliasing" + expr: "([] + msg.repeated_nested_message + [])[0].bb" + check_only: true + type_env { + name: "msg" + ident { + type { + message_type: "cel.expr.conformance.proto3.TestAllTypes" + } + } + } + typed_result { + deduced_type { + primitive: INT64 + } + } + } + test { + name: "unconstrained_type_var_as_dyn" + expr: "([].map(x,x))[0].foo" + check_only: true + typed_result { + deduced_type { + dyn {} + } + } + } + test { + name: "list_parameters_do_not_unify" + expr: "[msg.single_int64_wrapper, msg.single_string_wrapper]" + type_env { + name: "msg" + ident { + type { + message_type: "cel.expr.conformance.proto3.TestAllTypes" + } + } + } + check_only: true + typed_result { + deduced_type { + list_type { + elem_type { + dyn {} + } + } + } + } + } + test { + name: "optional_none" + expr: "[optional.none(), optional.of(1)]" + check_only: true + typed_result { + deduced_type { + list_type { + elem_type { + abstract_type { + name: "optional_type" + parameter_types { primitive: INT64 } + } + } + } + } + } + } + test { + name: "optional_none_2" + expr: "[optional.of(1), optional.none()]" + check_only: true + typed_result { + deduced_type { + list_type { + elem_type { + abstract_type { + name: "optional_type" + parameter_types { primitive: INT64 } + } + } + } + } + } + } + test { + name: "optional_dyn_promotion" + expr: "[optional.of(1), optional.of(dyn(1))]" + check_only: true + typed_result { + deduced_type { + list_type { + elem_type { + abstract_type { + name: "optional_type" + parameter_types { dyn {} } + } + } + } + } + } + } + test { + name: "optional_dyn_promotion_2" + expr: "[optional.of(dyn(1)), optional.of(1)]" + check_only: true + typed_result { + deduced_type { + list_type { + elem_type { + abstract_type { + name: "optional_type" + parameter_types { dyn {} } + } + } + } + } + } + } + test { + name: "optional_in_ternary" + expr: "true ? optional.of(dyn(1)) : optional.of(1)" + check_only: true + typed_result { + deduced_type { + abstract_type { + name: "optional_type" + parameter_types { dyn {} } + } + } + } + } +} + +# Wrapper types have some special handling. They generally behave like a union +# type e.g. `null | int64` with auto-unboxing, but there are some quirks. +section { + name: "wrappers" + test { + name: "wrapper_promotion" + type_env { + name: "msg" + ident { + type { + message_type: "cel.expr.conformance.proto3.TestAllTypes" + } + } + } + expr: "[msg.single_int64_wrapper, msg.single_int64]" + check_only: true + typed_result { + deduced_type { + list_type { + elem_type { + wrapper: INT64 + } + } + } + } + } + test { + name: "wrapper_promotion_2" + type_env { + name: "msg" + ident { + type { + message_type: "cel.expr.conformance.proto3.TestAllTypes" + } + } + } + expr: "[msg.single_int64, msg.single_int64_wrapper]" + check_only: true + typed_result { + deduced_type { + list_type { + elem_type { + wrapper: INT64 + } + } + } + } + } + test { + name: "wrapper_dyn_promotion" + type_env { + name: "msg" + ident { + type { + message_type: "cel.expr.conformance.proto3.TestAllTypes" + } + } + } + expr: "[msg.single_int64_wrapper, msg.single_int64, dyn(1)]" + check_only: true + typed_result { + deduced_type { + list_type { + elem_type { + dyn {} + } + } + } + } + } + test { + name: "wrapper_dyn_promotion_2" + type_env { + name: "msg" + ident { + type { + message_type: "cel.expr.conformance.proto3.TestAllTypes" + } + } + } + expr: "[dyn(1), msg.single_int64_wrapper, msg.single_int64]" + check_only: true + typed_result { + deduced_type { + list_type { + elem_type { + dyn {} + } + } + } + } + } + test { + name: "wrapper_primitive_assignable" + type_env { + name: "msg" + ident { + type { + message_type: "cel.expr.conformance.proto3.TestAllTypes" + } + } + } + expr: "msg.single_int64_wrapper + 1" + check_only: true + typed_result { + deduced_type { + primitive: INT64 + } + } + } + test { + name: "wrapper_null_assignable" + type_env { + name: "msg" + ident { + type { + message_type: "cel.expr.conformance.proto3.TestAllTypes" + } + } + } + expr: "msg.single_int64_wrapper == null" + check_only: true + typed_result { + deduced_type { + primitive: BOOL + } + } + } + test { + name: "wrapper_ternary_parameter_assignment" + type_env { + name: "msg" + ident { + type { + message_type: "cel.expr.conformance.proto3.TestAllTypes" + } + } + } + expr: "false ? msg.single_int64_wrapper : null" + check_only: true + typed_result { + deduced_type { + wrapper: INT64 + } + } + } + test { + name: "wrapper_ternary_parameter_assignment_2" + type_env { + name: "msg" + ident { + type { + message_type: "cel.expr.conformance.proto3.TestAllTypes" + } + } + } + expr: "true ? msg.single_int64_wrapper : 42" + check_only: true + typed_result { + deduced_type { + wrapper: INT64 + } + } + } +} + +section { + name: "type_parameters" + test { + name: "multiple_parameters_generality" + check_only: true + expr: "[tuple(1, 2u, 3.0), tuple(dyn(1), dyn(2u), dyn(3.0))][0]" + type_env { + name: "tuple" + function { + overloads { + overload_id: "tuple_T_U_V" + params { type_param: "T" } + params { type_param: "U" } + params { type_param: "V" } + result_type { + abstract_type { + name: "tuple" + parameter_types { type_param: "T" } + parameter_types { type_param: "U" } + parameter_types { type_param: "V" } + } + } + } + } + } + typed_result { + deduced_type { + abstract_type { + name: "tuple" + parameter_types { dyn {} } + parameter_types { dyn {} } + parameter_types { dyn {} } + } + } + } + } + test { + name: "multiple_parameters_generality_2" + check_only: true + expr: "sort(tuple(dyn(1), 2u, 3.0))" + type_env { + name: "tuple" + function { + overloads { + overload_id: "tuple_T_U_V" + params { type_param: "T" } + params { type_param: "U" } + params { type_param: "V" } + result_type { + abstract_type { + name: "tuple" + parameter_types { type_param: "T" } + parameter_types { type_param: "U" } + parameter_types { type_param: "V" } + } + } + } + } + } + type_env { + name: "sort" + function { + overloads { + overload_id: "sort_tuple_T_T_T" + params { + abstract_type { + name: "tuple" + parameter_types { type_param: "T" } + parameter_types { type_param: "T" } + parameter_types { type_param: "T" } + } + } + result_type { + abstract_type { + name: "tuple" + parameter_types { type_param: "T" } + parameter_types { type_param: "T" } + parameter_types { type_param: "T" } + } + } + } + } + } + typed_result { + deduced_type { + abstract_type { + name: "tuple" + parameter_types { dyn {} } + parameter_types { dyn {} } + parameter_types { dyn {} } + } + } + } + } + test { + name: "multiple_parameters_parameterized_ovl" + check_only: true + expr: "tuple(1, 2u, 3.0) == tuple(1, dyn(2u), dyn(3.0))" + type_env { + name: "tuple" + function { + overloads { + overload_id: "tuple_T_U_V" + params { type_param: "T" } + params { type_param: "U" } + params { type_param: "V" } + result_type { + abstract_type { + name: "tuple" + parameter_types { type_param: "T" } + parameter_types { type_param: "U" } + parameter_types { type_param: "V" } + } + } + } + } + } + typed_result { + deduced_type { + primitive: BOOL + } + } + } + test { + name: "multiple_parameters_parameterized_ovl_2" + check_only: true + expr: "tuple(dyn(1), dyn(2u), 3.0) == tuple(1, 2u, 3.0)" + type_env { + name: "tuple" + function { + overloads { + overload_id: "tuple_T_U_V" + params { type_param: "T" } + params { type_param: "U" } + params { type_param: "V" } + result_type { + abstract_type { + name: "tuple" + parameter_types { type_param: "T" } + parameter_types { type_param: "U" } + parameter_types { type_param: "V" } + } + } + } + } + } + typed_result { + deduced_type { + primitive: BOOL + } + } + } +} + +# Messages, some well-known types, and abstract can be assigned from null in the +# CEL type checkers for historical reasons. For backward compatibility, we +# maintain this behavior but it's a bit inconsistent with the intended meaning +# of null (a singleton representing a JSON null literal) in CEL. +section { + name: "legacy_nullable_types" + test { + name: "null_assignable_to_message_parameter_candidate" + type_env { + name: "msg" + ident { + type { + message_type: "cel.expr.conformance.proto3.TestAllTypes" + } + } + } + bindings { + key: "msg" + value { + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] {} + } + } + } + } + expr: "[msg, null][0]" + typed_result { + deduced_type { + message_type: "cel.expr.conformance.proto3.TestAllTypes" + } + result { + object_value { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] {} + } + } + } + } + test { + name: "null_assignable_to_duration_parameter_candidate" + type_env { + name: "msg" + ident { + type { + message_type: "cel.expr.conformance.proto3.TestAllTypes" + } + } + } + bindings { + key: "msg" + value { + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] {} + } + } + } + } + expr: "[msg.single_duration, null][0]" + typed_result { + deduced_type { + well_known: DURATION + } + result { + object_value { + [type.googleapis.com/google.protobuf.Duration] {} + } + } + } + } + test { + name: "null_assignable_to_timestamp_parameter_candidate" + type_env { + name: "msg" + ident { + type { + message_type: "cel.expr.conformance.proto3.TestAllTypes" + } + } + } + bindings { + key: "msg" + value { + value { + object_value { + [type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes] {} + } + } + } + } + expr: "[msg.single_timestamp, null][0]" + typed_result { + deduced_type { + well_known: TIMESTAMP + } + result { + object_value { + [type.googleapis.com/google.protobuf.Timestamp] {} + } + } + } + } + test { + name: "null_assignable_to_abstract_parameter_candidate" + expr: "[optional.of(1), null][0]" + check_only: true + typed_result { + deduced_type { + abstract_type { + name: "optional_type" + parameter_types { primitive: INT64 } + } + } + } + } +} diff --git a/features/unknowns.feature b/features/unknowns.feature index a810872..d1eaef3 100644 --- a/features/unknowns.feature +++ b/features/unknowns.feature @@ -1,3 +1,4 @@ - +@conformance Feature: unknowns Tests for evaluation with unknown inputs. + diff --git a/features/unknowns.textproto b/features/unknowns.textproto index 4b17570..1464f83 100644 --- a/features/unknowns.textproto +++ b/features/unknowns.textproto @@ -1,2 +1,5 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: google.api.expr.test.v1.SimpleTestFile + name: "unknowns" description: "Tests for evaluation with unknown inputs." diff --git a/features/wrappers.feature b/features/wrappers.feature new file mode 100644 index 0000000..f601258 --- /dev/null +++ b/features/wrappers.feature @@ -0,0 +1,296 @@ +@conformance +Feature: wrappers + Conformance tests related to wrapper types. + + +# bool -- + +@wip +Scenario: bool/to_any + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_any: google.protobuf.BoolValue{value: true}}.single_any' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +@wip +Scenario: bool/to_json + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_value: google.protobuf.BoolValue{value: true}}.single_value' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + +Scenario: bool/to_null + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_bool_wrapper: null} == TestAllTypes{}' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + + +# int32 -- + +@wip +Scenario: int32/to_any + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_any: google.protobuf.Int32Value{value: 1}}.single_any' is evaluated + Then value is celpy.celtypes.IntType(source=1) + +@wip +Scenario: int32/to_json + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_value: google.protobuf.Int32Value{value: 1}}.single_value' is evaluated + Then value is celpy.celtypes.DoubleType(source=1.0) + +@wip +Scenario: int32/to_null + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_int32_wrapper: null} == TestAllTypes{}' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + + +# int64 -- + +@wip +Scenario: int64/to_any + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_any: google.protobuf.Int64Value{value: 1}}.single_any' is evaluated + Then value is celpy.celtypes.IntType(source=1) + +@wip +Scenario: int64/to_json_number + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_value: google.protobuf.Int64Value{value: 1}}.single_value' is evaluated + Then value is celpy.celtypes.DoubleType(source=1.0) + +@wip +Scenario: int64/to_json_string + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_value: google.protobuf.Int64Value{value: 9223372036854775807}}.single_value' is evaluated + Then value is celpy.celtypes.StringType(source='9223372036854775807') + +Scenario: int64/to_null + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_int64_wrapper: null} == TestAllTypes{}' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + + +# uint32 -- + +@wip +Scenario: uint32/to_any + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_any: google.protobuf.UInt32Value{value: 1u}}.single_any' is evaluated + Then value is celpy.celtypes.UintType(source=1) + +@wip +Scenario: uint32/to_json + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_value: google.protobuf.UInt32Value{value: 1u}}.single_value' is evaluated + Then value is celpy.celtypes.DoubleType(source=1.0) + +@wip +Scenario: uint32/to_null + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_uint32_wrapper: null} == TestAllTypes{}' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + + +# uint64 -- + +@wip +Scenario: uint64/to_any + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_any: google.protobuf.UInt64Value{value: 1u}}.single_any' is evaluated + Then value is celpy.celtypes.UintType(source=1) + +@wip +Scenario: uint64/to_json_number + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_value: google.protobuf.UInt64Value{value: 1u}}.single_value' is evaluated + Then value is celpy.celtypes.DoubleType(source=1.0) + +@wip +Scenario: uint64/to_json_string + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_value: google.protobuf.UInt64Value{value: 18446744073709551615u}}.single_value' is evaluated + Then value is celpy.celtypes.StringType(source='18446744073709551615') + +Scenario: uint64/to_null + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_uint64_wrapper: null} == TestAllTypes{}' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + + +# float -- + +@wip +Scenario: float/to_any + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_any: google.protobuf.FloatValue{value: 1.0}}.single_any' is evaluated + Then value is celpy.celtypes.DoubleType(source=1.0) + +@wip +Scenario: float/to_json + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_value: google.protobuf.FloatValue{value: 1.0}}.single_value' is evaluated + Then value is celpy.celtypes.DoubleType(source=1.0) + +@wip +Scenario: float/to_null + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_float_wrapper: null} == TestAllTypes{}' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + + +# double -- + +@wip +Scenario: double/to_any + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_any: google.protobuf.DoubleValue{value: 1.0}}.single_any' is evaluated + Then value is celpy.celtypes.DoubleType(source=1.0) + +@wip +Scenario: double/to_json + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_value: google.protobuf.DoubleValue{value: 1.0}}.single_value' is evaluated + Then value is celpy.celtypes.DoubleType(source=1.0) + +Scenario: double/to_null + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_double_wrapper: null} == TestAllTypes{}' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + + +# bytes -- + +@wip +Scenario: bytes/to_any + + Given container is 'cel.expr.conformance.proto3' + When CEL expression "TestAllTypes{single_any: google.protobuf.BytesValue{value: b'foo'}}.single_any" is evaluated + Then value is celpy.celtypes.BytesType(source=b'foo') + +@wip +Scenario: bytes/to_json + + Given container is 'cel.expr.conformance.proto3' + When CEL expression "TestAllTypes{single_value: google.protobuf.BytesValue{value: b'foo'}}.single_value" is evaluated + Then value is celpy.celtypes.StringType(source='Zm9v') + +Scenario: bytes/to_null + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_bytes_wrapper: null} == TestAllTypes{}' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + + +# string -- + +@wip +Scenario: string/to_any + + Given container is 'cel.expr.conformance.proto3' + When CEL expression "TestAllTypes{single_any: google.protobuf.StringValue{value: 'foo'}}.single_any" is evaluated + Then value is celpy.celtypes.StringType(source='foo') + +@wip +Scenario: string/to_json + + Given container is 'cel.expr.conformance.proto3' + When CEL expression "TestAllTypes{single_value: google.protobuf.StringValue{value: 'foo'}}.single_value" is evaluated + Then value is celpy.celtypes.StringType(source='foo') + +Scenario: string/to_null + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_string_wrapper: null} == TestAllTypes{}' is evaluated + Then value is celpy.celtypes.BoolType(source=True) + + +# value -- + +@wip +Scenario: value/default_to_json + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_any: TestAllTypes{}.single_value}.single_any' is evaluated + Then value is None + + +# list_value -- + +Scenario: list_value/literal_to_any + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_any: []}.single_any' is evaluated + Then value is [] + + +# struct -- + +Scenario: struct/literal_to_any + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_any: {}}.single_any' is evaluated + Then value is celpy.celtypes.MapType({}) + + +# field_mask -- + +@wip +Scenario: field_mask/to_json + + Given container is 'cel.expr.conformance.proto3' + When CEL expression "TestAllTypes{single_value: google.protobuf.FieldMask{paths: ['foo', 'bar']}}.single_value" is evaluated + Then value is celpy.celtypes.StringType(source='foo,bar') + + +# duration -- + +@wip +Scenario: duration/to_json + + Given container is 'cel.expr.conformance.proto3' + When CEL expression "TestAllTypes{single_value: duration('1000000s')}.single_value" is evaluated + Then value is celpy.celtypes.StringType(source='1000000s') + + +# timestamp -- + +@wip +Scenario: timestamp/to_json + + Given container is 'cel.expr.conformance.proto3' + When CEL expression "TestAllTypes{single_value: timestamp('9999-12-31T23:59:59.999999999Z')}.single_value" is evaluated + Then value is celpy.celtypes.StringType(source='9999-12-31T23:59:59.999999999Z') + + +# empty -- + +@wip +Scenario: empty/to_json + + Given container is 'cel.expr.conformance.proto3' + When CEL expression 'TestAllTypes{single_value: google.protobuf.Empty{}}.single_value' is evaluated + Then value is celpy.celtypes.MapType({}) + diff --git a/features/wrappers.textproto b/features/wrappers.textproto new file mode 100644 index 0000000..4ec9e82 --- /dev/null +++ b/features/wrappers.textproto @@ -0,0 +1,374 @@ +# proto-file: ../../../proto/cel/expr/conformance/test/simple.proto +# proto-message: cel.expr.conformance.test.SimpleTestFile + +name: "wrappers" +description: "Conformance tests related to wrapper types." + +# google.protobuf.BoolValue +section { + name: "bool" + test { + name: "to_any" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_any: google.protobuf.BoolValue{value: true}}.single_any" + value { + bool_value: true + } + } + test { + name: "to_json" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_value: google.protobuf.BoolValue{value: true}}.single_value" + value { + bool_value: true + } + } + test { + name: "to_null" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_bool_wrapper: null} == TestAllTypes{}" + value { + bool_value: true + } + } +} + +# google.protobuf.Int32Value +section { + name: "int32" + test { + name: "to_any" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_any: google.protobuf.Int32Value{value: 1}}.single_any" + value { + int64_value: 1 + } + } + test { + name: "to_json" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_value: google.protobuf.Int32Value{value: 1}}.single_value" + value { + double_value: 1 + } + } + test { + name: "to_null" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_int32_wrapper: null} == TestAllTypes{}" + value { + bool_value: true + } + } +} + +# google.protobuf.Int64Value +section { + name: "int64" + test { + name: "to_any" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_any: google.protobuf.Int64Value{value: 1}}.single_any" + value { + int64_value: 1 + } + } + test { + name: "to_json_number" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_value: google.protobuf.Int64Value{value: 1}}.single_value" + value { + double_value: 1 + } + } + test { + name: "to_json_string" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_value: google.protobuf.Int64Value{value: 9223372036854775807}}.single_value" + value { + string_value: "9223372036854775807" + } + } + test { + name: "to_null" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_int64_wrapper: null} == TestAllTypes{}" + value { + bool_value: true + } + } +} + +# google.protobuf.UInt32Value +section { + name: "uint32" + test { + name: "to_any" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_any: google.protobuf.UInt32Value{value: 1u}}.single_any" + value { + uint64_value: 1 + } + } + test { + name: "to_json" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_value: google.protobuf.UInt32Value{value: 1u}}.single_value" + value { + double_value: 1 + } + } + test { + name: "to_null" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_uint32_wrapper: null} == TestAllTypes{}" + value { + bool_value: true + } + } +} + +# google.protobuf.UInt64Value +section { + name: "uint64" + test { + name: "to_any" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_any: google.protobuf.UInt64Value{value: 1u}}.single_any" + value { + uint64_value: 1 + } + } + test { + name: "to_json_number" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_value: google.protobuf.UInt64Value{value: 1u}}.single_value" + value { + double_value: 1 + } + } + test { + name: "to_json_string" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_value: google.protobuf.UInt64Value{value: 18446744073709551615u}}.single_value" + value { + string_value: "18446744073709551615" + } + } + test { + name: "to_null" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_uint64_wrapper: null} == TestAllTypes{}" + value { + bool_value: true + } + } +} + +# google.protobuf.FloatValue +section { + name: "float" + test { + name: "to_any" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_any: google.protobuf.FloatValue{value: 1.0}}.single_any" + value { + double_value: 1 + } + } + test { + name: "to_json" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_value: google.protobuf.FloatValue{value: 1.0}}.single_value" + value { + double_value: 1 + } + } + test { + name: "to_null" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_float_wrapper: null} == TestAllTypes{}" + value { + bool_value: true + } + } +} + +# google.protobuf.DoubleValue +section { + name: "double" + test { + name: "to_any" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_any: google.protobuf.DoubleValue{value: 1.0}}.single_any" + value { + double_value: 1 + } + } + test { + name: "to_json" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_value: google.protobuf.DoubleValue{value: 1.0}}.single_value" + value { + double_value: 1 + } + } + test { + name: "to_null" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_double_wrapper: null} == TestAllTypes{}" + value { + bool_value: true + } + } +} + +# google.protobuf.BytesValue +section { + name: "bytes" + test { + name: "to_any" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_any: google.protobuf.BytesValue{value: b'foo'}}.single_any" + value { + bytes_value: "foo" + } + } + test { + name: "to_json" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_value: google.protobuf.BytesValue{value: b'foo'}}.single_value" + value { + string_value: "Zm9v" + } + } + test { + name: "to_null" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_bytes_wrapper: null} == TestAllTypes{}" + value { + bool_value: true + } + } +} + +# google.protobuf.StringValue +section { + name: "string" + test { + name: "to_any" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_any: google.protobuf.StringValue{value: 'foo'}}.single_any" + value { + string_value: "foo" + } + } + test { + name: "to_json" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_value: google.protobuf.StringValue{value: 'foo'}}.single_value" + value { + string_value: "foo" + } + } + test { + name: "to_null" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_string_wrapper: null} == TestAllTypes{}" + value { + bool_value: true + } + } +} + +# google.protobuf.Value +section { + name: "value" + test { + name: "default_to_json" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_any: TestAllTypes{}.single_value}.single_any" + value { + null_value: NULL_VALUE + } + } +} + +# google.protobuf.ListValue +section { + name: "list_value" + description: "" + test { + name: "literal_to_any" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_any: []}.single_any" + value { + list_value {} + } + } +} + +# google.protobuf.Struct +section { + name: "struct" + test { + name: "literal_to_any" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_any: {}}.single_any" + value { + map_value {} + } + } +} + +# google.protobuf.FieldMask +section { + name: "field_mask" + test { + name: "to_json" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_value: google.protobuf.FieldMask{paths: ['foo', 'bar']}}.single_value" + value { + string_value: "foo,bar" + } + } +} + +# google.protobuf.Duration +section { + name: "duration" + test { + name: "to_json" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_value: duration('1000000s')}.single_value" + value { + string_value: "1000000s" + } + } +} + +# google.protobuf.Timestamp +section { + name: "timestamp" + test { + name: "to_json" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_value: timestamp('9999-12-31T23:59:59.999999999Z')}.single_value" + value { + string_value: "9999-12-31T23:59:59.999999999Z" + } + } +} + +# google.protobuf.Empty +section { + name: "empty" + test { + name: "to_json" + container: "cel.expr.conformance.proto3" + expr: "TestAllTypes{single_value: google.protobuf.Empty{}}.single_value" + value { + map_value {} + } + } +} diff --git a/pyproject.toml b/pyproject.toml index 0f7916d..ee6b266 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,14 +29,14 @@ authors = [ requires-python = ">=3.9" dependencies = [ - "lark>=1.2.2", - "pendulum>=3.1.0", - "pyyaml>=6.0.2", - "jmespath>=1.0.1", # 3.13 needs at least this version, which started publishing wheels for Python 3.13. # Ref: https://github.com/google/re2/issues/516 - "google-re2>=1.1.20250722; python_version == '3.13'", "google-re2>=1.1.20240702", + "google-re2>=1.1.20250722; python_version == '3.13'", + "jmespath>=1.0.1", + "lark>=1.2.2", + "pendulum>=3.1.0", + "pyyaml>=6.0.2", "tomli >= 1.1.0 ; python_version < '3.11'", ] @@ -50,17 +50,87 @@ build-backend = "hatchling.build" [tool.hatch.build.targets.wheel] packages = ["src/celpy"] +[[tool.uv.index]] +url = "https://buf.build/gen/python" + [dependency-groups] dev = [ "behave>=1.2.6", "coverage>=7.8.1", + "google-cel-spec-protocolbuffers-pyi==32.1.0.1.20250512201741+dffb8c8cf781", + "google-cel-spec-protocolbuffers-python==32.1.0.1.20250512201741+dffb8c8cf781", + "google-re2-stubs", + "jinja2>=3.1.6", "mypy>=1.15.0", + "protobuf>=6.32.1", + "pytest-cov>=6.3.0", "pytest>=8.3.5", "ruff>=0.11.10", "sphinx>=7.4.7", - "tox>=4.24", + "sphinxcontrib-plantuml>=0.30", + "sphinxcontrib-programoutput>=0.18", + "toml>=0.10.2", "tox-uv>=1.25.0", + "tox>=4.24", + "types-protobuf>=6.30.2.20250914", "types-pyyaml>=6.0.12.20250516", - "google-re2-stubs", - "sphinxcontrib-plantuml>=0.30", + "types-toml>=0.10.8.20240310", +] + +[tool.tox] +envlist = ["py39", "py310", "py311", "py312", "py313", "lint", "tools"] +minversion = "4.24.0" + +[tool.tox.env_run_base] +description = "test suite" +dependency_groups = ["dev"] +setenv = { PYTHONPATH = "./src" } +commands = [ + ["pytest", "-vv"], + ["pytest", "-v", "--doctest-modules", "src"], + ["pytest", "-v", "--doctest-modules", "README.rst"], + ["behave", "--tags=~@wip", "--tags=~@future", "-D", "env='{envname}'", "-f", "rerun", "--stop"], + ["behave", "--tags=~@wip", "--tags=~@future", "-D", "env='{envname}'", "-D", "runner='compiled'", "-f", "rerun", "--stop"], + ["python", "-m", "doctest", "{toxinidir}/docs/source/api.rst", "{toxinidir}/docs/source/cli.rst", "docs/source/index.rst", "docs/source/integration.rst"], + ["pytest", "-v", "-o", "python_classes='PYTest*'", "tools"] +] + +[tool.tox.env.tools] +description = "conformance suite conversion tools" +commands = [["pytest", "-v", "tools"]] + +[tool.tox.env.wip] +description = "work-in-progress test suite" +commands = [["behave", "--tags=@wip"]] + +[tool.tox.env.conformance] +commands = [["behave", "--tags=@conformance", "--tags=~@wip"]] + +[tool.tox.env.conformance-compiled] +description = "compiled runner" +commands = [["behave", "--tags=@conformance", "--tags=~@wip", "-D", "runner='compiled'"]] + +[tool.tox.env.conformance-wip] +description = "work in progress" +commands = [["behave", "--tags=@conformance", "--tags=@wip"]] + +[tool.tox.env.conformance-wip-compiled] +description = "work in progress + compiled runner" +commands = [["behave", "--tags=@conformance", "--tags=@wip", "-D", "runner='compiled'"]] + +[tool.tox.env.lint] +description = "check types, formatting, and best practices" +commands = [ + ["mypy", "--lineprecision-report", "type_check", "--strict", "--disable-error-code", "type-arg", "--show-error-codes", "src", "tools"], + ["ruff", "check", "src", "tools"], + ["ruff", "format", "--diff", "src", "tools"] +] + +[tool.tox.env.coverage] +description = "generate coverage reports" +commands = [ + ["coverage", "erase"], + ["pytest", "-vv", "-x", "--cov=src", "--cov-report=term-missing"], + ["coverage", "html"], + ["coverage", "xml"], ] diff --git a/src/celpy/__main__.py b/src/celpy/__main__.py index 0b89173..6a344c6 100644 --- a/src/celpy/__main__.py +++ b/src/celpy/__main__.py @@ -35,9 +35,9 @@ from typing import Any, Callable, Dict, List, Optional, Tuple, Union, cast try: - import tomllib + import tomllib # type: ignore [import-not-found, unused-ignore] except ImportError: # pragma: no cover - import tomli as tomllib # type: ignore [no-redef] + import tomli as tomllib # type: ignore [no-redef, import-not-found, unused-import, unused-ignore] from celpy import Environment, Runner, celtypes from celpy.adapter import CELJSONDecoder, CELJSONEncoder @@ -287,13 +287,15 @@ def stat(path: Union[Path, str]) -> Optional[celtypes.MapType]: try: extra = { "st_birthtime": celtypes.TimestampType( - datetime.datetime.fromtimestamp(status.st_birthtime) + datetime.datetime.fromtimestamp( + status.st_birthtime # type:ignore [attr-defined, unused-ignore] + ) ), "st_blksize": celtypes.IntType(status.st_blksize), "st_blocks": celtypes.IntType(status.st_blocks), - "st_flags": celtypes.IntType(status.st_flags), + "st_flags": celtypes.IntType(status.st_flags), # type: ignore [attr-defined, unused-ignore] "st_rdev": celtypes.IntType(status.st_rdev), - "st_gen": celtypes.IntType(status.st_gen), + "st_gen": celtypes.IntType(status.st_gen), # type: ignore [attr-defined, unused-ignore] } except AttributeError: # pragma: no cover extra = {} diff --git a/src/celpy/celtypes.py b/src/celpy/celtypes.py index 71115e3..3e47271 100644 --- a/src/celpy/celtypes.py +++ b/src/celpy/celtypes.py @@ -443,7 +443,7 @@ def __repr__(self) -> str: return f"{self.__class__.__name__}({super().__repr__()})" def contains(self, item: Value) -> BoolType: - return BoolType(cast(BytesType, item) in self) + return BoolType(cast(BytesType, item) in self) # type: ignore [comparison-overlap] class DoubleType(float): @@ -853,7 +853,7 @@ def equal(s: Any, o: Any) -> Value: result_value = len(self) == len(other) and reduce( logical_and, # type: ignore [arg-type] (equal(item_s, item_o) for item_s, item_o in zip(self, other)), - BoolType(True), # type: ignore [arg-type] + BoolType(True), ) if isinstance(result_value, TypeError): raise result_value @@ -872,7 +872,7 @@ def not_equal(s: Any, o: Any) -> Value: result_value = len(self) != len(other) or reduce( logical_or, # type: ignore [arg-type] (not_equal(item_s, item_o) for item_s, item_o in zip(self, other)), - BoolType(False), # type: ignore [arg-type] + BoolType(False), ) if isinstance(result_value, TypeError): raise result_value @@ -942,7 +942,7 @@ def equal(s: Any, o: Any) -> BoolType: result_value = keys_s == keys_o and reduce( logical_and, # type: ignore [arg-type] (equal(self[k], other[k]) for k in keys_s), - BoolType(True), # type: ignore [arg-type] + BoolType(True), ) if isinstance(result_value, TypeError): raise result_value @@ -970,7 +970,7 @@ def not_equal(s: Any, o: Any) -> BoolType: result_value = keys_s != keys_o or reduce( logical_or, # type: ignore [arg-type] (not_equal(self[k], other[k]) for k in keys_s), - BoolType(False), # type: ignore [arg-type] + BoolType(False), ) if isinstance(result_value, TypeError): raise result_value diff --git a/tools/Dockerfile b/tools/Dockerfile deleted file mode 100644 index 9498331..0000000 --- a/tools/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM golang:1.24 - -ENV HOME=/usr/cel-python -WORKDIR $HOME/tools - -# pre-copy/cache go.mod for pre-downloading dependencies and only redownloading them in subsequent builds if they change -COPY go.mod go.sum ./ -RUN go mod download - -COPY ./*.go . -RUN go build -v -o /usr/local/bin/mkgherkin ./... - -WORKDIR $HOME/textproto -ENTRYPOINT ["mkgherkin"] diff --git a/tools/README.rst b/tools/README.rst index a2c5505..a027ef4 100644 --- a/tools/README.rst +++ b/tools/README.rst @@ -2,17 +2,8 @@ Tools to Create the Conformance Test Suite ########################################## -The conformance test files originte from the https://github.com/google/cel-spec.git repository. -They are all protobuf objects, serialized into ``textproto``. - -The ``pb2g.py`` and the ``mkgerkin.go`` apps translate these into Gherkin. - -Purpose -======= - -Overall, the conformance test tools work like this: - -1. Start with the ``.textproto`` source: +The conformance test files originate from the https://github.com/google/cel-spec repository. +They are all Protobuf messages, serialized into ``textproto``, like this: .. code-block:: protobuf @@ -22,170 +13,57 @@ Overall, the conformance test tools work like this: value: { int64_value: 0 } } -2. An Interim Gherkin is created using Go-language syntax for objects. - -3. The final Gherkin is created using Python-language syntax. - Here's the Gherkin: - - .. code-block:: gherkin - - Scenario: self_eval_int_zero - When CEL expression "0" is evaluated - # int64_value:0 - Then value is IntType(source=0) - -The Gherkin can make a bunch of test features explicit in each Scenario. -Specifically, some parameters can be set in ``Given`` clause: - -- ``Given disable_check parameter is True`` - -- ``Given type_env ... is ...`` Sets a type for a given parameter name. - -- ``Given bindings ... is ...`` Sets a value for a given parameter name. - -Operation -=========== +The ``gherkinize.py`` script translates these into Gherkin scenarios. -The Gherkin creation is controlled by a Makefile that does several things. +Usage +===== -- ``make all`` checks the cel-spec repository for ``.textproto`` files, - moves them to the local ``features`` directory and converts them to ``.features`` files. +Gherkin generation is controlled by a Makefile in the ``features`` directory which provides +two commands: -- ``make scan`` runs the ``textproto_to_gherkin.py`` app to check syntax on the protobuf - files. This is used as a smoke test when adjusting the text protobuf grammar. - -- ``make clean-broken`` cleans up the empty ``.feature`` files. These are a consequence of - ``.textproto`` files that cannot be parsed. +- ``make all`` checks the cel-spec repository for ``.textproto`` files, copies them to the local + ``features`` directory, and converts them to ``.features`` files. - ``make clean`` removes the ``.feature`` and ``.textproto`` files. -The underlying command is this. +The underlying command runs the gherkinize.py script for each ``.textproto`` file: .. code-block:: bash - % python ../tools/pb2g.py basic.textproto -o basic.feature - -This converts a source ``.textproto`` file to an interim file, and from there to a final ``.feature`` file. - -A good way to use this is to do a checkout from https://github.com/google/cel-spec.git into -an adjacent directory. By deafult, the Makefile looks for ``../../cel-spec``. If this doesn't work -for you, set the ``CEL_SPEC_PATH`` environment variable. - -On Gherkinization -================= - -The question arises on how best to serialize descriptions of the objects created by a CEL evaluation. -We have three distinct notations to deal with: - -- Source Protobuf text in the ``.textproto`` files. - -- Final Python object used by Behave. - -- An intermediate text representation in the Gherkin that's created by a Go application. - -The idea is to write Gherkin tests that match the protobuf source closely, but can be processed by Behave without too much overhead. -(There are over 900 conformance tests; we don't want to take all day.) - -The use of a **Go** application is far simpler than trying to parse the ``.textproto`` files in Python. -The **Go** operations for expanding each ``.Section`` and ``.Test`` object into a Gherkin Scenario is very small, and narrowly focused on creating an easier-to-parse representation. - -There are three broad choices for Gherkin representation of expected results. - -- Protobuf, unmodified. ``{ int64_value: -1 }``. - This pushes the final parsing into the conformance test step definitions. + % python ../tools/gherkinize.py basic.textproto -o basic.feature -- Text representation of the Python target object. ``celpy.celtypes.IntType(-1)``. - This is highly Python-specific and not of general use to other implementers. +This parses a source ``.textproto`` file and generates an equivalent ``.feature`` file. -- An intermediate representation. ``Value(value_type='int64_value', source='x')``. - This is trivially produced by **Go**. - It preserves the protobuf semantics in a easy-to-parse form. +A good way to use this is to do a checkout from https://github.com/google/cel-spec into an adjacent +directory. By default, the Makefile looks for ``/../../google/cel-spec`` but the location can +be overridden with the ``CEL_SPEC_PATH`` environment variable. -The Python representation leverages the following class definition +gherkinize.py +============= -.. code-block:: python +Each ``.textproto`` file follows the ``SimpleTestFile`` `schema`_. - class Primitive(NamedTuple): - """A name: value pair.""" - type_name: Token - value_text: Token +.. _schema: https://buf.build/google/cel-spec/docs/main:cel.expr.conformance.test#cel.expr.conformance.test.SimpleTestFile - @property - def value(self) -> Any: - ... +These are deserialized into Python objects using an `SDK generated from the schemas`_. +.. _SDK generated from the schemas: https://buf.build/google/cel-spec/sdks/main:protocolbuffers/python -This describes a simple object with a type name and a value. -The ``Token`` class describes the syntax used by ``Go`` when serializing objects. -This includes the following kinds of symbols: +These Python objects that represent the Protobuf data and then loaded into classes that represented +Gherkin concepts (``features`` with comment-delineated sections, and ``scenarios`` with ``given``, +``when`` and ``then`` clauses) and CEL types native to this library. -.. csv-table:: - - NAMESPACE,``\\[name\\]`` - BOOL,``true|false`` - NULL,``NULL_VALUE`` - STRING,``"`` or ``'``-delimited strings - FLOAT,``[+-]?\\d*\\.\\d*[Ee]?[+-]?\\d*|inf|-inf|[+-]?\\d+[Ee][+-]?\\d+`` - INT,``[+-]?\\d+`` - NAME,``[a-zA-Z]\\w+`` - WHITESPACE,The usual RE whitespace, ``\\s+`` - PUNCTUATION,Any other punctuation character, this generally includes ``{``, ``}``, ``:``, and ``,`` as delimeters in a complex structure. - -A protobuf object like ``{ int64_value: 0 }`` has punctation, name, punctuation, int, and punctuation. -The parser can transform this into a ``Primitive`` object with the ``type_name`` and ``value`` attributes. - -This can be be modeled as a simple ``0`` in the Gherkin. -For a specific subset of available types the types map directly to Python objects. -For some objects, however, there isn't a trivial correspondence. - -Here is an example of some protobuf objects and the parsed representation. - -.. csv-table:: - - "{ int64_value: 0 }","Primitive(type_name=Token(type='NAME', value='int64_value'), value_text=Token(type='INT', value='0'))",IntType(source=0) - "{ uint64_value: 0 }","Primitive(type_name=Token(type='NAME', value='uint64_value'), value_text=Token(type='INT', value='0'))",UintType(source=0) - "{ double_value: 0 }","Primitive(type_name=Token(type='NAME', value='double_value'), value_text=Token(type='INT', value='0'))",DoubleType(source=0) - "{ null_value: NULL_VALUE }","Primitive(type_name=Token(type='NAME', value='null_value'), value_text=Token(type='NULL', value='NULL_VALUE'))",None - "{ bool_value: false }","Primitive(type_name=Token(type='NAME', value='bool_value'), value_text=Token(type='BOOL', value='false'))",BoolType(source=False) - "{ string_value: """" }","Primitive(type_name=Token(type='NAME', value='string_value'), value_text=Token(type='STRING', value='""""'))",StringType(source='') - "{ bytes_value: """" }","Primitive(type_name=Token(type='NAME', value='bytes_value'), value_text=Token(type='STRING', value='""""'))",BytesType(source=b'') - -The resulting celtypes are all subclass of ``celpy.celtypes.TypeType``. - -The protobuf mappings are more complex. - - -More Complex Protobuf Definitions ---------------------------------- - -A universal ``TestAllTypes`` protobuf ``MessageType`` is used by the Dynamic tests that create protobuf objects. -It has numerous fields, but provides a handy way to define complex objects in a simple structure. - -Building the tool chain -======================= - -Run the following commands in the ``tools`` directory to create the needed Docker image. - -.. code-block:: bash - - % docker pull golang - % docker build -t mkgherkin . - -The ``Dockerfile`` will create a Docker image to run the Go application. - -The ``pb2g.py`` application will run the Docker image to do the initial conversion. - -A local ``textproto`` directory is the working directory for the interim conversion from ``.textproto`` to an interim Gherkin form. -These interim Gherkin files are then processed by the ``pb2g.py`` app to create the final ``.feature`` files for the conformance test suite. - -For reference, here's a docker command to run the container, -converting files to their interim form. - -While not necessary, you can manually commands like the following in the ``textproto`` working directory. - -.. code-block:: bash +The classes representing CEL types overload ``__repr__()`` with the Python code needed to +instantiate the actual CEL types in ``src/celpy/celtypes.py`` — this code is used when rendering +the Gherkin clauses. - % docker run --rm --name mkgherkin -v .:/usr/cel-python/textproto mkgherkin *.textproto +Finally, the classes representing features, sections, and scenarios are rendered to Gherkin tests +using the ``gherkin.feature.jinja`` template. -The output from a command like this is captured by ``pg2g.py`` and then post-processed to create the final **CEL** types. +Tests with unimplemented features (notably, enums) generate a warning but do not result in +scenarios. Tests which do not currently pass are listed in ``wip.txt`` in the format +``:
        :``. Presence in this file results in a ``@wip`` tag being added to +the scenario. In general, it's expected that scenarios will be removed from this list over time +and once passing, scenarios should never be added back to this file. +Finally, the complete, generated ``.feature`` files are all tagged with ``@conformance``. diff --git a/tools/gherkin.feature.jinja b/tools/gherkin.feature.jinja new file mode 100644 index 0000000..ab60011 --- /dev/null +++ b/tools/gherkin.feature.jinja @@ -0,0 +1,20 @@ +@conformance +Feature: {{ feature.name }} + {{ (feature.description | wordwrap(width=71,wrapstring="\n ")) }} + +{% for section in feature.sections %} + +# {{ section.name }} -- {{ section.description }} + +{% for scenario in section.scenarios %} +{% for tag in scenario.tags -%} +{{ tag }} +{% endfor -%} +Scenario: {{ section.name }}/{{ scenario.name }} +{{ " " + (scenario.description | wordwrap(width=70,wrapstring="\n ")) + "\n" if scenario.description else "" }} +{% for step in scenario.steps %} + {{ step }} +{% endfor %} + +{% endfor %} +{% endfor %} diff --git a/tools/gherkinize.py b/tools/gherkinize.py new file mode 100644 index 0000000..2159f50 --- /dev/null +++ b/tools/gherkinize.py @@ -0,0 +1,1142 @@ +# SPDX-Copyright: Copyright (c) Capital One Services, LLC +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2025 The Cloud Custodian Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +""" +The ``gherkinize.py`` tool converts a ``.textproto`` test case collection into a Gherkin ``.feature`` file. +This can be used to update the conformance tests in the ``features`` directory. + +Synopsis +-------- + +.. program:: python tools/gherkinize.py [-o output] [-sv] source + +.. option:: -o , --output + + Where to write the feature file. + Generally, it's helpful to have the ``.textproto`` and ``.feature`` stems match. + The ``Makefile`` assures this. + +.. option:: -s, --silent + + No console output is produced + +.. option:: -v, --verbose + + Verbose debugging output on the console. + +.. option:: source + + A source ``.textproto`` file. + This is often the path to a file in a local download of https://github.com/google/cel-spec/tree/master/tests/simple/testdata. + + A URL for the source is **not** supported. + + +Description +----------- + +Convert one ``.textproto`` file to a Gherkin ``.feature`` file. + +Files +----- + +:source: + A ``.textproto`` test case file from the ``cel-spec`` repository. + +:output: + A ``.feature`` file with the same stem as the source file is written to the output directory. + ``basic.textproto`` will create ``basic.feature``. + +Examples +-------- + +The ``basic.textproto`` starts like this: + +.. code-block:: protobuf + + name: "basic" + description: "Basic conformance tests that all implementations should pass." + section { + name: "self_eval_zeroish" + description: "Simple self-evaluating forms to zero-ish values." + test { + name: "self_eval_int_zero" + expr: "0" + value: { int64_value: 0 } + } + test { + name: "self_eval_uint_zero" + expr: "0u" + value: { uint64_value: 0 } + } + +The ``basic.feature`` file created looks like this: + +.. code-block:: gherkin + + @conformance + Feature: basic + Basic conformance tests that all implementations should pass. + + + # self_eval_zeroish -- Simple self-evaluating forms to zero-ish values. + + Scenario: self_eval_zeroish/self_eval_int_zero + + When CEL expression '0' is evaluated + Then value is celpy.celtypes.IntType(source=0) + + Scenario: self_eval_zeroish/self_eval_uint_zero + + When CEL expression '0u' is evaluated + Then value is celpy.celtypes.UintType(source=0) + +The source ``.textproto`` files have a "section" heading which doesn't have a precise parallel in the Gherkin language. +The sections become comments in the ``.feature`` file, and the section name is used to prefix each feature name. + +""" + +import argparse +from datetime import datetime, timedelta, timezone +from io import open +import logging +from os import path +from pathlib import Path +import sys +from typing import Any, Literal, Optional, Union, overload +from typing_extensions import Self +from jinja2 import Environment, FileSystemLoader +import toml + +# Note that the `noqa: F401` annotations are because these imports are needed so +# that the descriptors end up in the default descriptor pool, but aren't used +# explicitly and thus would be otherwise flagged as unused imports. +from cel.expr import checked_pb2, eval_pb2, value_pb2 +from cel.expr.conformance.test import simple_pb2 +from cel.expr.conformance.proto2 import ( + test_all_types_pb2 as proto2_test_all_types, # noqa: F401 + test_all_types_extensions_pb2 as proto2_test_all_types_extensions, # noqa: F401 +) +from cel.expr.conformance.proto3 import test_all_types_pb2 as proto3_test_all_types # noqa: F401 +from google.protobuf import ( + any_pb2, + descriptor_pool, + descriptor, # noqa: F401 + duration_pb2, + message_factory, + message, + struct_pb2, + symbol_database, # noqa: F401 + text_format, + timestamp_pb2, + wrappers_pb2, +) + +env = Environment( + loader=FileSystemLoader(path.dirname(__file__)), + trim_blocks=True, +) +template = env.get_template("gherkin.feature.jinja") +logger = logging.getLogger("gherkinize") +pool = descriptor_pool.Default() # type: ignore [no-untyped-call] + + +class Config: + """ + This class reads in optional configuration for conformance tests. Each scenario + is within a feature and a section. + + .. csv-table:: + :header: , feature, section, scenario + + **example**, string_ext, ascii_casing, lowerascii_unicode + + The value for each scenario can be a string tag (which must begin with + ``@``), an array of tags (each of which must begin with ``@``) or a dictionary + with a ``tags`` key containing an array of tags (each of which... y'know). + + For example, each of the following are valid: + + :: + + [bindings_ext.bind] + bind_nested = "@wip" + boolean_literal = [ "@wip" ] + + [bindings_ext.bind.macro_exists] + tags = [ "@wip" ] + + In the future, dictionaries with additional features may be supported. + """ + + # We tolerate some variation in the structure of the configuration for each + # scenario, but we need to canonicalize it as we load it. + _ScenarioInput = Union[str, list[str], dict[Literal["tags"], list[str]]] + _SectionInput = dict[str, "Config._ScenarioInput"] + _FeatureInput = dict[str, "Config._SectionInput"] + + # These are the canonical forms + _Scenario = dict[Literal["tags"], list[str]] + _Section = dict[str, "Config._Scenario"] + _Feature = dict[str, "Config._Section"] + + def __init__(self, path: str) -> None: + logger.debug(f"Reading from {repr(path)}...") + input = toml.load(path) + + if not isinstance(input, dict): + logger.error(f"Could not read from {repr(path)}") + return None + + features = [(k, Config._load_feature(k, v)) for k, v in input.items()] + self.features: dict[str, "Config._Feature"] = { + k: v for k, v in features if v is not None + } + + @staticmethod + def _load_feature( + context: str, input: "Config._FeatureInput" + ) -> "Config._Feature | None": + if not isinstance(input, dict): + logger.error(f"[{context}]: Skipping invalid feature: {repr(input)}") + return None + + sections = [ + (k, Config._load_section(f"{context}.{k}", v)) for k, v in input.items() + ] + return {k: v for k, v in sections if v is not None} + + @staticmethod + def _load_section( + context: str, input: "Config._SectionInput" + ) -> "Config._Section | None": + if not isinstance(input, dict): + logger.error(f"[{context}]: Skipping invalid section: {repr(input)}") + return None + + scenarios = [ + (k, Config._load_scenario(f"{context}.{k}", v)) for k, v in input.items() + ] + return {k: v for k, v in scenarios if v is not None} + + @staticmethod + def _load_scenario( + context: str, input: "Config._ScenarioInput" + ) -> "Config._Scenario | None": + tags = None + if isinstance(input, str): + tag = Config._load_tag(context, input) + tags = [tag] if tag is not None else [] + elif isinstance(input, list): + tags = Config._load_tag_list(context, input) + elif "tags" in input: + tags = Config._load_tag_list(f"{context}.tags", input["tags"]) + + if tags is None: + logger.error(f"[{context}]: Skipping invalid scenario: {repr(input)}") + return None + + return {"tags": tags} + + @staticmethod + def _load_tag_list(context: str, input: Any) -> Union[list[str], None]: + if not isinstance(input, list): + logger.error( + f"[{context}]: Skipping invalid tags (must be a list): {repr(input)}" + ) + return None + + tags_and_nones = [ + Config._load_tag(f"{context}.{i}", v) for i, v in enumerate(input) + ] + return [t for t in tags_and_nones if t is not None] + + @staticmethod + def _load_tag(context: str, input: Any) -> Union[str, None]: + if not isinstance(input, str): + logger.error( + f"[{context}]: Skipping invalid tag (must be a string): {repr(input)}" + ) + return None + if not input.startswith("@"): + logger.error( + f'[{context}]: Skipping invalid tag (must start with "@"): {repr(input)}' + ) + logger.error(f"[{context}]: Did you mean {repr('@' + input)}?") + return None + + return input + + def tags_for(self, feature: str, section: str, scenario: str) -> list[str]: + """ + Get a list of tags for a given scenario. + """ + if ( + feature in self.features + and section in self.features[feature] + and scenario in self.features[feature][section] + ): + return self.features[feature][section][scenario]["tags"] + + return [] + + +class Result: + def __init__( + self, + kind: Union[Literal["value"], Literal["eval_error"], Literal["none"]] = "none", + value: "Optional[Union[CELValue, CELErrorSet]]" = None, + ) -> None: + self.kind = kind + self.value = value + + def __eq__(self, other: Any) -> bool: + return isinstance(other, Result) and (self.kind, self.value) == ( + other.kind, + other.value, + ) + + def __repr__(self) -> str: + if isinstance(self.value, CELErrorSet): + # TODO: Investigate if we should switch to a + # data structure in the step implementation + return repr(str(self.value)) + else: + return repr(self.value) + + @staticmethod + def from_proto(source: simple_pb2.SimpleTest) -> "Result": + kind = source.WhichOneof("result_matcher") + + if kind == "value": + return Result(kind, CELValue.from_proto(source.value)) + elif kind == "eval_error": + return Result(kind, CELErrorSet(source.eval_error)) + elif kind is None: + return Result("none", None) + else: + raise NotImplementedError(f"Unable to interpret result kind {kind!r}") + + @staticmethod + def from_text_proto_str(text_proto: str) -> "Result": + test = simple_pb2.SimpleTest() + text_format.Parse(text_proto, test) + return Result.from_proto(test) + + +class CELValue: + type_name = "celpy.celtypes.CELType" + + def __init__(self, source: Optional[message.Message]) -> None: + self.source = source + + @staticmethod + def is_aliased(_: str) -> bool: + return False + + @overload + @staticmethod + def get_class_by_alias( + alias: str, + base: Optional[type["CELValue"]] = None, + error_on_none: Literal[True] = True, + ) -> type["CELValue"]: ... + + @overload + @staticmethod + def get_class_by_alias( + alias: str, + base: Optional[type["CELValue"]] = None, + error_on_none: Literal[False] = False, + ) -> Optional[type["CELValue"]]: ... + + @staticmethod + def get_class_by_alias( + alias: str, base: Optional[type["CELValue"]] = None, error_on_none: bool = True + ) -> Optional[type["CELValue"]]: + base_class = base if base else CELValue + + if base_class.is_aliased(alias): + return base_class + + children = base_class.__subclasses__() + for child in children: + match = CELValue.get_class_by_alias(alias, child, False) + if match is not None: + return match + + if error_on_none: + raise Exception(f"Unable to locate CEL value class for alias {alias!r}") + else: + return None + + @staticmethod + def from_proto(source: message.Message) -> "CELValue": + if source.DESCRIPTOR in [ + struct_pb2.Value.DESCRIPTOR, + value_pb2.Value.DESCRIPTOR, + ]: + value_kind = source.WhichOneof("kind") + if value_kind == "object_value": + return CELValue.from_any(getattr(source, value_kind)) + else: + return CELValue.get_class_by_alias(value_kind)( + getattr(source, value_kind) + ) + + if isinstance(source, any_pb2.Any): + return CELValue.from_any(source) + + aliased = CELValue.get_class_by_alias(source.DESCRIPTOR.full_name, None, False) + if aliased is not None: + return aliased(source) + + logger.error(source) + return CELMessage(source) + + @staticmethod + def from_any(source: any_pb2.Any) -> "CELValue": + type_name = source.type_url.split("/")[-1] + desc = pool.FindMessageTypeByName(type_name) + message_value = message_factory.GetMessageClass(desc)() + source.Unpack(message_value) + return CELValue.from_proto(message_value) + + @staticmethod + def from_text_proto_str(text_proto: str) -> "CELValue": + value = value_pb2.Value() + text_format.Parse(text_proto, value) + return CELValue.from_proto(value) + + +class CELType(CELValue): + type_name = "celpy.celtypes.TypeType" + + def __init__( + self, + value: Union[ + value_pb2.Value, checked_pb2.Decl, checked_pb2.Decl.IdentDecl, str + ], + ) -> None: + if isinstance(value, value_pb2.Value): + self._from_cel_value(value) + super().__init__(value) + elif isinstance(value, checked_pb2.Decl): + self._from_decl(value) + super().__init__(value) + elif isinstance(value, checked_pb2.Decl.IdentDecl): + self._from_ident(value) + super().__init__(value) + elif isinstance(value, str): + self._from_str(value) + super().__init__(None) + else: + if isinstance(value, message.Message): + raise Exception( + f"Unable to interpret type from {value.DESCRIPTOR.full_name} message" + ) + else: + raise Exception(f"Unable to interpret type from {repr(value)}") + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in ["type", "type_value"] + + def _from_cel_value(self, source: value_pb2.Value) -> None: + self._from_str(source.type_value) + + def _from_decl(self, source: checked_pb2.Decl) -> None: + decl_kind = source.WhichOneof("decl_kind") + + if decl_kind == "ident": + self._from_ident(source.ident) + else: + raise NotImplementedError( + f'Unable to interpret declaration kind "{decl_kind}"' + ) + + def _from_ident(self, ident: checked_pb2.Decl.IdentDecl) -> None: + type_kind = ident.type.WhichOneof("type_kind") + if type_kind == "primitive": + primitive_kind = checked_pb2.Type.PrimitiveType.Name(ident.type.primitive) + + self.name = CELValue.get_class_by_alias( + primitive_kind, None, True + ).type_name + elif type_kind == "message_type": + cel_class = CELValue.get_class_by_alias( + ident.type.message_type, None, False + ) + if cel_class: + self.name = cel_class.type_name + else: + self._from_str(ident.type.message_type) + else: + self.name = CELValue.get_class_by_alias(type_kind, None, True).type_name + + def _from_str(self, type_value: str) -> None: + candidate = CELValue.get_class_by_alias(type_value, None, False) + + if candidate: + self.name = candidate.type_name + elif type_value in [ + "cel.expr.conformance.proto2.GlobalEnum", + "cel.expr.conformance.proto2.TestAllTypes.NestedEnum", + "cel.expr.conformance.proto3.GlobalEnum", + "cel.expr.conformance.proto3.TestAllTypes.NestedEnum", + ]: + raise NotImplementedError(f'Type not supported: "{type_value}"') + else: + self.name = "celpy.celtypes.MessageType" + + @staticmethod + def from_text_proto_str(text_proto: str) -> "CELType": + ident = checked_pb2.Decl.IdentDecl() + text_format.Parse(text_proto, ident) + return CELType(ident) + + def __repr__(self) -> str: + return self.name + + def __eq__(self, other: Any) -> bool: + return isinstance(other, CELType) and self.name == other.name + + +class CELExprValue: + def __init__(self, source: eval_pb2.ExprValue) -> None: + self.source = source + expr_value_kind = self.source.WhichOneof("kind") + + if expr_value_kind == "value": + self.value = CELValue.from_proto(self.source.value) + elif expr_value_kind == "error": + self.value = CELErrorSet(self.source.error) + else: + raise Exception( + f'Unable to interpret CEL expression value kind "{expr_value_kind}"' + ) + + def __repr__(self) -> str: + return repr(self.value) + + +class CELPrimitive(CELValue): + def __init__(self, source: Optional[message.Message], value: Any) -> None: + self.value = value + super().__init__(source) + + def __eq__(self, other: Any) -> bool: + return isinstance(other, CELPrimitive) and (self.value == other.value) + + def __hash__(self) -> int: + return hash(self.value) + + def __repr__(self) -> str: + return f"{self.type_name}(source={repr(self.value)})" + + +class CELInt(CELPrimitive): + type_name = "celpy.celtypes.IntType" + + def __init__( + self, source: Union[wrappers_pb2.Int32Value, wrappers_pb2.Int64Value, int] + ) -> None: + if isinstance(source, wrappers_pb2.Int32Value) or isinstance( + source, wrappers_pb2.Int64Value + ): + value = source.value + super().__init__(source, value) + else: + value = source + super().__init__(None, value) + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in [ + "INT64", + "int", + "int64_value", + "google.protobuf.Int32Value", + "google.protobuf.Int64Value", + ] + + +class CELUint(CELPrimitive): + type_name = "celpy.celtypes.UintType" + + def __init__( + self, source: Union[wrappers_pb2.UInt32Value, wrappers_pb2.UInt64Value, int] + ) -> None: + if isinstance(source, wrappers_pb2.UInt32Value) or isinstance( + source, wrappers_pb2.UInt64Value + ): + value = source.value + super().__init__(source, value) + else: + value = source + super().__init__(None, value) + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in [ + "UINT64", + "uint", + "uint64_value", + "google.protobuf.UInt32Value", + "google.protobuf.UInt64Value", + ] + + +class CELDouble(CELPrimitive): + type_name = "celpy.celtypes.DoubleType" + + def __init__( + self, source: Union[wrappers_pb2.FloatValue, wrappers_pb2.DoubleValue, float] + ) -> None: + if isinstance(source, wrappers_pb2.FloatValue) or isinstance( + source, wrappers_pb2.DoubleValue + ): + value = source.value + super().__init__(source, value) + else: + value = source + super().__init__(None, value) + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in [ + "DOUBLE", + "double", + "double_value", + "number_value", + "google.protobuf.FloatValue", + "google.protobuf.DoubleValue", + ] + + def __repr__(self) -> str: + source = repr(self.value) + if source in ["-inf", "inf", "nan"]: + source = f"float({repr(source)})" + return f"{self.type_name}(source={source})" + + +class CELBool(CELPrimitive): + type_name = "celpy.celtypes.BoolType" + + def __init__(self, source: Union[wrappers_pb2.BoolValue, bool]) -> None: + if isinstance(source, wrappers_pb2.BoolValue): + value = source.value + super().__init__(source, value) + else: + value = source + super().__init__(None, value) + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in ["BOOL", "bool", "bool_value", "google.protobuf.BoolValue"] + + +class CELString(CELPrimitive): + type_name = "celpy.celtypes.StringType" + + def __init__(self, source: Union[wrappers_pb2.StringValue, str]) -> None: + if isinstance(source, wrappers_pb2.StringValue): + value = source.value + super().__init__(source, value) + else: + value = source + super().__init__(None, value) + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in [ + "STRING", + "string", + "string_value", + "google.protobuf.StringValue", + ] + + def __str__(self) -> str: + return str(self.value) + + +class CELBytes(CELPrimitive): + type_name = "celpy.celtypes.BytesType" + + def __init__(self, source: Union[wrappers_pb2.BytesValue, bytes]) -> None: + if isinstance(source, wrappers_pb2.BytesValue): + value = source.value + super().__init__(source, value) + else: + value = source + super().__init__(None, value) + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in ["BYTES", "bytes", "bytes_value", "google.protobuf.BytesValue"] + + +class CELEnum(CELPrimitive): + type_name = "celpy.celtypes.Enum" + + def __init__(self, _: Any) -> None: + raise NotImplementedError("Enums not yet supported") + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in ["enum_value"] + + +class CELNull(CELValue): + type_name = "NoneType" + + def __init__(self, source: None = None) -> None: + super().__init__(source) + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in ["null", "null_type", "null_value"] + + def __eq__(self, other: Any) -> bool: + return other is None or isinstance(other, CELNull) + + def __repr__(self) -> str: + return "None" + + +class CELList(CELValue): + type_name = "celpy.celtypes.ListType" + + def __init__( + self, source: Union[struct_pb2.ListValue, value_pb2.ListValue, list[CELValue]] + ) -> None: + if isinstance(source, (struct_pb2.ListValue, value_pb2.ListValue)): + self.values = [CELValue.from_proto(v) for v in source.values] + super().__init__(source) + else: + self.values = source + super().__init__(None) + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in ["list", "list_type", "list_value", "google.protobuf.ListValue"] + + def __eq__(self, other: Any) -> bool: + if not isinstance(other, CELList): + return False + + if len(self.values) != len(other.values): + return False + + for s, o in zip(self.values, other.values): + if s != o: + return False + + return True + + def __repr__(self) -> str: + return f"[{', '.join(repr(v) for v in self.values)}]" + + +class CELMap(CELValue): + type_name = "celpy.celtypes.MapType" + + def __init__( + self, source: Union[struct_pb2.Struct, value_pb2.MapValue, dict[str, CELValue]] + ) -> None: + self.value = {} + if isinstance(source, struct_pb2.Struct): + for k in source.fields: + self.value[k] = CELValue.from_proto(source.fields[k]) + super().__init__(source) + elif isinstance(source, value_pb2.MapValue): + for e in source.entries: + self.value[str(CELValue.from_proto(e.key))] = CELValue.from_proto( + e.value + ) + super().__init__(source) + elif isinstance(source, dict): + self.value = source + super().__init__(None) + else: + raise Exception(f"Cannot use {repr(source)} as map input") + + def __eq__(self, other: Any) -> bool: + return isinstance(other, CELMap) and self.value == other.value + + def __repr__(self) -> str: + return f"{self.type_name}({repr(self.value)})" + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in [ + "map", + "map_type", + "map_value", + "struct_value", + "google.protobuf.Struct", + ] + + +class AnyWrapper(CELValue): + def __init__(self, source: any_pb2.Any) -> None: + self.value = ProtoAny(source) + super().__init__(source) + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in ["object_value"] + + def __repr__(self) -> str: + return repr(self.value) + + +class CELDuration(CELValue): + type_name = "celpy.celtypes.DurationType" + + def __init__( + self, seconds: Union[duration_pb2.Duration, int], nanos: int = 0 + ) -> None: + if isinstance(seconds, message.Message): + self.seconds = seconds.seconds + self.nanos = seconds.nanos + super().__init__(seconds) + else: + self.seconds = seconds + self.nanos = nanos + super().__init__(None) + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in ["google.protobuf.Duration"] + + def __eq__(self, other: Any) -> bool: + return isinstance(other, CELDuration) and (self.seconds, self.nanos) == ( + other.seconds, + other.nanos, + ) + + def __repr__(self) -> str: + return f"{self.type_name}(seconds={self.seconds:.0f}, nanos={self.nanos:.0f})" + + +class CELTimestamp(CELValue): + type_name = "celpy.celtypes.TimestampType" + + def __init__( + self, seconds: Union[timestamp_pb2.Timestamp, int], nanos: int = 0 + ) -> None: + if isinstance(seconds, timestamp_pb2.Timestamp): + self.seconds = seconds.seconds + self.nanos = seconds.nanos + super().__init__(seconds) + else: + self.seconds = seconds + self.nanos = nanos + super().__init__(None) + self.value = datetime.fromtimestamp(self.seconds, tz=timezone.utc) + timedelta( + microseconds=(self.nanos / 1000) + ) + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in ["google.protobuf.Timestamp"] + + def __repr__(self) -> str: + return f"{self.type_name}({repr(self.value)})" + + +class CELStatus(CELValue): + def __init__(self, message: Union[eval_pb2.Status, str], code: int = 0) -> None: + if isinstance(message, eval_pb2.Status): + self.message = message.message + self.code = message.code + super().__init__(message) + else: + self.message = message + self.code = code + super().__init__(None) + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in ["cel.expr.Status"] + + def __eq__(self, other: Any) -> bool: + return isinstance(other, CELStatus) and (self.message, self.code) == ( + other.message, + other.code, + ) + + def __repr__(self) -> str: + return repr(self.message) + + +class CELErrorSet(CELValue): + type_name = "CELEvalError" + + def __init__(self, message: Union[eval_pb2.ErrorSet, list[CELStatus], str]) -> None: + self.errors = [] + if isinstance(message, eval_pb2.ErrorSet): + for status in message.errors: + self.errors.append(CELStatus(status)) + super().__init__(message) + elif isinstance(message, eval_pb2.Status): + self.errors.append(CELStatus(message)) + super().__init__(message) + elif isinstance(message, str): + self.errors.append(CELStatus(message)) + super().__init__(None) + elif isinstance(message, list): + for m in message: + if not isinstance(m, CELStatus): + raise Exception(f"Cannot use {repr(m)} in place of status") + self.errors.append(m) + super().__init__(None) + elif isinstance(message, str): + self.errors.append(CELStatus(message)) + super().__init__(None) + else: + raise Exception(f"Cannot use {repr(message)} as error set input") + + @staticmethod + def is_aliased(alias: str) -> bool: + return alias in ["cel.expr.ErrorSet"] + + @staticmethod + def from_text_proto_str(text_proto: str) -> "CELErrorSet": + errorSet = eval_pb2.ErrorSet() + text_format.Parse(text_proto, errorSet) + return CELErrorSet(errorSet) + + def __eq__(self, other: Any) -> bool: + if not isinstance(other, CELErrorSet): + return False + + if len(self.errors) != len(other.errors): + return False + + for s, o in zip(self.errors, other.errors): + if s != o: + return False + + return True + + def __repr__(self) -> str: + return f"{self.type_name}({', '.join(repr(e) for e in self.errors)})" + + def __str__(self) -> str: + return ", ".join(e.message for e in self.errors) + + +class ProtoAny: + def __init__(self, source: any_pb2.Any) -> None: + self.source = source + type_name = self.source.type_url.split("/")[-1] + desc = pool.FindMessageTypeByName(type_name) + message_value = message_factory.GetMessageClass(desc)() + self.source.Unpack(message_value) + self.value = CELValue.from_proto(message_value) + + def __repr__(self) -> str: + return repr(self.value) + + +class CELMessage(CELValue): + type_name = "celpy.celtypes.MessageType" + + def __init__( + self, source: message.Message, name_override: Optional[str] = None + ) -> None: + self.source = source + name = ( + name_override if name_override is not None else self.source.DESCRIPTOR.name + ) + fieldLiterals = [] + fields = self.source.ListFields() + for desc, value in fields: + if desc.is_repeated: + repeatedValues = [] + for v in value: + if isinstance(v, message.Message): + repeatedValues.append(repr(CELValue.from_proto(v))) + else: + repeatedValues.append(repr(v)) + fieldLiterals.append(f"{desc.name}=[{', '.join(repeatedValues)}]") + elif isinstance(value, message.Message): + fieldLiterals.append(f"{desc.name}={repr(CELValue.from_proto(value))}") + else: + fieldLiterals.append(f"{desc.name}={repr(value)}") + self.literal = f"{name}({', '.join(fieldLiterals)})" + + def __eq__(self, other: Any) -> bool: + return isinstance(other, CELMessage) and self.source == other.source + + def __repr__(self) -> str: + return self.literal + + +class Scenario: + def __init__( + self, + config: Config, + feature: "Feature", + section: "Section", + source: simple_pb2.SimpleTest, + ) -> None: + logger.debug(f"Scenario {source.name}") + self.name = source.name + self.description = source.description + self.tags = config.tags_for(feature.name, section.name, source.name) + self.preconditions: list[str] = [] + self.events: list[str] = [] + self.outcomes: list[str] = [] + + if source.disable_macros: + self.given("disable_macros parameter is True") + if source.disable_check: + self.given("disable_check parameter is True") + for type_env in source.type_env: + self.given(f'type_env parameter "{type_env.name}" is {CELType(type_env)}') + for key in source.bindings.keys(): + self.given( + f'bindings parameter "{key}" is {CELExprValue(source.bindings[key])}' + ) + if source.container: + self.given(f"container is {source.container!r}") + + self.when(f"CEL expression {source.expr!r} is evaluated") + + result = Result.from_proto(source) + self.then(f"{result.kind} is {result}") + + def given(self, precondition: str) -> Self: + self.preconditions.append(precondition) + return self + + def when(self, event: str) -> Self: + self.events.append(event) + return self + + def then(self, event: str) -> Self: + self.outcomes.append(event) + return self + + @property + def steps(self) -> list[str]: + steps = [] + if len(self.preconditions) > 0: + steps.append(f"Given {self.preconditions[0]}") + steps.extend([f"and {p}" for p in self.preconditions[1:]]) + if len(self.events) > 0: + steps.append(f"When {self.events[0]}") + steps.extend([f"and {e}" for e in self.events[1:]]) + if len(self.outcomes) > 0: + steps.append(f"Then {self.outcomes[0]}") + steps.extend([f"and {o}" for o in self.outcomes[1:]]) + + return steps + + +class Section: + def __init__( + self, config: Config, feature: "Feature", source: simple_pb2.SimpleTestSection + ) -> None: + logger.debug(f"Section {source.name}") + self.name = source.name + self.description = source.description + self.scenarios = [] + for test in source.test: + try: + self.scenarios.append(Scenario(config, feature, self, test)) + except NotImplementedError as e: + logger.warning(f"Skipping scenario {test.name} because: {e}") + + +class Feature: + def __init__(self, config: Config, source: simple_pb2.SimpleTestFile): + self.name = source.name + self.description = source.description + self.sections = [Section(config, self, s) for s in source.section] + + @staticmethod + def from_text_proto(config: Config, path: Path) -> "Feature": + logger.debug(f"Reading from {path}...") + with open(path, encoding="utf_8") as file_handle: + text = ( + file_handle.read() + .replace("google.api.expr.test.v1.", "cel.expr.conformance.") + .replace("protubuf", "protobuf") + ) + file = simple_pb2.SimpleTestFile() + logger.debug(f"Parsing {path}...") + text_format.Parse(text, file) + return Feature(config, file) + + def write_to_file(self, path: Optional[Path]) -> None: + logger.debug("Rendering to gherkin...") + gherkin = template.render(feature=self) + + if path: + logger.debug(f"Writing to {path}...") + with open(path, "w", encoding="utf_8") as file_handle: + file_handle.write(gherkin) + else: + print(gherkin) + + +def get_options(argv: list[str] = sys.argv[1:]) -> argparse.Namespace: + parser = argparse.ArgumentParser() + parser.add_argument( + "-v", + "--verbose", + dest="log_level", + action="store_const", + const=logging.DEBUG, + default=logging.INFO, + ) + parser.add_argument( + "-s", "--silent", dest="log_level", action="store_const", const=logging.ERROR + ) + parser.add_argument( + "-o", + "--output", + action="store", + type=Path, + default=None, + help="output file (default is stdout)", + ) + parser.add_argument( + "source", + action="store", + nargs="?", + type=Path, + help=".textproto file to convert", + ) + options = parser.parse_args(argv) + return options + + +if __name__ == "__main__": + options = get_options() + logging.basicConfig(level=logging.INFO) + logging.getLogger().setLevel(options.log_level) + + config = Config(f"{path.dirname(__file__)}/wip.toml") + feature = Feature.from_text_proto(config, options.source) + feature.write_to_file(options.output) + + +class NotImplementedError(Exception): + pass diff --git a/tools/go.mod b/tools/go.mod deleted file mode 100644 index 430a369..0000000 --- a/tools/go.mod +++ /dev/null @@ -1,8 +0,0 @@ -module mkgherkin - -go 1.16 - -require ( - github.com/google/cel-spec v0.5.0 - google.golang.org/protobuf v1.33.0 -) diff --git a/tools/go.sum b/tools/go.sum deleted file mode 100644 index 40f6cd2..0000000 --- a/tools/go.sum +++ /dev/null @@ -1,86 +0,0 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/google/cel-spec v0.5.0 h1:hWEzw+1L1UNxfHAbKXYbirsPGlG8ArXNcTnBKvBqRJ0= -github.com/google/cel-spec v0.5.0/go.mod h1:Nwjgxy5CbjlPrtCWjeDjUyKMl8w41YBYGjsyDdqk0xA= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20201102152239-715cce707fb0 h1:d0rYPqjQfVuFe+tZgv4PHt2hNxK79MRXX7PaD/A5ynA= -google.golang.org/genproto v0.0.0-20201102152239-715cce707fb0/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/tools/mkgherkin.go b/tools/mkgherkin.go deleted file mode 100644 index 4765021..0000000 --- a/tools/mkgherkin.go +++ /dev/null @@ -1,147 +0,0 @@ -// SPDX-Copyright: Copyright (c) Capital One Services, LLC -// SPDX-License-Identifier: Apache-2.0 -// Copyright 2020 Capital One Services, LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and limitations under the License. - -package main - -/* - Converts Textproto (or protobuf) SimpleTest documents into Gherkin. - - See go doc github.com/google/cel-spec/proto/test/v1/testpb SimpleTest - - The template emits a Gherkin-formatted Feature with a number of Scenarios. -*/ - -import ( - "flag" - "fmt" - "io/ioutil" - "os" - "text/template" - "encoding/json" - - "google.golang.org/protobuf/encoding/protojson" - "google.golang.org/protobuf/encoding/prototext" - - spb "github.com/google/cel-spec/proto/test/v1/testpb" - - // The following are needed to link in these proto libraries - // which are needed dynamically, despite not being explicitly - // used in the Go source. - _ "github.com/google/cel-spec/proto/test/v1/proto2/test_all_types" - _ "github.com/google/cel-spec/proto/test/v1/proto3/test_all_types" -) - -func parseSimpleFile(filename string) (*spb.SimpleTestFile, error) { - bytes, err := ioutil.ReadFile(filename) - if err != nil { - return nil, err - } - var pb spb.SimpleTestFile - err = prototext.Unmarshal(bytes, &pb) - if err != nil { - return nil, err - } - return &pb, nil -} - -var json_formatter = protojson.MarshalOptions{ - Multiline: true, - UseProtoNames: false, - EmitUnpopulated: false, -} - -func json_testfile(testFile *spb.SimpleTestFile) { - fmt.Println(json_formatter.Format(testFile)) -} - -func gherkin_testfile(testFile *spb.SimpleTestFile) { - // There are several kinds of "results" for a test. - // *SimpleTest_Value -- these become a `Then value is ...` step. - // *SimpleTest_EvalError -- these become a `Then eval_error is ...` step. - // *SimpleTest_AnyEvalErrors -- these become a `Then eval_error is ...` step. - // *SimpleTest_Unknown -- These don't seem to be used - // *SimpleTest_AnyUnknowns -- These don't seem to be used - - const test_template = ` -Feature: {{.Name}} - {{.Description}} -{{range .Section}} -# {{.Name}} -- {{.Description}} -{{range .Test}} -Scenario: {{.Name}} - {{.Description}} - -{{- if .DisableMacros}} - Given disable_macros parameter is {{.DisableMacros}} -{{end}} -{{- if .DisableMacros}} - Given disable_check parameter is {{.DisableCheck}} -{{end}} -{{- if .TypeEnv}} -{{- range $index, $env := .TypeEnv}} - Given type_env parameter {{printf "%q" $env.Name}} is {{printf "%v" $env.GetDeclKind}} -{{end -}} -{{end}} -{{- if .Bindings}} -{{- range $key, $value := .Bindings}} - Given bindings parameter {{printf "%q" $key}} is {{printf "%v" $value.GetValue}} -{{end -}} -{{end}} -{{- if .Container}} - Given container is {{printf "%q" .Container}} -{{end}} - When CEL expression {{printf "%q" .Expr}} is evaluated -{{if .GetValue}} Then value is {{printf "%v" .GetValue}}{{end -}} -{{if .GetEvalError}} Then eval_error is {{printf "%v" .GetEvalError}}{{end -}} - - {{- /* Then JSON value is {{json .ResultMatcher | printf "%s" */}} - -{{end}} -{{end}} -` - func_map := template.FuncMap{ - "json": json.Marshal, - } - gherkin_template := template.Must(template.New("gherkin").Funcs(func_map).Parse(test_template)) - err := gherkin_template.Execute(os.Stdout, testFile) - if err != nil { - panic(err) - } -} - -var json_format bool -var gherkin_format bool - -func init() { - flag.BoolVar(&json_format, "json", false, "JSON-format output") - flag.BoolVar(&gherkin_format, "gherkin", true, "Gherkin-format output") -} - -func main() { - flag.Parse() - for _, input_file := range flag.Args() { - fmt.Fprintf(os.Stderr, "Reading %v\n", input_file) - pb, err := parseSimpleFile(input_file) - if err != nil { - panic(err) - } - if gherkin_format { - gherkin_testfile(pb) - } - if json_format { - json_testfile(pb) - } - } -} diff --git a/tools/pb2g.py b/tools/pb2g.py deleted file mode 100644 index 4c72660..0000000 --- a/tools/pb2g.py +++ /dev/null @@ -1,1120 +0,0 @@ -# SPDX-Copyright: Copyright (c) Capital One Services, LLC -# SPDX-License-Identifier: Apache-2.0 -# Copyright 2020 Capital One Services, LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and limitations under the License. - -""" -Protobuf to Gherkin conversion - -The objective here is to interpret the Go representation for an object written by Go -and create a CEL version of that object. - -The domain -========== - -These object values are in two places in the Gherkin code: - -- Given steps with a binding - -- Then steps with an expected value - - -Parsing the Go code -=================== - -The syntax appears to be trivial. -We can create a parser that can parse the code using a simple grammar. - -There are a few tokens, and one syntax rule. - -From an earlier parser using ``lark``, these seem to be the low-level tokens. - -:: - - value : INT | FLOAT | STRING | NULL | BOOL | TYPE - - NAME : /\\w+/ - - INT : /[+-]?\\d+/ - - FLOAT : /[+-]?\\d+\\.\\d*([eE][+-]?\\d+)?/ | /[+-]?\\d+[eE][+-]?\\d+/ | "Infinity" | "inf" | "-inf" - - STRING : /"[^"\\n\\\\]*((\\\\.)+[^"\\n\\\\]*)*("|\\\\?$)/ | /'[^'\\n\\\\]*((\\\\.)+[^'\\n\\\\]*)*('|\\\\?$)/ - - NULL : "NULL_VALUE" - - BOOL : "true" | "false" - - TYPE : "INT64" | "BOOL" | "BYTES" | "DOUBLE" | "STRING" | "NULL_VALUE" | "UINT64" - -Syntax -====== - -The two data structures of interest are - -- the primitive ``name : literal`` production, and - -- the non-primitive ``name : { structure* }`` production. - -The LALR(1) parser for this grammar uses the ``{}``'s to identify complex vs. primitive constructs. - -Building the CEL objects -======================== - -We have mocks for the various CEL types. (This is not necessary, but it seems simpler to -provide trivial stubs.) - -There's a set of functions that reconstruct objects from the Go source. - -The ``primitive_types`` are Go types that are visible as external names. -The "value" is a wrapper around a value that has to be converted separately; -usually these are fields of a Message and the Message handles the conversion. - -Top-level Application -===================== - -The application works in two stages: - -1. Run Go to do the initial conversion, creating an intermediate text representation. - -2. Rewrite THEN and GIVEN Type Binding clauses into proper CEL-Friendly types. - -Looking for the following kinds of lines created by the initial Go conversion. - -- ``r'\\s*Given bindings parameter "(.*?)" is\\s+(.*)'`` -- ``r'\\s*Given type_env parameter "(.*?)" is\\s+(.*)'`` -- ``r'\\s*When expression "(.*)" is evaluated'`` -- ``r"\\s*Then value is\\s+&\\{(.*)\\}"`` - -Each of these requires revising the literal value into a Python-friendly form. - -""" -import abc -import argparse -import contextlib -from dataclasses import dataclass, field -from functools import partial -import inspect -import logging -import math -import os -from pathlib import Path -import re -import subprocess -import sys -import traceback -from typing import ( - Any, Dict, Iterable, Iterator, List, Match, NamedTuple, - Optional, Set, Tuple, Type, Union) - -logger = logging.getLogger("pb2g") - -class Token(NamedTuple): - """Follows lark design patterns: token type and source string value.""" - type: str - value: str - -class Tokens(Iterator[Token]): - """ - The sequence of tokens for this protobuf object value. - This class defines an Iterator with backup capability so we can look ahead one token. - - >>> t = Tokens('example: {[type_name] b1: true b2: false n1: NULL_VALUE s1: "string" f1: 3.14 f2: 6E23 i1: 42}') - >>> tokens = list(t) - >>> tokens - [Token(type='NAME', value='example'), Token(type='PUNCTUATION', value=':'), Token(type='PUNCTUATION', value='{'), Token(type='NAMESPACE', value='[type_name]'), Token(type='NAME', value='b1'), Token(type='PUNCTUATION', value=':'), Token(type='BOOL', value='true'), Token(type='NAME', value='b2'), Token(type='PUNCTUATION', value=':'), Token(type='BOOL', value='false'), Token(type='NAME', value='n1'), Token(type='PUNCTUATION', value=':'), Token(type='NULL', value='NULL_VALUE'), Token(type='NAME', value='s1'), Token(type='PUNCTUATION', value=':'), Token(type='STRING', value='"string"'), Token(type='NAME', value='f1'), Token(type='PUNCTUATION', value=':'), Token(type='FLOAT', value='3.14'), Token(type='NAME', value='f2'), Token(type='PUNCTUATION', value=':'), Token(type='FLOAT', value='6E23'), Token(type='NAME', value='i1'), Token(type='PUNCTUATION', value=':'), Token(type='INT', value='42'), Token(type='PUNCTUATION', value='}')] - - >>> tokens[0].type - 'NAME' - >>> tokens[0].value - 'example' - """ - token_pat = re.compile( - r'(?P\[[\w/\.]+\])' - r'|(?Ptrue|false)' - r'|(?PNULL_VALUE)' - r'|(?P"[^"]*?(?:(?:\\.)+[^"]*?)*"|\'[^\']*?(?:(?:\\.)+[^\']*?)*\')' - r'|(?P[+-]?\d*\.\d*[Ee]?[+-]?\d*|inf|-inf|[+-]?\d+[Ee][+-]?\d+)' - r'|(?P[+-]?\d+)' - r'|(?P[a-zA-Z]\w+)' - r'|(?P\s+)' - r'|(?P.)' - ) - - @staticmethod - def token_factory(match_iter: Iterable[Match]) -> Iterator[Token]: - for match in match_iter: - for token_type, value in match.groupdict().items(): - if value and token_type != "WHITESPACE": - yield Token(token_type, value) - - def __init__(self, text) -> None: - self.text = text - matches = self.token_pat.finditer(text) - self.tokens = list(Tokens.token_factory(matches)) - self.next = 0 - def __iter__(self) -> Iterator[Token]: - return self - def __next__(self) -> Token: - if self.next == len(self.tokens): - raise StopIteration - t = self.tokens[self.next] - self.next += 1 - return t - def back(self) -> None: - self.next -= 1 - -def back(tokens) -> None: - tokens.back() - - -def detokenize(token: Token) -> Any: - """ - Rewrite source Protobuf value tokens into Python native objects. - - :: - - value : INT | FLOAT | STRING | NULL | BOOL | TYPE - - NULL : "NULL_VALUE" - BOOL : "true" | "false" - STRING : /"[^"\\n\\]*((\\.)+[^"\\n\\]*)*("|\\?$)/ | /'[^'\\n\\]*((\\.)+[^'\\n\\]*)*('|\\?$)/ - INT : /[+-]?\\d+/ - FLOAT : /[+-]?\\d+\\.\\d*([eE][+-]?\\d+)?/ | /[+-]?\\d+[eE][+-]?\\d+/ | "Infinity" | "inf" | "-inf" - - Implementation Cases: - - - ``INT`` and ``FLOAT`` are trivial because the syntax overlaps with Python. - - - ``TYPE`` is a string representation of a keyword, and also trivial. - - - ``NULL`` becomes Python ``None`` - - - ``BOOL`` becomes Python ``True`` or ``False`` - - - ``STRING`` requires some care to adjust the escapes from Protobuf to Python. - The token includes the surrounding quotes, which we have to remove. - Escapes include ``\\a`` ``\\b`` ``\\f`` ``\\n`` ``\\r`` ``\\t`` ``\\v`` - ``\\"`` ``\\\\'`` ``\\\\\\\\``. - As well as ``\\\\x[0-9a-f]{2}`` and ``\\\\\\d{3}`` for hex and octal escapes. - We build a Python string and trust to the serializer to produce a workable output. - - Tests. - - >>> detokenize(Token("INT", "42")) - 42 - >>> detokenize(Token("FLOAT", "2.71828")) - 2.71828 - >>> detokenize(Token("TYPE", "float")) - 'float' - >>> detokenize(Token("NULL", "NULL_VALUE")) - >>> detokenize(Token("BOOL", "true")) - True - >>> detokenize(Token("BOOL", "false")) - False - >>> detokenize(Token("STRING", '"this has \\"quote\\""')) - 'this has "quote"' - >>> detokenize(Token("STRING", "'this has \\'apostrophe\\''")) - "this has 'apostrophe'" - >>> detokenize(Token("STRING", 'escape a and b \\a\\b, \\x48 and \\110.')) - 'escape a and b \\x07\\x08, H and H.' - >>> detokenize(Token("STRING", '"flambé"')) - 'flambé' - - From the Source value "\\x07\\x08\\x0c\\n\\r\\t\\x0b\\"'\\\\" - - >>> detokenize(Token("STRING", '"\\x07\\x08\\x0c\\n\\r\\t\\x0b\\"\\'\\\\"')) - '\\x07\\x08\\x0c\\r\\t\\x0b"\\'\\\\' - """ - if token.type == "STRING": - # Default case; a few cases need bytes_detokenize. - return str_detokenize(token) - elif token.type == "BOOL": - return token.value.lower() == "true" - elif token.type == "NULL": - return None - elif token.type == "INT": - return int(token.value) - elif token.type == "FLOAT": - return float(token.value) - else: - return token.value - - -STR_ESCAPES = re.compile(r'\\"|\\\'|\\[abfnrtv\\]|\\\d{3}|\\x[0-9a-f]{2}|.') - - -def expand_str_escape(match: str) -> str: - """ - Expand one escape sequence or character. - - >>> text = "{\\"k1\\":\\"v1\\",\\"k\\":\\"v\\"}" - >>> match_iter = STR_ESCAPES.finditer(text) - >>> expanded = ''.join(expand_str_escape(m.group()) for m in match_iter) - >>> expanded - '{"k1":"v1","k":"v"}' - - """ - if match in {"\\a", "\\b", "\\f", "\\n", "\\r", "\\t", "\\v", "\\\\", '\\"', "\\'"}: - return { - "a": "\a", "b": "\b", "f": "\f", "n": "\n", - "r": "\r", "t": "\t", "v": "\v", - }.get(match[1], match[1]) - elif match[:2] == "\\x": - return chr(int(match[2:], 16)) - elif match[:1] == "\\" and len(match) > 1: - return chr(int(match[1:], 8)) - # TODO: \uxxxx and \Uxxxxxxxx - else: - # Non-escaped character. - return match - -def str_detokenize(token: Token) -> str: - """ - Rewrite source Protobuf value tokens into Python native str object. - - See https://golang.org/ref/spec#String_literals - - >>> detokenize(Token("STRING", '"this has \\"quote\\""')) - 'this has "quote"' - >>> detokenize(Token("STRING", "'this has \\'apostrophe\\''")) - "this has 'apostrophe'" - >>> detokenize(Token("STRING", 'escape a and b \\a\\b, \\x48 and \\110.')) - 'escape a and b \\x07\\x08, H and H.' - >>> detokenize(Token("STRING", '"flambé"')) - 'flambé' - """ - - if token.type == "STRING": - # Dequote the value, then expand escapes. - if token.value.startswith('"') and token.value.endswith('"'): - text = token.value[1:-1] - elif token.value.startswith("'") and token.value.endswith("'"): - text = token.value[1:-1] - else: - text = token.value - match_iter = STR_ESCAPES.finditer(text) - expanded = ''.join(expand_str_escape(m.group()) for m in match_iter) - return expanded - else: - raise ValueError(f"Unexpected token {token!r}") - -def bytes_detokenize(token: Token) -> bytes: - """ - Rewrite source Protobuf value tokens into Python native bytes object. - - >>> bytes_detokenize(Token("STRING", '"\\110\\x48H"')) - b'HHH' - """ - def expand_bytes_escape(matches: Iterable[Match]) -> Iterator[int]: - for text in (m.group() for m in matches): - if text[:2] == '\\x': - yield int(text[2:], 16) - elif text[:1] == '\\': - yield int(text[1:], 8) - else: - yield from text.encode('utf-8') - - if token.type == "STRING": - escapes = re.compile(r"\\\d\d\d|\\x..|.") - match_iter = escapes.finditer(token.value[1:-1]) - expanded = bytes(expand_bytes_escape(match_iter)) - return expanded - else: - raise ValueError(f"Unexpected token {token!r}") - - -class Primitive(NamedTuple): - """A name: value pair.""" - type_name: Token - value_text: Token - - @property - def type_names(self) -> Set[str]: - """Transitive closure of all contained types.""" - return set([self.type_name.value]) - - @property - def all_items(self) -> Set["Primitive"]: - return set([self]) - - @property - def value(self) -> Any: - """Undo the Go escapes to create a Python string""" - return detokenize(self.value_text) - - @property - def to_str(self) -> str: - """Undo the Go escapes to create a Python string""" - return str_detokenize(self.value_text) - - @property - def to_bytes(self) -> bytes: - """Undo the Go escapes to create a Python bytes""" - return bytes_detokenize(self.value_text) - - @property - def is_bytes(self) -> bool: - return self.type_name in {"bytes_value"} - - @property - def is_string(self) -> bool: - return not self.is_bytes - - -class Structure(NamedTuple): - """A name: {value*} pair.""" - type_name: Token - items: Tuple[Any] # Union["Primitive", "Structure"] - - @property - def type_names(self) -> Set[str]: - """Transitive closure of all contained types.""" - return set([self.type_name.value]).union(*(i.type_names for i in self.items)) - - @property - def all_items(self) -> Set["Structure"]: # Set[Union["Primitive", "Structure"]] - return set(self.items).union(*(i.all_items for i in self.items)) - -ParseTree = Union[Primitive, Structure] - -def parse_serialized_value(tokens: Tokens) -> ParseTree: - """ - Parse the following construct: - - :: - - structure : type ":" [ primitive | "{" structure* "}" ] - - Returns a a union [Primitive | Structure] - - TODO: RENAME THIS - - For example - >>> t = Tokens('example: {[namespace]:{b1: true i1: 42}}') - >>> parse_serialized_value(t) - Structure(type_name=Token(type='NAME', value='example'), items=(Structure(type_name=Token(type='NAMESPACE', value='[namespace]'), items=(Primitive(type_name=Token(type='NAME', value='b1'), value_text=Token(type='BOOL', value='true')), Primitive(type_name=Token(type='NAME', value='i1'), value_text=Token(type='INT', value='42')))),)) - """ - name = next(tokens) - colon = next(tokens) - lookahead = next(tokens) - if lookahead.type == "PUNCTUATION" and lookahead.value == "{": - items = [] - lookahead = next(tokens) - while not (lookahead.type == "PUNCTUATION" and lookahead.value == "}"): - back(tokens) - items.append(parse_serialized_value(tokens)) - lookahead = next(tokens) - return Structure(name, tuple(items)) - else: - value = lookahead - return Primitive(name, value) - -# Mocks that -- when serialized -- look like CEL types. -# We could use `from celpy.celtypes import *`. -# This approach divorces us from cel-python. - -class TypeType(NamedTuple): - """ABC of CEL Type Hierarchy.""" - source: Union[Any, None] = None - seconds: Union[float, None] = None - nanos: Union[float, None] = None - - @classmethod - def cel_name(cls) -> str: - return f"celpy.celtypes.{cls.__name__}" - - def __repr__(self) -> str: - if self.source is None: - return f"{self.cel_name()}()" - else: - return f"{self.cel_name()}(source={self.source!a})" - -class NoneType(TypeType): - @classmethod - def cel_name(cls) -> str: - return f"NoneType" - -class PrimitiveType(TypeType): - def __repr__(self) -> str: - return f"{self.cel_name()}(source={self.source!a})" - -class UintType(PrimitiveType): pass -class StringType(PrimitiveType): pass -class NullType(PrimitiveType): pass -class IntType(PrimitiveType): pass -class BoolType(PrimitiveType): pass - -class BytesType(PrimitiveType): - source: bytes - -class DoubleType(PrimitiveType): - def __repr__(self) -> str: - if math.isinf(self.source): - return f"{self.cel_name()}(source='{self.source}')" - else: - return f"{self.cel_name()}(source={self.source})" - -class DurationType(TypeType): - seconds: float - nanos: float - - def __repr__(self) -> str: - return f"{self.cel_name()}(seconds={self.seconds:.0f}, nanos={self.nanos:.0f})" - -class TimestampType(PrimitiveType): - pass - -class ListType(List[Any]): - """Built from Values objects.""" - @classmethod - def cel_name(cls) -> str: - return f"celpy.celtypes.{cls.__name__}" - -class MapType(Dict[str, Any]): - """Built from Entries objects.""" - @classmethod - def cel_name(cls) -> str: - return f"celpy.celtypes.{cls.__name__}" - - def __repr__(self) -> str: - return f"{self.__class__.__name__}({super().__repr__()})" - -class MessageType(Dict[str, Any]): - """Built from Fields objects.""" - @classmethod - def cel_name(cls) -> str: - return f"celpy.celtypes.{cls.__name__}" - -class CELEvalError(Exception): - def __init__(self, *args: Any) -> None: - super().__init__(*args) - - -# From Protobuf definitions, these are the CEL types implement them. -TYPE_NAMES = { - "google.protobuf.Any": MessageType, - "google.protubuf.Any": MessageType, # Note spelling anomaly. - "google.protobuf.BoolValue": BoolType, - "google.protobuf.BytesValue": BytesType, - "google.protobuf.DoubleValue": DoubleType, - "google.protobuf.Duration": DurationType, - "google.protobuf.FloatValue": DoubleType, - "google.protobuf.Int32Value": IntType, - "google.protobuf.Int64Value": IntType, - "google.protobuf.ListValue": ListType, - "google.protobuf.StringValue": StringType, - "google.protobuf.Struct": MessageType, - "google.protobuf.Timestamp": TimestampType, - "google.protobuf.UInt32Value": UintType, - "google.protobuf.UInt64Value": UintType, - "google.protobuf.Value": MessageType, - "type": TypeType, - "list_type": ListType, - "map_type": MapType, - "map": MapType, - "list": ListType, - "string": StringType, - "bytes": BytesType, - "bool": BoolType, - "int": IntType, - "uint": UintType, - "double": DoubleType, - "null_type": NoneType, - "STRING": StringType, - "BOOL": BoolType, - "INT64": IntType, - "UINT64": UintType, - "INT32": IntType, - "UINT32": UintType, - "BYTES": BytesType, - "DOUBLE": DoubleType, -} - -def type_value(value: str) -> type: - return TYPE_NAMES[value] - -# CEL testing types. This is part of the unit test framework. - -@dataclass -class TestAllTypes: - """ - These fields handle their own conversion from a string. - The presence of default values seems to be the way protobuf works. - """ - single_int32: int = field(default=0) # int32 single_int32 = 1; - single_int64: int = field(default=0) # int64 single_int64 = 2; - single_uint32: int = field(default=0) # uint32 single_uint32 = 3; - single_uint64: int = field(default=0) # uint64 single_uint64 = 4; - single_sint32: int = field(default=0) # sint32 single_sint32 = 5; - single_sint64: int = field(default=0) # sint64 single_sint64 = 6; - single_fixed32: int = field(default=0) # fixed32 single_fixed32 = 7; - single_fixed64: int = field(default=0) # fixed64 single_fixed64 = 8; - single_sfixed32: int = field(default=0) # sfixed32 single_sfixed32 = 9; - single_sfixed64: int = field(default=0) # sfixed64 single_sfixed64 = 10; - single_float: float = field(default=0) # float single_float = 11; - single_double: float = field(default=0) # double single_double = 12; - single_bool: bool = field(default=0) # bool single_bool = 13; - single_string: str = field(default="") # string single_string = 14; - single_bytes: bytes = field(default=b"") # bytes single_bytes = 15; - - single_any: Any = field(default=None) # google.protobuf.Any single_any = 100; - single_duration: DurationType = field(default=None) # google.protobuf.Duration single_duration = 101; - single_timestamp: TimestampType = field(default=None) # google.protobuf.Timestamp single_timestamp = 102; - single_struct: MessageType = field(default_factory=MapType) # google.protobuf.Struct single_struct = 103; - single_value: Any = field(default=None) # google.protobuf.Value single_value = 104; - single_int64_wrapper: IntType = field(default=IntType(0)) # google.protobuf.Int64Value single_int64_wrapper = 105; - single_int32_wrapper: IntType = field(default=IntType(0)) # google.protobuf.Int32Value single_int32_wrapper = 106; - single_double_wrapper: DoubleType = field(default=DoubleType(0)) # google.protobuf.DoubleValue single_double_wrapper = 107; - single_float_wrapper: DoubleType = field(default=DoubleType(0)) # google.protobuf.FloatValue single_float_wrapper = 108; - single_uint64_wrapper: UintType = field(default=UintType(0)) # google.protobuf.UInt64Value single_uint64_wrapper = 109; - single_uint32_wrapper: UintType = field(default=UintType(0)) # google.protobuf.UInt32Value single_uint32_wrapper = 110; - single_string_wrapper: StringType = field(default=StringType("")) # google.protobuf.StringValue single_string_wrapper = 111; - single_bool_wrapper: BoolType = field(default=BoolType(False)) # google.protobuf.BoolValue single_bool_wrapper = 112; - single_bytes_wrapper: BytesType = field(default=BytesType(b"")) # google.protobuf.BytesValue single_bytes_wrapper = 113; - list_value: ListType = field(default_factory=ListType) # google.protobuf.ListValue list_value = 114; - -class NestedMessage: - def __repr__(self): - return f"NestedMessage()" - - -def debug_call_stack() -> None: - """Expose the call stack in the log, this can help debug builders with unexpected state.""" - for context_frame_line in traceback.format_stack(): - if 'site-packages' in context_frame_line: - # Skip standard library and installed packages - continue - elif 'debug_call_stack' in context_frame_line: - # Skip this function. - continue - logger.debug(f" {context_frame_line.rstrip()}") - - -# Each of these transforms a given ``Primitive`` into a CEL object. -primitive_types = { - 'bool_value': lambda p: BoolType(detokenize(p.value_text)), - 'bytes_value': lambda p: BytesType(bytes_detokenize(p.value_text)), - 'double_value': lambda p: DoubleType(detokenize(p.value_text)), - 'int64_value': lambda p: IntType(detokenize(p.value_text)), - 'null_value': lambda p: None, - 'string_value': lambda p: StringType(detokenize(p.value_text)), - 'type_value': lambda p: type_value(detokenize(p.value_text)), # TypeType(detokenize(p.value_text)), - 'uint64_value': lambda p: UintType(detokenize(p.value_text)), - 'number_value': lambda p: DoubleType(detokenize(p.value_text)), - 'value': lambda p: detokenize(p.value_text), -} - -def map_builder(*items: ParseTree) -> TypeType: - """Builds MapType objects from the ``entries`` clauses.""" - logger.debug(f" map_builder({items!r})") - entries = {} - for entry in items: - assert isinstance(entry, Structure) and entry.type_name.value == "entries", f"Unexpected {entry!r}" - k, v = entry.items - key = structure_builder(k.items[0]) - value = structure_builder(v.items[0]) - entries[key] = value - return MapType(entries) - -def list_builder(*items: ParseTree) -> TypeType: - """Builds ListType objects from the ``values`` clauses.""" - logger.debug(f" list_builder({items!r})") - values = [] - for value_source in items: - assert isinstance(value_source, Structure) and value_source.type_name.value == "values", f"Unexpected {value_source!r}" - item = value_source.items[0] - value = structure_builder(item) - values.append(value) - return ListType(values) - -def struct_builder(*items: ParseTree) -> TypeType: - """ - Builds MessageType objects from the ``fields`` clauses. - The ``Any`` special case is taken as a type cast and ignored. - - :: - - object_value:{ - [type.googleapis.com/google.protobuf.Any]:{ - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{ - single_int32:150 - } - } - } - - Which is a ``TestAllTypes(single_int32="150")`` for our purposes. - """ - logger.debug(f" struct_builder({items!r})") - fields = {} - for field_source in items: - assert isinstance(field_source, Structure) and field_source.type_name.value == "fields", f"Unexpected {field_source!r}" - k, v = field_source.items - key = structure_builder(k) # type_name is "key" - value = structure_builder(v) # type_name is "value" - fields[key] = value - return MessageType(fields) - -def duration_builder(*items: ParseTree) -> TypeType: - """Building duration from ``seconds`` and ``nanos`` - :: - - value:{object_value:{[type.googleapis.com/google.protobuf.Duration]:{seconds:123 nanos:123456789}}} - - """ - fields = {} - for field_source in items: - value = structure_builder(field_source) - fields[field_source.type_name.value] = value - return DurationType(**fields) - -def timestamp_builder(*items: ParseTree) -> TypeType: - """Building timestamp from ``seconds`` - :: - - object_value:{ - [type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_timestamp:{seconds:1234567890}} - } - """ - fields = {} - for field_source in items: - value = structure_builder(field_source) - fields[field_source.type_name.value] = value - return TimestampType(**fields) - -def primitive_builder(celtype: Type[TypeType], *items: ParseTree) -> TypeType: - """Building from some primitive, usually a ``value``. - """ - # debug_call_stack() # Useful for debugging. - assert len(items) == 1, f"Unexpected: more than 1 item in {items!r}" - item = items[0] - return celtype(detokenize(item.value_text)) - -def any_builder(*items: ParseTree) -> TypeType: - """ - Clandestine object_value can be hidden inside an Any object. - - :: - - value:{ - object_value:{ - [type.googleapis.com/google.protobuf.Any]:{ - [type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int32:150} - } - } - } - """ - assert len(items) == 1 - item = items[0] - return structure_builder(item) - -well_known_types = { - # Primitive - '[type.googleapis.com/google.protobuf.Any]': any_builder, - '[type.googleapis.com/google.protobuf.BoolValue]': partial(primitive_builder, BoolType), - '[type.googleapis.com/google.protobuf.BytesValue]': partial(primitive_builder, BytesType), - '[type.googleapis.com/google.protobuf.DoubleValue]': partial(primitive_builder, DoubleType), - '[type.googleapis.com/google.protobuf.FloatValue]': partial(primitive_builder, DoubleType), - '[type.googleapis.com/google.protobuf.Int32Value]': partial(primitive_builder, IntType), - '[type.googleapis.com/google.protobuf.Int64Value]': partial(primitive_builder, IntType), - '[type.googleapis.com/google.protobuf.StringValue]': partial(primitive_builder, StringType), - '[type.googleapis.com/google.protobuf.UInt32Value]': partial(primitive_builder, UintType), - '[type.googleapis.com/google.protobuf.UInt64Value]': partial(primitive_builder, UintType), - # Structured -- These have sub-structures that repeat -- `values` or `fields` - '[type.googleapis.com/google.protobuf.ListValue]': list_builder, # values:{} inside - '[type.googleapis.com/google.protobuf.Struct]': struct_builder, # fields:{} inside - '[type.googleapis.com/google.protobuf.Value]': lambda *s: structure_builder(*s), # fields:{} inside - # Structured -- these have field names, much like extension types. - '[type.googleapis.com/google.protobuf.TimeStamp]': timestamp_builder, - '[type.googleapis.com/google.protobuf.Duration]': duration_builder, -} - - -# These do not have sub-members -- the names of the contained objects are field names. -extension_types = { - '[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes.NestedMessage]': NestedMessage, - '[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]': TestAllTypes, - '[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes.NestedMessage]': NestedMessage, - '[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]': TestAllTypes, -} - - -def object_builder(*items: ParseTree) -> TypeType: - """ - Build an ``object_value {}`` instance. These are more complex because -- generally -- they're - protobuf message instances with many individual fields. - - Edge case of an object that's really a Primitive - :: - - object_value:{ - [type.googleapis.com/google.protobuf.Int32Value]: - {value:2000000} - } - - Separately, a generic Value contains a "struct_value". - :: - - object_value:{ - [type.googleapis.com/google.protobuf.Value]:{ - struct_value:{ - fields:{key:"x" value:{null_value:NULL_VALUE}} - fields:{key:"y" value:{bool_value:false}} - } - } - } - """ - assert len(items) == 1 and isinstance(items[0], Structure), f"Unexpected {items!r}" - item = items[0] - assert item.type_name.type == "NAMESPACE", f"Unexpected {items!r}" - if item.type_name.value in well_known_types: - logger.debug(f" object_builder({item!r}) (well_known_types)") - # Singleton? - if len(item.items) == 1: - nested_item = item.items[0] - if isinstance(nested_item, Primitive): - return well_known_types[item.type_name.value](nested_item) - # ListValue requires items.type_name=values, from which each value is extracted. - # Struct requires items.type_name=fields, from which each key and value are extracted. - # Duration requires two Primitives to provide attribute name and value. - return well_known_types[item.type_name.value](*item.items) - - elif item.type_name.value in extension_types: - logger.debug(f" object_builder({item!r}) (extension_types)...") - fields = {} - for field in item.items: - # name string = field.type_name.value - # Value, however, is tricky. - if isinstance(field, Primitive): - # A single, named field. The value is a Primitive; we can deduce a type. - fields[field.type_name.value] = detokenize(field.value_text) - elif len(field.items) > 1: - # What are the items? - item_kind = {i.type_name.value for i in field.items} - # All values? We have a list. - if item_kind == {"values"}: - value = ListType([structure_builder(i) for i in field.items]) - # All fields? We have a mapping. - elif item_kind == {"fields"}: - pairs = [structure_builder(i) for i in field.items] - subfields = {k: v for k, v in pairs} - value = MapType(subfields) - else: - raise ValueError(f"Mixed item kinds {item_kind!r} in object_builder({items!r})") - fields[field.type_name.value] = value - elif len(field.items) == 1: - # A single, named field. The object is a Structure; it has type information. - fields[field.type_name.value] = structure_builder(field.items[0]) - else: - fields[field.type_name.value] = None - logger.debug(f" field {field!r} => {field.type_name.value!r} = {fields[field.type_name.value]}") - return extension_types[item.type_name.value](**fields) - else: - logger.debug(f" object_builder({item!r}) (Can't handle {item.type_name.value})") - raise ValueError(f"What is this? object_builder({items!r})") - - -def error_builder(*items: ParseTree) -> TypeType: - """ - Build an error result. - """ - error = structure_builder(items[0]) - return CELEvalError(error) - - -def type_builder(*items: ParseTree) -> TypeType: - """ - Build a type name for the environment. - We do not traverse the entire protobuf structure. - """ - item = items[0] - logger.debug(f" type_builder({item!r})") - if isinstance(item, Primitive): - # Wrong... return TypeType(detokenize(item.value_text)) - return type_value(detokenize(item.value_text)) - else: - # TODO: Descend into the type structure - # Wrong... return TypeType(item.type_name.value) - return type_value(item.type_name.value) - - -# Top-level values seen in the output Go serialization of an object. -# Note the circularity: ``'value'`` has a forward reference. - -structure_types = { - 'errors': error_builder, - 'list_value': list_builder, - 'map_value': map_builder, - 'object_value': object_builder, - 'struct_value': struct_builder, - 'value': lambda s: structure_builder(s), - 'type': type_builder, - 'type_value': type_builder, - # Parts of a Struct or List (or Map) - 'fields': lambda k, v: (structure_builder(k), structure_builder(v)), - 'values': lambda s: structure_builder(s), -} - - -def structure_builder(structure: ParseTree) -> TypeType: - """ - Top-level generic builder of CEL objects from the serialized Go object. - """ - logger.debug(f" structure_builder({structure!r})") - if isinstance(structure, Primitive): - if structure.type_name.value in primitive_types: - return primitive_types[structure.type_name.value](structure) - return detokenize(structure.value_text) - elif isinstance(structure, Structure): - if structure.type_name.value in structure_types: - return structure_types[structure.type_name.value](*structure.items) - # Edge Case 1: DurationType and TimestampType doesn't have `values` or `fields`, - # they have labeled items, not typed items. - # Edge Case 2: A clandestine object_value{[type]: {value}} without an `object_value` label. - return object_builder(structure) - else: - raise ValueError(f"What is this? structure_builder({structure!r})") - -class Gherkinizer(abc.ABC): - """Abstract Base Class for Gherkinization.""" - - @abc.abstractmethod - def convert(self, source_path: Optional[Path], target_path: Optional[Path]) -> None: - ... - -class LocalGherkinzer(Gherkinizer): - GHERKINIZER = Path.cwd() / "tools" / "mkgherkin.go" - - def convert(self, source_path: Optional[Path], target_path: Optional[Path]) -> None: - """ - Convert from textproto to interim Gherkin that contains Go value serializations. - - Requires GO on the ``PATH``. - - Build the app: - .. code-block:: bash - - % go mod init mkgherkin - % go mod tidy - - Run the app: - .. code-block:: bash - - % export PATH="/usr/local/go/bin:/usr/local/bin:$PATH" - % export GOPATH="~/go" - % mkgherkin.go name.textproto >name.interim - """ - logger.info(f"With local {self.GHERKINIZER}") - if source_path and target_path: - logger.info(f"gherkinize {source_path.name} -> {target_path.name}") - elif source_path: - logger.info(f"gherkinize {source_path.name} -> STDOUT") - - env = { - "PATH": f"/usr/local/go/bin:/usr/local/bin:{os.environ['PATH']}", - "GOPATH": str(Path.home()/"go"), - "HOME": str(Path.home()), - } - command = ["go", "run", self.GHERKINIZER.stem] - - if source_path: - command.append(str(source_path.absolute())) - - output_context = target_path.open('w') if target_path else contextlib.nullcontext(None) - try: - with output_context as interim: - subprocess.run( - command, - env=env, - stdout=interim, - check=True) - except subprocess.CalledProcessError as ex: - print( - f"{' '.join(command)} failed; " - f"perhaps `go mod init {self.GHERKINIZER.stem}; go get` is required." - ) - raise - -class DockerGherkinzer(Gherkinizer): - def convert(self, source_path: Optional[Path], target_path: Optional[Path]) -> None: - """ - Convert from textproto to interim Gherkin that contains Go value serializations. - - Requires ``docker`` on the ``PATH``. - - See ``tools/Dockerfile``. - - Build the docker image: - .. code-block:: bash - - % docker pull golang - % docker build -t mkgherkin . - - Run the docker image: - .. code-block:: bash - - % docker run --rm --name mkgherkin -v .:/usr/cel-python/textproto mkgherkin name.textproto >name.interim - """ - logger.info("With 'mkgherkin' Docker image") - if source_path and target_path: - logger.info(f"gherkinize {source_path.name} -> {target_path.name}") - elif source_path: - logger.info(f"gherkinize {source_path.name} -> STDOUT") - - command = ["docker", "run", "--rm", "--name", "mkgherkin", "-v", ".:/usr/cel-python/textproto", "mkgherkin"] - if source_path: - command.append(str(source_path.name)) - - try: - output_context = ( - target_path.open('w') if target_path else contextlib.nullcontext(None) - ) - with output_context as interim: - subprocess.run( - command, - stdout=interim, - check=True) - except subprocess.CalledProcessError as ex: - print( - f"{' '.join(command)} failed; " - f"`docker` and mkgherkin docker image are required." - ) - raise - -def expand_cel(feature_text: str) -> None: - """Revises CEL from Go notation to Python notation.""" - given_bindings_pat = re.compile(r'\s*Given bindings parameter "(.*?)" is\s+(.*)') - given_type_env_pat = re.compile(r'\s*Given type_env parameter "(.*?)" is\s+&\{(.*)\}') - when_expr_pat = re.compile(r'\s*When CEL expression "(.*)" is evaluated') - then_value_pat = re.compile(r"\s*Then value is\s+(.*)") - then_error_pat = re.compile(r"\s*Then eval_error is\s+(.*)") - - for line in feature_text.splitlines(): - given_binding_line = given_bindings_pat.match(line) - given_type_env_line = given_type_env_pat.match(line) - when_expr_line = when_expr_pat.match(line) - then_value_line = then_value_pat.match(line) - then_error_line = then_error_pat.match(line) - if given_binding_line: - # Replace the value with a proper CEL object - variable, value = given_binding_line.groups() - replacement = structure_builder(parse_serialized_value(Tokens(value))) - print(f' # {value}') - print(f' Given bindings parameter "{variable}" is {replacement}') - elif given_type_env_line: - # Replace the value with a CEL-friendly variant on the type name - variable, type_spec = given_type_env_line.groups() - replacement = structure_builder(parse_serialized_value(Tokens(type_spec))) - print(f' # {type_spec}') - print(f' Given type_env parameter "{variable}" is {replacement.cel_name()}') - elif then_value_line: - # Replace the value with a proper CEL object - value = then_value_line.group(1) - replacement = structure_builder(parse_serialized_value(Tokens(value))) - print(f' # {value}') - if type(replacement) == type: - print(f' Then value is {replacement.cel_name()}') - else: - print(f' Then value is {replacement!r}') - elif then_error_line: - # Replace the error with a more useful CEL-like. - value = then_error_line.group(1) - replacement_exception = structure_builder(parse_serialized_value(Tokens(value))) - print(f' # {value}') - print(f' Then eval_error is {replacement_exception.args[0]!r}') - elif when_expr_line: - # Clean up escaped quotes within the CEL expr. - value = when_expr_line.group(1) - replacement = ''.join( - expand_str_escape(m.group()) for m in STR_ESCAPES.finditer(value)) - if '"' in replacement: - print(f" When CEL expression '{replacement}' is evaluated") - else: - print(f' When CEL expression "{replacement}" is evaluated') - else: - # it's already perfect - print(line) - -def celify(source_path: Path, target_path: Optional[Path]) -> None: - """ - Rewrite interim Gherkin that contains Go value serializations into final Gherkin with CEL serializations. - - This reads the interim Gherkin, looking for specific clauses with serialized values: - - - Given bindings parameter ... is ... - - Given type_env parameter ... is ... - - When CEL expression "..." is evaluated - - Then value is ... - - These contain Go values which are parsed and rebuilt as CEL objects. - The resulting Gherkin is written to a given Path, or stdout if not Path is given. - """ - if target_path: - logger.info(f"celify {source_path.name} -> {target_path.name}") - else: - logger.info(f"celify {source_path.name}") - - feature_text = source_path.read_text() - if target_path: - with target_path.open('w') as target_file: - with contextlib.redirect_stdout(target_file): - expand_cel(feature_text) - else: - with contextlib.nullcontext(None): - expand_cel(feature_text) - - -def get_options(argv: List[str] = sys.argv[1:]) -> argparse.Namespace: - parser = argparse.ArgumentParser() - parser.add_argument( - '-g', '--gherkinizer', - choices=["docker", "local"], - default="docker") - parser.add_argument( - '-v', '--verbose', - dest="log_level", - action='store_const', const=logging.DEBUG, default=logging.INFO) - parser.add_argument( - "-s", "--silent", - dest="log_level", - action="store_const", const=logging.ERROR) - parser.add_argument( - '-o', '--output', action='store', type=Path, default=None, - help="output file (default is stdout)" - ) - parser.add_argument( - 'source', action='store', nargs='?', type=Path, - help=".textproto file to convert" - ) - options = parser.parse_args(argv) - return options - - -if __name__ == "__main__": - logging.basicConfig(level=logging.INFO) - options = get_options() - logging.getLogger().setLevel(options.log_level) - - if options.gherkinizer.lower() == "docker": - gherkinzer = DockerGherkinzer() - else: - gherkinzer = LocalGherkinzer() - - if not options.source: - gherkinzer.convert(None, None) - sys.exit() - - source = options.source - interim = source.with_suffix(".interim") - gherkinzer.convert(source, interim) - celify(interim, options.output) diff --git a/tools/test_gherkinize.py b/tools/test_gherkinize.py new file mode 100644 index 0000000..fc955f2 --- /dev/null +++ b/tools/test_gherkinize.py @@ -0,0 +1,5581 @@ +# SPDX-Copyright: Copyright (c) Capital One Services, LLC +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2020 Capital One Services, LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +""" +Test the gherkinize.py tool to convert textproto to Gherkin. +""" + +from google.protobuf import any_pb2, struct_pb2 +from cel.expr.conformance.proto2 import test_all_types_pb2 as proto2_test_all_types +from cel.expr.conformance.proto3 import test_all_types_pb2 as proto3_test_all_types +from gherkinize import ( + CELValue, + CELBool, + CELBytes, + CELErrorSet, + CELInt, + CELDouble, + CELDuration, + CELList, + CELMap, + CELNull, + CELString, + CELUint, + CELType, + Result, +) + + +def test_given_bindings() -> None: + assert Result.from_text_proto_str("value:{int64_value:123}") == Result( + "value", CELInt(source=123) + ) + assert Result.from_text_proto_str("value:{bool_value:true}") == Result( + "value", CELBool(source=True) + ) + assert Result.from_text_proto_str("value:{bool_value:false}") == Result( + "value", CELBool(source=False) + ) + assert Result.from_text_proto_str('value:{bytes_value:"\\x00"}') == Result( + "value", CELBytes(source=b"\x00") + ) + assert Result.from_text_proto_str("value:{int64_value:124}") == Result( + "value", CELInt(source=124) + ) + assert Result.from_text_proto_str("value:{double_value:9.8}") == Result( + "value", CELDouble(source=9.8) + ) + assert Result.from_text_proto_str( + 'value:{map_value:{entries:{key:{string_value:"c"} value:{string_value:"d"}} entries:{key:{string_value:"a"} value:{string_value:"b"}}}}' + ) == Result( + "value", CELMap({"c": CELString(source="d"), "a": CELString(source="b")}) + ) + assert Result.from_text_proto_str("value:{null_value:NULL_VALUE}") == Result( + "value", None + ) + assert Result.from_text_proto_str( + "value:{list_value:{values:{int64_value:2} values:{int64_value:1}}}" + ) == Result("value", CELList([CELInt(source=2), CELInt(source=1)])) + assert Result.from_text_proto_str('value:{string_value:"abc"}') == Result( + "value", CELString(source="abc") + ) + assert Result.from_text_proto_str("value:{uint64_value:1000}") == Result( + "value", CELUint(source=1000) + ) + assert Result.from_text_proto_str( + "value:{object_value:{[type.googleapis.com/google.protobuf.Int32Value]:{value:2000000}}}" + ) == Result("value", CELInt(source=2000000)) + assert Result.from_text_proto_str( + "value:{object_value:{[type.googleapis.com/google.protobuf.Int64Value]:{value:2000000}}}" + ) == Result("value", CELInt(source=2000000)) + assert Result.from_text_proto_str( + "value:{object_value:{[type.googleapis.com/google.protobuf.UInt32Value]:{value:2000000}}}" + ) == Result("value", CELUint(source=2000000)) + assert Result.from_text_proto_str( + "value:{object_value:{[type.googleapis.com/google.protobuf.UInt64Value]:{value:2000000}}}" + ) == Result("value", CELUint(source=2000000)) + assert Result.from_text_proto_str( + "value:{object_value:{[type.googleapis.com/google.protobuf.FloatValue]:{value:-1.25e+06}}}" + ) == Result("value", CELDouble(source=-1250000.0)) + assert Result.from_text_proto_str( + "value:{object_value:{[type.googleapis.com/google.protobuf.DoubleValue]:{value:-1.25e+06}}}" + ) == Result("value", CELDouble(source=-1250000.0)) + assert Result.from_text_proto_str( + "value:{object_value:{[type.googleapis.com/google.protobuf.BoolValue]:{value:true}}}" + ) == Result("value", CELBool(source=True)) + assert Result.from_text_proto_str( + 'value:{object_value:{[type.googleapis.com/google.protobuf.StringValue]:{value:"bar"}}}' + ) == Result("value", CELString(source="bar")) + assert Result.from_text_proto_str( + 'value:{object_value:{[type.googleapis.com/google.protobuf.BytesValue]:{value:"bar"}}}' + ) == Result("value", CELBytes(source=b"bar")) + assert Result.from_text_proto_str( + 'value:{object_value:{[type.googleapis.com/google.protobuf.ListValue]:{values:{string_value:"bar"} values:{list_value:{values:{string_value:"a"} values:{string_value:"b"}}}}}}' + ) == Result( + "value", + CELList( + [ + CELString(source="bar"), + CELList([CELString(source="a"), CELString(source="b")]), + ] + ), + ) + assert Result.from_text_proto_str( + 'value:{object_value:{[type.googleapis.com/google.protobuf.Struct]:{fields:{key:"first" value:{string_value:"Abraham"}} fields:{key:"last" value:{string_value:"Lincoln"}}}}}' + ) == Result( + "value", + CELMap( + {"first": CELString(source="Abraham"), "last": CELString(source="Lincoln")} + ), + ) + assert Result.from_text_proto_str( + "value:{object_value:{[type.googleapis.com/google.protobuf.Value]:{null_value:NULL_VALUE}}}" + ) == Result("value", None) + assert Result.from_text_proto_str( + "value:{object_value:{[type.googleapis.com/google.protobuf.Value]:{number_value:-26.375}}}" + ) == Result("value", CELDouble(source=-26.375)) + assert Result.from_text_proto_str( + 'value:{object_value:{[type.googleapis.com/google.protobuf.Value]:{string_value:"bar"}}}' + ) == Result("value", CELString(source="bar")) + assert Result.from_text_proto_str( + "value:{object_value:{[type.googleapis.com/google.protobuf.Value]:{bool_value:true}}}" + ) == Result("value", CELBool(source=True)) + assert Result.from_text_proto_str( + 'value:{object_value:{[type.googleapis.com/google.protobuf.Value]:{struct_value:{fields:{key:"x" value:{null_value:NULL_VALUE}} fields:{key:"y" value:{bool_value:false}}}}}}' + ) == Result("value", CELMap({"x": CELNull(), "y": CELBool(source=False)})) + assert Result.from_text_proto_str( + 'value:{object_value:{[type.googleapis.com/google.protobuf.Value]:{list_value:{values:{number_value:1} values:{bool_value:true} values:{string_value:"hi"}}}}}' + ) == Result( + "value", + CELList([CELDouble(source=1), CELBool(source=True), CELString(source="hi")]), + ) + assert Result.from_text_proto_str( + "value:{object_value:{[type.googleapis.com/google.protobuf.Any]:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_int32:150}}}}" + ) == Result( + "value", + CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=150, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ), + ) + assert Result.from_text_proto_str( + 'value:{map_value:{entries:{key:{string_value:"name"} value:{int64_value:1024}}}}' + ) == Result("value", CELMap({"name": CELInt(source=1024)})) + assert Result.from_text_proto_str( + 'value:{map_value:{entries:{key:{string_value:"holiday"} value:{string_value:"field"}}}}' + ) == Result("value", CELMap({"holiday": CELString(source="field")})) + assert Result.from_text_proto_str('value:{string_value:"yeah"}') == Result( + "value", CELString(source="yeah") + ) + assert Result.from_text_proto_str( + 'value:{map_value:{entries:{key:{string_value:"c"} value:{string_value:"yeah"}}}}' + ) == Result("value", CELMap({"c": CELString(source="yeah")})) + assert Result.from_text_proto_str( + 'value:{map_value:{entries:{key:{string_value:"c"} value:{string_value:"oops"}}}}' + ) == Result("value", CELMap({"c": CELString(source="oops")})) + assert Result.from_text_proto_str( + 'value:{list_value:{values:{string_value:"pancakes"}}}' + ) == Result("value", CELList([CELString(source="pancakes")])) + assert Result.from_text_proto_str("value:{int64_value:15}") == Result( + "value", CELInt(source=15) + ) + assert Result.from_text_proto_str('value:{string_value:"false"}') == Result( + "value", CELString(source="false") + ) + assert Result.from_text_proto_str( + "value:{list_value:{values:{int64_value:0}}}" + ) == Result("value", CELList([CELInt(source=0)])) + assert Result.from_text_proto_str("value:{int64_value:17}") == Result( + "value", CELInt(source=17) + ) + assert Result.from_text_proto_str( + "value:{object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_int32:17}}}" + ) == Result( + "value", + CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=17, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ), + ) + assert Result.from_text_proto_str( + "value:{object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_int64:-99}}}" + ) == Result( + "value", + CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=-99, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ), + ) + assert Result.from_text_proto_str( + "value:{object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_int32:17}}}" + ) == Result( + "value", + CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=17, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ), + ) + assert Result.from_text_proto_str( + "value:{object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_int64:-99}}}" + ) == Result( + "value", + CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=-99, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ), + ) + assert Result.from_text_proto_str( + "value:{object_value:{[type.googleapis.com/google.protobuf.Duration]:{seconds:123 nanos:123456789}}}" + ) == Result("value", CELDuration(seconds=123, nanos=123456789)) + + +def test_then_values() -> None: + assert CELValue.from_text_proto_str("int64_value:0") == CELInt(source=0) + assert CELValue.from_text_proto_str("uint64_value:0") == CELUint(source=0) + assert CELValue.from_text_proto_str("double_value:0") == CELDouble(source=0) + assert CELValue.from_text_proto_str('string_value:""') == CELString(source="") + assert CELValue.from_text_proto_str('bytes_value:""') == CELBytes(source=b"") + assert CELValue.from_text_proto_str("bool_value:false") == CELBool(source=False) + assert CELValue.from_text_proto_str("null_value:NULL_VALUE") == CELNull() + assert CELValue.from_text_proto_str("list_value:{}") == CELList([]) + assert CELValue.from_text_proto_str("map_value:{}") == CELMap({}) + assert CELValue.from_text_proto_str("int64_value:42") == CELInt(source=42) + assert CELValue.from_text_proto_str("uint64_value:123456789") == CELUint( + source=123456789 + ) + assert CELValue.from_text_proto_str("int64_value:-9223372036854775808") == CELInt( + source=-9223372036854775808 + ) + assert CELValue.from_text_proto_str("double_value:-23") == CELDouble(source=-23) + assert CELValue.from_text_proto_str('string_value:"!"') == CELString(source="!") + assert CELValue.from_text_proto_str('string_value:"\'"') == CELString(source="'") + assert CELValue.from_text_proto_str('bytes_value:"ÿ"') == CELBytes( + source=b"\xc3\xbf" + ) + assert CELValue.from_text_proto_str('bytes_value:"\\x00\\xff"') == CELBytes( + source=b"\x00\xff" + ) + assert CELValue.from_text_proto_str( + "list_value:{values:{int64_value:-1}}" + ) == CELList([CELInt(source=-1)]) + assert CELValue.from_text_proto_str( + 'map_value:{entries:{key:{string_value:"k"} value:{string_value:"v"}}}' + ) == CELMap({"k": CELString(source="v")}) + assert CELValue.from_text_proto_str("bool_value:true") == CELBool(source=True) + assert CELValue.from_text_proto_str("int64_value:1431655765") == CELInt( + source=1431655765 + ) + assert CELValue.from_text_proto_str("int64_value:-1431655765") == CELInt( + source=-1431655765 + ) + assert CELValue.from_text_proto_str("uint64_value:1431655765") == CELUint( + source=1431655765 + ) + assert CELValue.from_text_proto_str('string_value:"✌"') == CELString(source="✌") + assert CELValue.from_text_proto_str('string_value:"🐱"') == CELString(source="🐱") + assert CELValue.from_text_proto_str( + 'string_value:"\\x07\\x08\\x0c\\n\\r\\t\\x0b\\"\'\\\\"' + ) == CELString(source="\x07\x08\x0c\n\r\t\x0b\"'\\") + assert CELValue.from_text_proto_str("int64_value:123") == CELInt(source=123) + assert CELErrorSet.from_text_proto_str( + "errors:{message:\"undeclared reference to 'x' (in container '')\"}" + ) == CELErrorSet("undeclared reference to 'x' (in container '')") + assert CELValue.from_text_proto_str("int64_value:2") == CELInt(source=2) + assert CELErrorSet.from_text_proto_str( + 'errors:{message:"unbound function"}' + ) == CELErrorSet("unbound function") + assert CELErrorSet.from_text_proto_str( + 'errors:{message:"no such overload"}' + ) == CELErrorSet("no such overload") + assert CELValue.from_text_proto_str('bytes_value:"abc"') == CELBytes(source=b"abc") + assert CELValue.from_text_proto_str("double_value:1e+12") == CELDouble( + source=1000000000000.0 + ) + assert CELValue.from_text_proto_str("double_value:-1e+15") == CELDouble( + source=-1000000000000000.0 + ) + assert CELValue.from_text_proto_str( + "double_value:9.223372036854776e+18" + ) == CELDouble(source=9.223372036854776e18) + assert CELValue.from_text_proto_str("double_value:123") == CELDouble(source=123) + assert CELValue.from_text_proto_str( + "double_value:1.8446744073709552e+19" + ) == CELDouble(source=1.8446744073709552e19) + assert CELValue.from_text_proto_str("double_value:-0") == CELDouble(source=0) + assert CELValue.from_text_proto_str("double_value:123.456") == CELDouble( + source=123.456 + ) + assert CELValue.from_text_proto_str("double_value:-987.654") == CELDouble( + source=-987.654 + ) + assert CELValue.from_text_proto_str("double_value:6.02214e+23") == CELDouble( + source=6.02214e23 + ) + assert CELValue.from_text_proto_str("double_value:1.38e-23") == CELDouble( + source=1.38e-23 + ) + assert CELValue.from_text_proto_str("double_value:-8.432e+08") == CELDouble( + source=-843200000.0 + ) + assert CELValue.from_text_proto_str("double_value:-5.43e-21") == CELDouble( + source=-5.43e-21 + ) + assert CELValue.from_text_proto_str('type_value:"list"') == CELType(value="list") + assert CELErrorSet.from_text_proto_str( + 'errors:{message:"range error"}' + ) == CELErrorSet("range error") + assert CELValue.from_text_proto_str("int64_value:-123") == CELInt(source=-123) + assert CELValue.from_text_proto_str("int64_value:-8") == CELInt(source=-8) + assert CELValue.from_text_proto_str("int64_value:12") == CELInt(source=12) + assert CELValue.from_text_proto_str("int64_value:-4") == CELInt(source=-4) + assert CELErrorSet.from_text_proto_str('errors:{message:"range"}') == CELErrorSet( + "range" + ) + assert CELValue.from_text_proto_str("int64_value:987") == CELInt(source=987) + assert CELValue.from_text_proto_str("int64_value:1095379199") == CELInt( + source=1095379199 + ) + assert CELValue.from_text_proto_str('string_value:"123"') == CELString(source="123") + assert CELValue.from_text_proto_str('string_value:"-456"') == CELString( + source="-456" + ) + assert CELValue.from_text_proto_str('string_value:"9876"') == CELString( + source="9876" + ) + assert CELValue.from_text_proto_str('string_value:"123.456"') == CELString( + source="123.456" + ) + assert CELValue.from_text_proto_str('string_value:"-0.0045"') == CELString( + source="-0.0045" + ) + assert CELValue.from_text_proto_str('string_value:"abc"') == CELString(source="abc") + assert CELValue.from_text_proto_str('string_value:"ÿ"') == CELString(source="ÿ") + assert CELErrorSet.from_text_proto_str( + 'errors:{message:"invalid UTF-8"}' + ) == CELErrorSet("invalid UTF-8") + assert CELValue.from_text_proto_str('type_value:"bool"') == CELType(value="bool") + assert CELErrorSet.from_text_proto_str( + 'errors:{message:"unknown varaible"}' + ) == CELErrorSet("unknown varaible") + assert CELValue.from_text_proto_str('type_value:"int"') == CELType(value="int") + assert CELValue.from_text_proto_str('type_value:"uint"') == CELType(value="uint") + assert CELValue.from_text_proto_str('type_value:"double"') == CELType( + value="double" + ) + assert CELValue.from_text_proto_str('type_value:"null_type"') == CELType( + value="null_type" + ) + assert CELValue.from_text_proto_str('type_value:"string"') == CELType( + value="string" + ) + assert CELValue.from_text_proto_str('type_value:"bytes"') == CELType(value="bytes") + assert CELValue.from_text_proto_str('type_value:"map"') == CELType(value="map") + assert CELValue.from_text_proto_str('type_value:"type"') == CELType(value="type") + assert CELValue.from_text_proto_str("uint64_value:1729") == CELUint(source=1729) + assert CELValue.from_text_proto_str("uint64_value:3") == CELUint(source=3) + assert CELValue.from_text_proto_str("uint64_value:2") == CELUint(source=2) + assert CELValue.from_text_proto_str("uint64_value:26") == CELUint(source=26) + assert CELValue.from_text_proto_str("uint64_value:300") == CELUint(source=300) + assert CELErrorSet.from_text_proto_str( + 'errors:{message:"no_matching_overload"}' + ) == CELErrorSet("no_matching_overload") + assert CELValue.from_text_proto_str("int64_value:2000000") == CELInt(source=2000000) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_int32_wrapper:{value:432}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper={"value": 432}, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_int32_wrapper:{}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper={}, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str("int64_value:642") == CELInt(source=642) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_int32_wrapper:{value:-975}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper={"value": -975}, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_int32_wrapper:{}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper={}, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_int64_wrapper:{value:432}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper={"value": 432}, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_int64_wrapper:{}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper={}, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_int64_wrapper:{value:-975}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper={"value": -975}, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_int64_wrapper:{}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper={}, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str("uint64_value:123") == CELUint(source=123) + assert CELValue.from_text_proto_str("uint64_value:2000000") == CELUint( + source=2000000 + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_uint32_wrapper:{value:432}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper={"value": 432}, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_uint32_wrapper:{}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper={}, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_uint32_wrapper:{value:975}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper={"value": 975}, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_uint32_wrapper:{}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper={}, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str("uint64_value:258") == CELUint(source=258) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_uint64_wrapper:{value:432}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper={"value": 432}, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_uint64_wrapper:{}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper={}, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_uint64_wrapper:{value:975}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper={"value": 975}, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_uint64_wrapper:{}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper={}, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str("uint64_value:5123123123") == CELUint( + source=5123123123 + ) + assert CELValue.from_text_proto_str("double_value:-1500") == CELDouble(source=-1500) + assert CELValue.from_text_proto_str("double_value:-1.25e+06") == CELDouble( + source=-1250000.0 + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_float_wrapper:{value:86.75}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper={"value": 86.75}, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_float_wrapper:{}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper={}, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str("double_value:-12.375") == CELDouble( + source=-12.375 + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_float_wrapper:{value:-9.75}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper={"value": -9.75}, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_float_wrapper:{}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper={}, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str("double_value:64.25") == CELDouble(source=64.25) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_double_wrapper:{value:86.75}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper={"value": 86.75}, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_double_wrapper:{}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper={}, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_double_wrapper:{value:1.4e+55}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper={"value": 1.4e55}, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_double_wrapper:{value:-9.75}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper={"value": -9.75}, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_double_wrapper:{}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper={}, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_double_wrapper:{value:-9.9e-100}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper={"value": -9.9e-100}, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_bool_wrapper:{value:true}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper={"value": True}, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_bool_wrapper:{}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper={}, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_bool_wrapper:{value:true}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper={"value": True}, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_bool_wrapper:{}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper={}, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str('string_value:"foo"') == CELString(source="foo") + assert CELValue.from_text_proto_str('string_value:"flambé"') == CELString( + source="flambé" + ) + assert CELValue.from_text_proto_str('string_value:"bar"') == CELString(source="bar") + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_string_wrapper:{value:"baz"}}}' + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper={"value": "baz"}, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_string_wrapper:{}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper={}, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_string_wrapper:{value:"bletch"}}}' + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper={"value": "bletch"}, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_string_wrapper:{}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper={}, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str('bytes_value:"fooS"') == CELBytes( + source=b"fooS" + ) + assert CELValue.from_text_proto_str('bytes_value:"flambé"') == CELBytes( + source=b"flamb\xc3\xa9" + ) + assert CELValue.from_text_proto_str('bytes_value:"bar"') == CELBytes(source=b"bar") + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_bytes_wrapper:{value:"baz"}}}' + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper={"value": b"baz"}, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_bytes_wrapper:{}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper={}, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_bytes_wrapper:{value:"bletch"}}}' + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper={"value": b"bletch"}, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_bytes_wrapper:{}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper={}, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + 'list_value:{values:{double_value:3} values:{string_value:"foo"} values:{null_value:NULL_VALUE}}' + ) == CELList([CELDouble(source=3), CELString(source="foo"), CELNull()]) + assert CELValue.from_text_proto_str( + 'list_value:{values:{string_value:"bar"} values:{list_value:{values:{string_value:"a"} values:{string_value:"b"}}}}' + ) == CELList( + [ + CELString(source="bar"), + CELList([CELString(source="a"), CELString(source="b")]), + ] + ) + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{list_value:{values:{number_value:1} values:{string_value:"one"}}}}' + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=struct_pb2.ListValue( + values=[ + struct_pb2.Value(number_value=1), + struct_pb2.Value(string_value="one"), + ] + ), + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{list_value:{}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=struct_pb2.ListValue(), + ) + ) + assert CELValue.from_text_proto_str( + 'list_value:{values:{double_value:1} values:{string_value:"one"}}' + ) == CELList([CELDouble(source=1), CELString(source="one")]) + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{list_value:{values:{number_value:1} values:{string_value:"one"}}}}' + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=struct_pb2.ListValue( + values=[ + struct_pb2.Value(number_value=1), + struct_pb2.Value(string_value="one"), + ] + ), + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{list_value:{}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=struct_pb2.ListValue(), + ) + ) + assert CELValue.from_text_proto_str( + 'map_value:{entries:{key:{string_value:"uno"} value:{double_value:1}} entries:{key:{string_value:"dos"} value:{double_value:2}}}' + ) == CELMap({"uno": CELDouble(source=1), "dos": CELDouble(source=2)}) + assert CELValue.from_text_proto_str( + 'map_value:{entries:{key:{string_value:"first"} value:{string_value:"Abraham"}} entries:{key:{string_value:"last"} value:{string_value:"Lincoln"}}}' + ) == CELMap( + {"first": CELString(source="Abraham"), "last": CELString(source="Lincoln")} + ) + + +def test_then_values_2() -> None: + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_struct:{fields:{key:"deux" value:{number_value:2}} fields:{key:"un" value:{number_value:1}}}}}' + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct={"deux": 2, "un": 1}, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_struct:{}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct={}, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELErrorSet.from_text_proto_str( + 'errors:{message:"bad key type"}' + ) == CELErrorSet("bad key type") + assert CELValue.from_text_proto_str( + 'map_value:{entries:{key:{string_value:"one"} value:{double_value:1}}}' + ) == CELMap({"one": CELDouble(source=1)}) + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_struct:{fields:{key:"deux" value:{number_value:2}} fields:{key:"un" value:{number_value:1}}}}}' + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct={"deux": 2, "un": 1}, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_struct:{}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct={}, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_value:{null_value:NULL_VALUE}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value={"null_value": 0}, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_value:{null_value:NULL_VALUE}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value={"null_value": 0}, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str("double_value:12.5") == CELDouble(source=12.5) + assert CELValue.from_text_proto_str("double_value:-26.375") == CELDouble( + source=-26.375 + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_value:{number_value:7e+23}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value={"number_value": 7e23}, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_value:{number_value:0}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value={"number_value": 0}, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str("double_value:7e+23") == CELDouble(source=7e23) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_value:{number_value:7e+23}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value={"number_value": 7e23}, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_value:{number_value:0}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value={"number_value": 0}, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_value:{string_value:"baz"}}}' + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value={"string_value": "baz"}, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_value:{string_value:""}}}' + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value={"string_value": ""}, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str('string_value:"bletch"') == CELString( + source="bletch" + ) + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_value:{string_value:"baz"}}}' + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value={"string_value": "baz"}, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_value:{string_value:""}}}' + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value={"string_value": ""}, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_value:{bool_value:true}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value={"bool_value": True}, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_value:{bool_value:false}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value={"bool_value": False}, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_value:{bool_value:true}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value={"bool_value": True}, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_value:{bool_value:false}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value={"bool_value": False}, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + 'map_value:{entries:{key:{string_value:"a"} value:{double_value:1}} entries:{key:{string_value:"b"} value:{string_value:"two"}}}' + ) == CELMap({"a": CELDouble(source=1), "b": CELString(source="two")}) + assert CELValue.from_text_proto_str( + 'map_value:{entries:{key:{string_value:"x"} value:{null_value:NULL_VALUE}} entries:{key:{string_value:"y"} value:{bool_value:false}}}' + ) == CELMap({"x": CELNull(), "y": CELBool(source=False)}) + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_value:{struct_value:{fields:{key:"deux" value:{number_value:2}} fields:{key:"un" value:{number_value:1}}}}}}' + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value={"struct_value": {"deux": 2, "un": 1}}, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_value:{struct_value:{}}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value={"struct_value": {}}, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + 'map_value:{entries:{key:{string_value:"i"} value:{bool_value:true}}}' + ) == CELMap({"i": CELBool(source=True)}) + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_value:{struct_value:{fields:{key:"deux" value:{number_value:2}} fields:{key:"un" value:{number_value:1}}}}}}' + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value={"struct_value": {"deux": 2, "un": 1}}, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_value:{struct_value:{}}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value={"struct_value": {}}, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + 'list_value:{values:{string_value:"a"} values:{double_value:3}}' + ) == CELList([CELString(source="a"), CELDouble(source=3)]) + assert CELValue.from_text_proto_str( + 'list_value:{values:{double_value:1} values:{bool_value:true} values:{string_value:"hi"}}' + ) == CELList([CELDouble(source=1), CELBool(source=True), CELString(source="hi")]) + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_value:{list_value:{values:{string_value:"un"} values:{number_value:1}}}}}' + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value={"list_value": ["un", 1]}, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_value:{list_value:{}}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value={"list_value": []}, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + 'list_value:{values:{string_value:"i"} values:{bool_value:true}}' + ) == CELList([CELString(source="i"), CELBool(source=True)]) + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_value:{list_value:{values:{string_value:"un"} values:{number_value:1}}}}}' + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value={"list_value": ["un", 1]}, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_value:{list_value:{}}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value={"list_value": []}, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_int32:150}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=150, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELErrorSet.from_text_proto_str( + 'errors:{message:"conversion"}' + ) == CELErrorSet("conversion") + single_int32_any_value_proto2 = any_pb2.Any() + single_int32_any_value_proto2.Pack( + proto2_test_all_types.TestAllTypes( + single_int32=150, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_any:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_int32:150}}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=single_int32_any_value_proto2, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + single_int32_any_value_proto3 = any_pb2.Any() + single_int32_any_value_proto3.Pack( + proto3_test_all_types.TestAllTypes( + single_int32=150, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_any:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_int32:150}}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=single_int32_any_value_proto3, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_int32:150}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=150, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + 'list_value:{values:{map_value:{entries:{key:{string_value:"almost"} value:{string_value:"done"}}}}}' + ) == CELList([CELMap({"almost": CELString(source="done")})]) + assert CELValue.from_text_proto_str('string_value:"happy"') == CELString( + source="happy" + ) + assert CELValue.from_text_proto_str("uint64_value:100") == CELUint(source=100) + assert CELValue.from_text_proto_str("int64_value:5") == CELInt(source=5) + assert CELValue.from_text_proto_str("int64_value:1") == CELInt(source=1) + assert CELValue.from_text_proto_str("int64_value:1024") == CELInt(source=1024) + assert CELErrorSet.from_text_proto_str( + 'errors:{message:"no such key"}' + ) == CELErrorSet("no such key") + assert CELErrorSet.from_text_proto_str( + "errors:{message:\"no such key: 'name'\"}" + ) == CELErrorSet("no such key: 'name'") + assert CELValue.from_text_proto_str('string_value:"x"') == CELString(source="x") + assert CELValue.from_text_proto_str("double_value:15.15") == CELDouble(source=15.15) + assert CELValue.from_text_proto_str("uint64_value:1") == CELUint(source=1) + assert CELValue.from_text_proto_str( + "list_value:{values:{int64_value:1}}" + ) == CELList([CELInt(source=1)]) + assert CELValue.from_text_proto_str('string_value:"yeah"') == CELString( + source="yeah" + ) + assert CELErrorSet.from_text_proto_str( + "errors:{message:\"type 'list_type: > ' does not support field selection\"}" + ) == CELErrorSet( + "type 'list_type: > ' does not support field selection" + ) + assert CELErrorSet.from_text_proto_str( + "errors:{message:\"type 'int64_type' does not support field selection\"}" + ) == CELErrorSet("type 'int64_type' does not support field selection") + assert CELErrorSet.from_text_proto_str( + 'errors:{message:"unsupported key type"}' + ) == CELErrorSet("unsupported key type") + assert CELErrorSet.from_text_proto_str( + 'errors:{message:"Failed with repeated key"}' + ) == CELErrorSet("Failed with repeated key") + assert CELValue.from_text_proto_str("double_value:19.5") == CELDouble(source=19.5) + assert CELValue.from_text_proto_str("double_value:10") == CELDouble(source=10) + assert CELValue.from_text_proto_str("double_value:-6.25") == CELDouble(source=-6.25) + assert CELValue.from_text_proto_str("double_value:30") == CELDouble(source=30) + assert CELValue.from_text_proto_str("double_value:64.875") == CELDouble( + source=64.875 + ) + assert CELValue.from_text_proto_str("double_value:-4.75") == CELDouble(source=-4.75) + assert CELValue.from_text_proto_str("double_value:8.5") == CELDouble(source=8.5) + assert CELValue.from_text_proto_str("double_value:-91.6875") == CELDouble( + source=-91.6875 + ) + assert CELValue.from_text_proto_str("double_value:7.5") == CELDouble(source=7.5) + assert CELValue.from_text_proto_str("double_value:31.25") == CELDouble(source=31.25) + assert CELValue.from_text_proto_str("double_value:-1") == CELDouble(source=-1) + assert CELValue.from_text_proto_str("double_value:142") == CELDouble(source=142) + assert CELErrorSet.from_text_proto_str( + "errors:{message:\"found no matching overload for '_%_' applied to '(double, double)'\"}" + ) == CELErrorSet( + "found no matching overload for '_%_' applied to '(double, double)'" + ) + assert CELValue.from_text_proto_str("double_value:-4.5") == CELDouble(source=-4.5) + assert CELValue.from_text_proto_str("double_value:1.25") == CELDouble(source=1.25) + assert CELValue.from_text_proto_str("double_value:inf") == CELDouble( + source=float("inf") + ) + assert CELValue.from_text_proto_str("double_value:1.75") == CELDouble(source=1.75) + assert CELValue.from_text_proto_str("double_value:2.5") == CELDouble(source=2.5) + assert CELValue.from_text_proto_str("double_value:45.25") == CELDouble(source=45.25) + assert CELValue.from_text_proto_str("double_value:-25.25") == CELDouble( + source=-25.25 + ) + assert CELValue.from_text_proto_str("double_value:-inf") == CELDouble( + source=float("-inf") + ) + assert CELValue.from_text_proto_str("int64_value:35") == CELInt(source=35) + assert CELValue.from_text_proto_str("int64_value:-6") == CELInt(source=-6) + assert CELValue.from_text_proto_str("int64_value:30") == CELInt(source=30) + assert CELValue.from_text_proto_str("int64_value:64") == CELInt(source=64) + assert CELValue.from_text_proto_str("int64_value:-30") == CELInt(source=-30) + assert CELValue.from_text_proto_str("int64_value:84") == CELInt(source=84) + assert CELValue.from_text_proto_str("int64_value:-80") == CELInt(source=-80) + assert CELValue.from_text_proto_str("int64_value:60") == CELInt(source=60) + assert CELValue.from_text_proto_str("int64_value:21") == CELInt(source=21) + assert CELValue.from_text_proto_str("int64_value:-10") == CELInt(source=-10) + assert CELValue.from_text_proto_str("int64_value:40") == CELInt(source=40) + assert CELValue.from_text_proto_str("int64_value:3") == CELInt(source=3) + assert CELValue.from_text_proto_str("int64_value:-2") == CELInt(source=-2) + assert CELValue.from_text_proto_str("int64_value:-3") == CELInt(source=-3) + assert CELValue.from_text_proto_str("int64_value:-42") == CELInt(source=-42) + assert CELErrorSet.from_text_proto_str( + 'errors:{message:"no_such_overload"}' + ) == CELErrorSet("no_such_overload") + assert CELErrorSet.from_text_proto_str( + 'errors:{message:"modulus by zero"}' + ) == CELErrorSet("modulus by zero") + assert CELErrorSet.from_text_proto_str( + 'errors:{message:"divide by zero"}' + ) == CELErrorSet("divide by zero") + assert CELValue.from_text_proto_str("int64_value:17") == CELInt(source=17) + assert CELValue.from_text_proto_str("int64_value:29") == CELInt(source=29) + assert CELValue.from_text_proto_str("int64_value:45") == CELInt(source=45) + assert CELValue.from_text_proto_str("int64_value:-25") == CELInt(source=-25) + assert CELErrorSet.from_text_proto_str( + 'errors:{message:"return error for overflow"}' + ) == CELErrorSet("return error for overflow") + assert CELValue.from_text_proto_str("uint64_value:44") == CELUint(source=44) + assert CELValue.from_text_proto_str("uint64_value:30") == CELUint(source=30) + assert CELValue.from_text_proto_str("uint64_value:80") == CELUint(source=80) + assert CELValue.from_text_proto_str("uint64_value:17") == CELUint(source=17) + assert CELValue.from_text_proto_str("uint64_value:29") == CELUint(source=29) + assert CELValue.from_text_proto_str("uint64_value:45") == CELUint(source=45) + assert CELValue.from_text_proto_str("uint64_value:25") == CELUint(source=25) + assert CELValue.from_text_proto_str( + "list_value:{values:{int64_value:2} values:{int64_value:2}}" + ) == CELList([CELInt(source=2), CELInt(source=2)]) + assert CELValue.from_text_proto_str( + "list_value:{values:{int64_value:3} values:{int64_value:4}}" + ) == CELList([CELInt(source=3), CELInt(source=4)]) + assert CELValue.from_text_proto_str( + "list_value:{values:{int64_value:1} values:{int64_value:2}}" + ) == CELList([CELInt(source=1), CELInt(source=2)]) + assert CELValue.from_text_proto_str("int64_value:7") == CELInt(source=7) + assert CELValue.from_text_proto_str('string_value:"Ringo"') == CELString( + source="Ringo" + ) + assert CELErrorSet.from_text_proto_str( + 'errors:{message:"invalid_argument"}' + ) == CELErrorSet("invalid_argument") + assert CELErrorSet.from_text_proto_str( + 'errors:{message:"division by zero"}' + ) == CELErrorSet("division by zero") + assert CELValue.from_text_proto_str('string_value:"cows"') == CELString( + source="cows" + ) + assert CELErrorSet.from_text_proto_str( + 'errors:{message:"no matching overload"}' + ) == CELErrorSet("no matching overload") + assert CELValue.from_text_proto_str( + "list_value:{values:{int64_value:9}}" + ) == CELList([CELInt(source=9)]) + assert CELValue.from_text_proto_str( + "list_value:{values:{int64_value:1} values:{int64_value:2} values:{int64_value:3}}" + ) == CELList([CELInt(source=1), CELInt(source=2), CELInt(source=3)]) + assert CELValue.from_text_proto_str( + "list_value:{values:{int64_value:2}}" + ) == CELList([CELInt(source=2)]) + assert CELValue.from_text_proto_str( + "list_value:{values:{int64_value:1} values:{int64_value:3}}" + ) == CELList([CELInt(source=1), CELInt(source=3)]) + assert CELValue.from_text_proto_str( + 'list_value:{values:{string_value:"signer"}}' + ) == CELList([CELString(source="signer")]) + assert CELValue.from_text_proto_str("int64_value:4") == CELInt(source=4) + assert CELValue.from_text_proto_str("int64_value:19") == CELInt(source=19) + assert CELValue.from_text_proto_str('string_value:"seventeen"') == CELString( + source="seventeen" + ) + assert CELErrorSet.from_text_proto_str('errors:{message:"foo"}') == CELErrorSet( + "foo" + ) + assert CELValue.from_text_proto_str( + 'map_value:{entries:{key:{string_value:"k"} value:{string_value:"v"}} entries:{key:{string_value:"k1"} value:{string_value:"v1"}}}' + ) == CELMap({"k": CELString(source="v"), "k1": CELString(source="v1")}) + assert CELValue.from_text_proto_str( + 'list_value:{values:{int64_value:17} values:{string_value:"pancakes"}}' + ) == CELList([CELInt(source=17), CELString(source="pancakes")]) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_int64:17}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=17, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_int32:-34}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=-34, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_uint32:1}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=1, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_uint64:9999}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=9999, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_sint32:-3}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=-3, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_sint64:255}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=255, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_fixed32:43}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=43, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_fixed64:1880}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=1880, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_sfixed32:-404}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=-404, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_sfixed64:-1}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=-1, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_float:3.1416}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=3.1416, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_double:6.022e+23}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=6.022e23, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_bool:true}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=True, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_string:"foo"}}' + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string="foo", + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_bytes:"\\xff"}}' + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=b"\xff", + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + single_int32_any_value_proto2.Pack( + proto2_test_all_types.TestAllTypes(single_int32=1) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_any:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_int32:1}}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=single_int32_any_value_proto2, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_duration:{seconds:123}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration={"seconds": 123}, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_timestamp:{seconds:1234567890}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp={"seconds": 1234567890}, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_struct:{fields:{key:"one" value:{number_value:1}} fields:{key:"two" value:{number_value:2}}}}}' + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct={"two": 2, "one": 1}, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_value:{string_value:"foo"}}}' + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value={"string_value": "foo"}, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_int64_wrapper:{value:-321}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper={"value": -321}, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_int32_wrapper:{value:-456}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper={"value": -456}, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_double_wrapper:{value:2.71828}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper={"value": 2.71828}, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_float_wrapper:{value:2.99792e+08}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper={"value": 299792000.0}, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_uint64_wrapper:{value:8675309}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper={"value": 8675309}, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_uint32_wrapper:{value:987}}}" + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper={"value": 987}, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_string_wrapper:{value:"hubba"}}}' + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper={"value": "hubba"}, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_bytes_wrapper:{value:"\\xc1C"}}}' + ) == CELValue.from_proto( + proto2_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper={"value": b"\301C"}, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str("int64_value:-99") == CELInt(source=-99) + assert CELValue.from_text_proto_str("int64_value:-32") == CELInt(source=-32) + # assert structure_builder(structure(Tokens('object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes.NestedMessage]:{}}') == <__main__.NestedMessage object at 0x1a1acdc70> + assert CELErrorSet.from_text_proto_str( + 'errors:{message:"no_such_field"}' + ) == CELErrorSet("no_such_field") + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_int64:17}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=17, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_int32:-34}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=-34, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_uint32:1}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=1, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_uint64:9999}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=9999, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_sint32:-3}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=-3, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_sint64:255}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=255, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_fixed32:43}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=43, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_fixed64:1880}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=1880, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_sfixed32:-404}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=-404, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_sfixed64:-1}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=-1, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_float:3.1416}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=3.1416, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_double:6.022e+23}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=6.022e23, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_bool:true}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=True, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_string:"foo"}}' + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string="foo", + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_bytes:"\\xff"}}' + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=b"\xff", + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + single_int32_any_value_proto3.Pack( + proto3_test_all_types.TestAllTypes(single_int32=1) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_any:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_int32:1}}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=single_int32_any_value_proto3, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_duration:{seconds:123}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration={"seconds": 123}, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_timestamp:{seconds:1234567890}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp={"seconds": 1234567890}, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_struct:{fields:{key:"one" value:{number_value:1}} fields:{key:"two" value:{number_value:2}}}}}' + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct={ + "one": 1, + "two": 2, + }, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_value:{string_value:"foo"}}}' + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value={"string_value": "foo"}, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_int64_wrapper:{value:-321}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper={"value": -321}, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_int32_wrapper:{value:-456}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper={"value": -456}, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_double_wrapper:{value:2.71828}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper={"value": 2.71828}, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_float_wrapper:{value:2.99792e+08}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper={"value": 299792000.0}, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_uint64_wrapper:{value:8675309}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper={"value": 8675309}, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + "object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_uint32_wrapper:{value:987}}}" + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper={"value": 987}, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_string_wrapper:{value:"hubba"}}}' + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper={"value": "hubba"}, + single_bool_wrapper=None, + single_bytes_wrapper=None, + list_value=None, + ) + ) + assert CELValue.from_text_proto_str( + 'object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_bytes_wrapper:{value:"\\xc1C"}}}' + ) == CELValue.from_proto( + proto3_test_all_types.TestAllTypes( + single_int32=None, + single_int64=None, + single_uint32=None, + single_uint64=None, + single_sint32=None, + single_sint64=None, + single_fixed32=None, + single_fixed64=None, + single_sfixed32=None, + single_sfixed64=None, + single_float=None, + single_double=None, + single_bool=None, + single_string=None, + single_bytes=None, + single_any=None, + single_duration=None, + single_timestamp=None, + single_struct=None, + single_value=None, + single_int64_wrapper=None, + single_int32_wrapper=None, + single_double_wrapper=None, + single_float_wrapper=None, + single_uint64_wrapper=None, + single_uint32_wrapper=None, + single_string_wrapper=None, + single_bool_wrapper=None, + single_bytes_wrapper={"value": b"\301C"}, + list_value=None, + ) + ) + # assert structure_builder(structure(Tokens('object_value:{[type.googleapis.com/cel.expr.conformance.proto3.CELValue.from_proto(proto3_test_all_types.TestAllTypes.NestedMessage]:{}}') == <__main__.NestedMessage object at 0x1a1acd280> + assert CELValue.from_text_proto_str('string_value:"hello"') == CELString( + source="hello" + ) + assert CELValue.from_text_proto_str('string_value:"¢ÿȀ"') == CELString(source="¢ÿȀ") + assert CELValue.from_text_proto_str('string_value:"rôle"') == CELString( + source="rôle" + ) + assert CELValue.from_text_proto_str('string_value:"Ω"') == CELString(source="Ω") + assert CELValue.from_text_proto_str('bytes_value:"abcdef"') == CELBytes( + source=b"abcdef" + ) + assert CELValue.from_text_proto_str('bytes_value:"\\xffoo"') == CELBytes( + source=b"\xffoo" + ) + assert CELValue.from_text_proto_str('bytes_value:"zxy"') == CELBytes(source=b"zxy") + assert CELValue.from_text_proto_str("int64_value:1234567890") == CELInt( + source=1234567890 + ) + assert CELValue.from_text_proto_str( + 'string_value:"2009-02-13T23:31:30Z"' + ) == CELString(source="2009-02-13T23:31:30Z") + assert CELValue.from_text_proto_str( + 'type_value:"google.protobuf.Timestamp"' + ) == CELType(value="google.protobuf.Timestamp") + assert CELValue.from_text_proto_str('string_value:"1000000s"') == CELString( + source="1000000s" + ) + assert CELValue.from_text_proto_str( + 'type_value:"google.protobuf.Duration"' + ) == CELType(value="google.protobuf.Duration") + assert CELValue.from_text_proto_str("int64_value:13") == CELInt(source=13) + assert CELValue.from_text_proto_str("int64_value:43") == CELInt(source=43) + assert CELValue.from_text_proto_str("int64_value:2009") == CELInt(source=2009) + assert CELValue.from_text_proto_str("int64_value:23") == CELInt(source=23) + assert CELValue.from_text_proto_str("int64_value:31") == CELInt(source=31) + assert CELValue.from_text_proto_str("int64_value:14") == CELInt(source=14) + assert CELValue.from_text_proto_str("int64_value:11") == CELInt(source=11) + assert CELValue.from_text_proto_str("int64_value:16") == CELInt(source=16) + assert CELValue.from_text_proto_str("int64_value:123123") == CELInt(source=123123) + assert CELValue.from_text_proto_str("int64_value:62") == CELInt(source=62) + assert CELValue.from_text_proto_str("int64_value:3730") == CELInt(source=3730) + + +def test_type_env_values() -> None: + assert CELType.from_text_proto_str( + 'type:{message_type:"google.protobuf.Int32Value"}' + ) == CELType(value="google.protobuf.Int32Value") + assert CELType.from_text_proto_str( + 'type:{message_type:"google.protobuf.Int64Value"}' + ) == CELType(value="google.protobuf.Int64Value") + assert CELType.from_text_proto_str( + 'type:{message_type:"google.protobuf.UInt32Value"}' + ) == CELType(value="google.protobuf.UInt32Value") + assert CELType.from_text_proto_str( + 'type:{message_type:"google.protobuf.UInt64Value"}' + ) == CELType(value="google.protobuf.UInt64Value") + assert CELType.from_text_proto_str( + 'type:{message_type:"google.protobuf.FloatValue"}' + ) == CELType(value="google.protobuf.FloatValue") + assert CELType.from_text_proto_str( + 'type:{message_type:"google.protobuf.DoubleValue"}' + ) == CELType(value="google.protobuf.DoubleValue") + assert CELType.from_text_proto_str( + 'type:{message_type:"google.protobuf.BoolValue"}' + ) == CELType(value="google.protobuf.BoolValue") + assert CELType.from_text_proto_str( + 'type:{message_type:"google.protobuf.StringValue"}' + ) == CELType(value="google.protobuf.StringValue") + assert CELType.from_text_proto_str( + 'type:{message_type:"google.protobuf.BytesValue"}' + ) == CELType(value="google.protobuf.BytesValue") + assert CELType.from_text_proto_str( + 'type:{message_type:"google.protobuf.ListValue"}' + ) == CELType(value="google.protobuf.ListValue") + assert CELType.from_text_proto_str( + 'type:{message_type:"google.protobuf.Struct"}' + ) == CELType(value="google.protobuf.Struct") + assert CELType.from_text_proto_str( + 'type:{message_type:"google.protobuf.Value"}' + ) == CELType(value="google.protobuf.Value") + assert CELType.from_text_proto_str( + 'type:{message_type:"google.protobuf.Any"}' + ) == CELType(value="google.protobuf.Any") + + +def test_type_repr() -> None: + assert repr(CELType("type")) == "celpy.celtypes.TypeType" + assert repr(CELType("bool")) == "celpy.celtypes.BoolType" + assert repr(CELType("bytes")) == "celpy.celtypes.BytesType" + assert repr(CELType("double")) == "celpy.celtypes.DoubleType" + assert repr(CELType("int")) == "celpy.celtypes.IntType" + assert repr(CELType("list")) == "celpy.celtypes.ListType" + assert repr(CELType("list_type")) == "celpy.celtypes.ListType" + assert repr(CELType("map")) == "celpy.celtypes.MapType" + assert repr(CELType("map_type")) == "celpy.celtypes.MapType" + assert repr(CELType("null_type")) == "NoneType" + assert repr(CELType("string")) == "celpy.celtypes.StringType" + assert repr(CELType("uint")) == "celpy.celtypes.UintType" diff --git a/tools/test_pb2g.py b/tools/test_pb2g.py deleted file mode 100644 index 84943b8..0000000 --- a/tools/test_pb2g.py +++ /dev/null @@ -1,2310 +0,0 @@ -# SPDX-Copyright: Copyright (c) Capital One Services, LLC -# SPDX-License-Identifier: Apache-2.0 -# Copyright 2020 Capital One Services, LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and limitations under the License. - -""" -Test translation of the pb2g tool to convert textproto to Gherkin.. -""" -from textwrap import dedent - -import pytest - -import pb2g -from pb2g import * - - -def test_doctest(): - import doctest - doctest.run_docstring_examples(Tokens, globals()) - doctest.run_docstring_examples(detokenize, globals()) - doctest.run_docstring_examples(bytes_detokenize, globals()) - doctest.run_docstring_examples(parse_serialized_value, globals()) - - -def test_parsing_case(): - """ - A little tricky to write as a doctest. - The \\ rules for Python string literals make this potentially painful. - """ - t2 = Tokens(r'string_value:"\x07\x08\x0c\n\r\t\x0b\"' "'" r'\\"') - # print(f"Parsing Go &{{string_value:{t2.text}}}") - actual = list(t2) - parsed_value = (r'"\x07\x08\x0c\n\r\t\x0b\"' "'" r'\\"') - expected = [Token(type='NAME', value='string_value'), Token(type='PUNCTUATION', value=':'), Token(type='STRING', value=parsed_value)] - assert actual == expected, f"{actual!r} != \n{expected!r}" - - -def test_building_case(): - example_1 = """object_value:{[type.googleapis.com/google.protobuf.Value]:{struct_value:{fields:{key:"x" value:{null_value:NULL_VALUE}} fields:{key:"y" value:{bool_value:false}}}}} """ - s = structure_builder(parse_serialized_value(Tokens(example_1))) - expected = MessageType({'x': None, 'y': BoolType(source=False)}) - assert s == expected, f"{s!r} != {expected!r}" - - -def test_transform_given_type(capsys): - proto = dedent("""\ - section { - name: "variables" - description: "Variable lookups." - test { - name: "self_eval_bound_lookup" - expr: "x" - type_env: { - name: "x", - ident: { type: { primitive: INT64 } } - } - bindings: { - key: "x" - value: { value: { int64_value: 123 } } - } - value: { int64_value: 123 } - } - } - """ - ) - interim = dedent("""\ - Scenario: self_eval_bound_lookup - - Given type_env parameter "x" is &{type:{primitive:INT64}} - - Given bindings parameter "x" is int64_value:123 - - When CEL expression "x" is evaluated - Then value is int64_value:123 - """) - - expected = dedent("""\ - Scenario: self_eval_bound_lookup - - # type:{primitive:INT64} - Given type_env parameter "x" is celpy.celtypes.IntType - - # int64_value:123 - Given bindings parameter "x" is celpy.celtypes.IntType(source=123) - - When CEL expression "x" is evaluated - # int64_value:123 - Then value is celpy.celtypes.IntType(source=123) - """) - - pb2g.expand_cel(interim) - feature, errors = capsys.readouterr() - assert errors == "" - assert feature == expected - - -def test_transform_then_type(capsys): - proto = dedent("""\ - test { - name: "type_type" - expr: "type(type)" - value: { type_value: "type" } - } - """ - ) - interim = dedent("""\ - Scenario: type_type - - When CEL expression "type(type)" is evaluated - Then value is type_value:"type" - """) - - expected = dedent("""\ - Scenario: type_type - - When CEL expression "type(type)" is evaluated - # type_value:"type" - Then value is celpy.celtypes.TypeType - """) - - pb2g.expand_cel(interim) - feature, errors = capsys.readouterr() - assert errors == "" - assert feature == expected - - -def test_given_bindings(): - assert structure_builder(parse_serialized_value(Tokens('value:{int64_value:123}'))) == IntType(source=123) - assert structure_builder(parse_serialized_value(Tokens('value:{bool_value:true}'))) == BoolType(source=True) - assert structure_builder(parse_serialized_value(Tokens('value:{bool_value:false}'))) == BoolType( - source=False) - assert structure_builder(parse_serialized_value(Tokens('value:{bytes_value:"\\x00"}'))) == BytesType( - source=b'\x00') - assert structure_builder(parse_serialized_value(Tokens('value:{int64_value:124}'))) == IntType(source=124) - assert structure_builder(parse_serialized_value(Tokens('value:{double_value:9.8}'))) == DoubleType( - source=9.8) - assert structure_builder(parse_serialized_value(Tokens( - 'value:{map_value:{entries:{key:{string_value:"c"} value:{string_value:"d"}} entries:{key:{string_value:"a"} value:{string_value:"b"}}}}'))) == MapType( - {StringType(source='c'): StringType(source='d'), - StringType(source='a'): StringType(source='b')}) - assert structure_builder(parse_serialized_value(Tokens('value:{null_value:NULL_VALUE}'))) == None - assert structure_builder(parse_serialized_value( - Tokens('value:{list_value:{values:{int64_value:2} values:{int64_value:1}}}'))) == ListType( - [IntType(source=2), IntType(source=1)]) - assert structure_builder(parse_serialized_value(Tokens('value:{string_value:"abc"}'))) == StringType( - source='abc') - assert structure_builder(parse_serialized_value(Tokens('value:{uint64_value:1000}'))) == UintType( - source=1000) - assert structure_builder(parse_serialized_value(Tokens( - 'value:{object_value:{[type.googleapis.com/google.protobuf.Int32Value]:{value:2000000}}}'))) == IntType( - source=2000000) - assert structure_builder(parse_serialized_value(Tokens( - 'value:{object_value:{[type.googleapis.com/google.protobuf.Int64Value]:{value:2000000}}}'))) == IntType( - source=2000000) - assert structure_builder(parse_serialized_value(Tokens( - 'value:{object_value:{[type.googleapis.com/google.protobuf.UInt32Value]:{value:2000000}}}'))) == UintType( - source=2000000) - assert structure_builder(parse_serialized_value(Tokens( - 'value:{object_value:{[type.googleapis.com/google.protobuf.UInt64Value]:{value:2000000}}}'))) == UintType( - source=2000000) - assert structure_builder(parse_serialized_value(Tokens( - 'value:{object_value:{[type.googleapis.com/google.protobuf.FloatValue]:{value:-1.25e+06}}}'))) == DoubleType( - source=-1250000.0) - assert structure_builder(parse_serialized_value(Tokens( - 'value:{object_value:{[type.googleapis.com/google.protobuf.DoubleValue]:{value:-1.25e+06}}}'))) == DoubleType( - source=-1250000.0) - assert structure_builder(parse_serialized_value(Tokens( - 'value:{object_value:{[type.googleapis.com/google.protobuf.BoolValue]:{value:true}}}'))) == BoolType( - source=True) - assert structure_builder(parse_serialized_value(Tokens( - 'value:{object_value:{[type.googleapis.com/google.protobuf.StringValue]:{value:"bar"}}}'))) == StringType( - source='bar') - assert structure_builder(parse_serialized_value(Tokens( - 'value:{object_value:{[type.googleapis.com/google.protobuf.BytesValue]:{value:"bar"}}}'))) == BytesType( - source='bar') - assert structure_builder(parse_serialized_value(Tokens( - 'value:{object_value:{[type.googleapis.com/google.protobuf.ListValue]:{values:{string_value:"bar"} values:{list_value:{values:{string_value:"a"} values:{string_value:"b"}}}}}}'))) == ListType( - [StringType(source='bar'), - ListType([StringType(source='a'), StringType(source='b')])]) - assert structure_builder(parse_serialized_value(Tokens( - 'value:{object_value:{[type.googleapis.com/google.protobuf.Struct]:{fields:{key:"first" value:{string_value:"Abraham"}} fields:{key:"last" value:{string_value:"Lincoln"}}}}}'))) == MessageType( - {'first': StringType(source='Abraham'), 'last': StringType(source='Lincoln')}) - assert structure_builder(parse_serialized_value(Tokens( - 'value:{object_value:{[type.googleapis.com/google.protobuf.Value]:{null_value:NULL_VALUE}}}'))) == None - assert structure_builder(parse_serialized_value(Tokens( - 'value:{object_value:{[type.googleapis.com/google.protobuf.Value]:{number_value:-26.375}}}'))) == DoubleType( - source=-26.375) - assert structure_builder(parse_serialized_value(Tokens( - 'value:{object_value:{[type.googleapis.com/google.protobuf.Value]:{string_value:"bar"}}}'))) == StringType( - source='bar') - assert structure_builder(parse_serialized_value(Tokens( - 'value:{object_value:{[type.googleapis.com/google.protobuf.Value]:{bool_value:true}}}'))) == BoolType( - source=True) - assert structure_builder(parse_serialized_value(Tokens( - 'value:{object_value:{[type.googleapis.com/google.protobuf.Value]:{struct_value:{fields:{key:"x" value:{null_value:NULL_VALUE}} fields:{key:"y" value:{bool_value:false}}}}}}'))) == MessageType( - {'x': None, 'y': BoolType(source=False)}) - assert structure_builder(parse_serialized_value(Tokens( - 'value:{object_value:{[type.googleapis.com/google.protobuf.Value]:{list_value:{values:{number_value:1} values:{bool_value:true} values:{string_value:"hi"}}}}}'))) == ListType( - [DoubleType(source=1), BoolType(source=True), StringType(source='hi')]) - assert structure_builder(parse_serialized_value(Tokens( - 'value:{object_value:{[type.googleapis.com/google.protobuf.Any]:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int32:150}}}}'))) == TestAllTypes( - single_int32=150, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'value:{map_value:{entries:{key:{string_value:"name"} value:{int64_value:1024}}}}'))) == MapType( - {StringType(source='name'): IntType(source=1024)}) - assert structure_builder(parse_serialized_value(Tokens( - 'value:{map_value:{entries:{key:{string_value:"holiday"} value:{string_value:"field"}}}}'))) == MapType( - {StringType(source='holiday'): StringType(source='field')}) - assert structure_builder(parse_serialized_value(Tokens('value:{string_value:"yeah"}'))) == StringType( - source='yeah') - assert structure_builder(parse_serialized_value(Tokens( - 'value:{map_value:{entries:{key:{string_value:"c"} value:{string_value:"yeah"}}}}'))) == MapType( - {StringType(source='c'): StringType(source='yeah')}) - assert structure_builder(parse_serialized_value(Tokens( - 'value:{map_value:{entries:{key:{string_value:"c"} value:{string_value:"oops"}}}}'))) == MapType( - {StringType(source='c'): StringType(source='oops')}) - assert structure_builder( - parse_serialized_value(Tokens('value:{list_value:{values:{string_value:"pancakes"}}}'))) == ListType( - [StringType(source='pancakes')]) - assert structure_builder(parse_serialized_value(Tokens('value:{int64_value:15}'))) == IntType(source=15) - assert structure_builder(parse_serialized_value(Tokens('value:{string_value:"false"}'))) == StringType( - source='false') - assert structure_builder( - parse_serialized_value(Tokens('value:{list_value:{values:{int64_value:0}}}'))) == ListType( - [IntType(source=0)]) - assert structure_builder(parse_serialized_value(Tokens('value:{int64_value:17}'))) == IntType(source=17) - assert structure_builder(parse_serialized_value(Tokens( - 'value:{object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int32:17}}}'))) == TestAllTypes( - single_int32=17, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'value:{object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int64:-99}}}'))) == TestAllTypes( - single_int32=0, single_int64=-99, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'value:{object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_int32:17}}}'))) == TestAllTypes( - single_int32=17, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'value:{object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_int64:-99}}}'))) == TestAllTypes( - single_int32=0, single_int64=-99, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'value:{object_value:{[type.googleapis.com/google.protobuf.Duration]:{seconds:123 nanos:123456789}}}'))) == DurationType( - seconds=123, nanos=123456789) - - -@pytest.fixture -def exception_equal(monkeypatch): - def args_eq(exc1, exc2): - return type(exc1) == type(exc2) and exc1.args == exc2.args - - monkeypatch.setattr(pb2g.CELEvalError, '__eq__', args_eq) - -def test_parsing_primitives(): - assert (parse_serialized_value(Tokens('int64_value:0'))) == Primitive(type_name=Token(type='NAME', value='int64_value'), value_text=Token(type='INT', value='0')) - assert (parse_serialized_value(Tokens('uint64_value:0'))) == Primitive(type_name=Token(type='NAME', value='uint64_value'), value_text=Token(type='INT', value='0')) - assert (parse_serialized_value(Tokens('double_value:0'))) == Primitive(type_name=Token(type='NAME', value='double_value'), value_text=Token(type='INT', value='0')) - assert (parse_serialized_value(Tokens('string_value:""'))) == Primitive(type_name=Token(type='NAME', value='string_value'), value_text=Token(type='STRING', value='""')) - assert (parse_serialized_value(Tokens('bytes_value:""'))) == Primitive(type_name=Token(type='NAME', value='bytes_value'), value_text=Token(type='STRING', value='""')) - assert (parse_serialized_value(Tokens('bool_value:false'))) == Primitive(type_name=Token(type='NAME', value='bool_value'), value_text=Token(type='BOOL', value='false')) - assert (parse_serialized_value(Tokens('null_value:NULL_VALUE'))) == Primitive(type_name=Token(type='NAME', value='null_value'), value_text=Token(type='NULL', value='NULL_VALUE')) - -def test_then_values(exception_equal): - assert structure_builder(parse_serialized_value(Tokens('int64_value:0'))) == IntType(source=0) - assert structure_builder(parse_serialized_value(Tokens('uint64_value:0'))) == UintType(source=0) - assert structure_builder(parse_serialized_value(Tokens('double_value:0'))) == DoubleType(source=0) - assert structure_builder(parse_serialized_value(Tokens('string_value:""'))) == StringType(source='') - assert structure_builder(parse_serialized_value(Tokens('bytes_value:""'))) == BytesType(source=b'') - assert structure_builder(parse_serialized_value(Tokens('bool_value:false'))) == BoolType(source=False) - assert structure_builder(parse_serialized_value(Tokens('null_value:NULL_VALUE'))) == None - assert structure_builder(parse_serialized_value(Tokens('list_value:{}'))) == ListType([]) - assert structure_builder(parse_serialized_value(Tokens('map_value:{}'))) == MapType({}) - assert structure_builder(parse_serialized_value(Tokens('int64_value:42'))) == IntType(source=42) - assert structure_builder(parse_serialized_value(Tokens('uint64_value:123456789'))) == UintType( - source=123456789) - assert structure_builder(parse_serialized_value(Tokens('int64_value:-9223372036854775808'))) == IntType( - source=-9223372036854775808) - assert structure_builder(parse_serialized_value(Tokens('double_value:-23'))) == DoubleType(source=-23) - assert structure_builder(parse_serialized_value(Tokens('string_value:"!"'))) == StringType(source='!') - assert structure_builder(parse_serialized_value(Tokens('string_value:"\'"'))) == StringType(source="'") - assert structure_builder(parse_serialized_value(Tokens('bytes_value:"ÿ"'))) == BytesType(source=b'\xc3\xbf') - assert structure_builder(parse_serialized_value(Tokens('bytes_value:"\\x00\\xff"'))) == BytesType( - source=b'\x00\xff') - assert structure_builder(parse_serialized_value(Tokens('list_value:{values:{int64_value:-1}}'))) == ListType( - [IntType(source=-1)]) - assert structure_builder(parse_serialized_value(Tokens( - 'map_value:{entries:{key:{string_value:"k"} value:{string_value:"v"}}}'))) == MapType( - {StringType(source='k'): StringType(source='v')}) - assert structure_builder(parse_serialized_value(Tokens('bool_value:true'))) == BoolType(source=True) - assert structure_builder(parse_serialized_value(Tokens('int64_value:1431655765'))) == IntType( - source=1431655765) - assert structure_builder(parse_serialized_value(Tokens('int64_value:-1431655765'))) == IntType( - source=-1431655765) - assert structure_builder(parse_serialized_value(Tokens('uint64_value:1431655765'))) == UintType( - source=1431655765) - assert structure_builder(parse_serialized_value(Tokens('string_value:"✌"'))) == StringType(source='✌') - assert structure_builder(parse_serialized_value(Tokens('string_value:"🐱"'))) == StringType(source='🐱') - assert structure_builder( - parse_serialized_value(Tokens('string_value:"\\x07\\x08\\x0c\\n\\r\\t\\x0b\\"\'\\\\"'))) == StringType( - source='\x07\x08\x0c\n\r\t\x0b"\'\\') - assert structure_builder(parse_serialized_value(Tokens('int64_value:123'))) == IntType(source=123) - assert structure_builder(parse_serialized_value(Tokens( - 'errors:{message:"undeclared reference to \'x\' (in container \'\')"}'))) == CELEvalError( - "undeclared reference to 'x' (in container '')") - assert structure_builder(parse_serialized_value(Tokens('int64_value:2'))) == IntType(source=2) - assert structure_builder( - parse_serialized_value(Tokens('errors:{message:"unbound function"}'))) == CELEvalError( - 'unbound function') - assert structure_builder( - parse_serialized_value(Tokens('errors:{message:"no such overload"}'))) == CELEvalError( - 'no such overload') - assert structure_builder(parse_serialized_value(Tokens('bytes_value:"abc"'))) == BytesType(source=b'abc') - assert structure_builder(parse_serialized_value(Tokens('double_value:1e+12'))) == DoubleType( - source=1000000000000.0) - assert structure_builder(parse_serialized_value(Tokens('double_value:-1e+15'))) == DoubleType( - source=-1000000000000000.0) - assert structure_builder(parse_serialized_value(Tokens('double_value:9.223372036854776e+18'))) == DoubleType( - source=9.223372036854776e+18) - assert structure_builder(parse_serialized_value(Tokens('double_value:123'))) == DoubleType(source=123) - assert structure_builder( - parse_serialized_value(Tokens('double_value:1.8446744073709552e+19'))) == DoubleType( - source=1.8446744073709552e+19) - assert structure_builder(parse_serialized_value(Tokens('double_value:-0'))) == DoubleType(source=0) - assert structure_builder(parse_serialized_value(Tokens('double_value:123.456'))) == DoubleType( - source=123.456) - assert structure_builder(parse_serialized_value(Tokens('double_value:-987.654'))) == DoubleType( - source=-987.654) - assert structure_builder(parse_serialized_value(Tokens('double_value:6.02214e+23'))) == DoubleType( - source=6.02214e+23) - assert structure_builder(parse_serialized_value(Tokens('double_value:1.38e-23'))) == DoubleType( - source=1.38e-23) - assert structure_builder(parse_serialized_value(Tokens('double_value:-8.432e+08'))) == DoubleType( - source=-843200000.0) - assert structure_builder(parse_serialized_value(Tokens('double_value:-5.43e-21'))) == DoubleType( - source=-5.43e-21) - assert structure_builder(parse_serialized_value(Tokens('type_value:"list"'))) == type_value(value='list') - assert structure_builder(parse_serialized_value(Tokens('errors:{message:"range error"}'))) == CELEvalError( - 'range error') - assert structure_builder(parse_serialized_value(Tokens('int64_value:-123'))) == IntType(source=-123) - assert structure_builder(parse_serialized_value(Tokens('int64_value:-8'))) == IntType(source=-8) - assert structure_builder(parse_serialized_value(Tokens('int64_value:12'))) == IntType(source=12) - assert structure_builder(parse_serialized_value(Tokens('int64_value:-4'))) == IntType(source=-4) - assert structure_builder(parse_serialized_value(Tokens('errors:{message:"range"}'))) == CELEvalError( - 'range') - assert structure_builder(parse_serialized_value(Tokens('int64_value:987'))) == IntType(source=987) - assert structure_builder(parse_serialized_value(Tokens('int64_value:1095379199'))) == IntType( - source=1095379199) - assert structure_builder(parse_serialized_value(Tokens('string_value:"123"'))) == StringType(source='123') - assert structure_builder(parse_serialized_value(Tokens('string_value:"-456"'))) == StringType(source='-456') - assert structure_builder(parse_serialized_value(Tokens('string_value:"9876"'))) == StringType(source='9876') - assert structure_builder(parse_serialized_value(Tokens('string_value:"123.456"'))) == StringType( - source='123.456') - assert structure_builder(parse_serialized_value(Tokens('string_value:"-0.0045"'))) == StringType( - source='-0.0045') - assert structure_builder(parse_serialized_value(Tokens('string_value:"abc"'))) == StringType(source='abc') - assert structure_builder(parse_serialized_value(Tokens('string_value:"ÿ"'))) == StringType(source='ÿ') - assert structure_builder(parse_serialized_value(Tokens('errors:{message:"invalid UTF-8"}'))) == CELEvalError( - 'invalid UTF-8') - assert structure_builder(parse_serialized_value(Tokens('type_value:"bool"'))) == type_value(value='bool') - assert structure_builder( - parse_serialized_value(Tokens('errors:{message:"unknown varaible"}'))) == CELEvalError( - 'unknown varaible') - assert structure_builder(parse_serialized_value(Tokens('type_value:"int"'))) == type_value(value='int') - assert structure_builder(parse_serialized_value(Tokens('type_value:"uint"'))) == type_value(value='uint') - assert structure_builder(parse_serialized_value(Tokens('type_value:"double"'))) == type_value(value='double') - assert structure_builder(parse_serialized_value(Tokens('type_value:"null_type"'))) == type_value( - value='null_type') - assert structure_builder(parse_serialized_value(Tokens('type_value:"string"'))) == type_value(value='string') - assert structure_builder(parse_serialized_value(Tokens('type_value:"bytes"'))) == type_value(value='bytes') - assert structure_builder(parse_serialized_value(Tokens('type_value:"map"'))) == type_value(value='map') - assert structure_builder(parse_serialized_value(Tokens('type_value:"type"'))) == type_value(value='type') - assert structure_builder(parse_serialized_value(Tokens('uint64_value:1729'))) == UintType(source=1729) - assert structure_builder(parse_serialized_value(Tokens('uint64_value:3'))) == UintType(source=3) - assert structure_builder(parse_serialized_value(Tokens('uint64_value:2'))) == UintType(source=2) - assert structure_builder(parse_serialized_value(Tokens('uint64_value:26'))) == UintType(source=26) - assert structure_builder(parse_serialized_value(Tokens('uint64_value:300'))) == UintType(source=300) - assert structure_builder( - parse_serialized_value(Tokens('errors:{message:"no_matching_overload"}'))) == CELEvalError( - 'no_matching_overload') - assert structure_builder(parse_serialized_value(Tokens('int64_value:2000000'))) == IntType(source=2000000) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int32_wrapper:{value:432}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=432, - single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int32_wrapper:{}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=None, - single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens('int64_value:642'))) == IntType(source=642) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_int32_wrapper:{value:-975}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=-975, - single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_int32_wrapper:{}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=None, - single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int64_wrapper:{value:432}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=432, single_int32_wrapper=IntType(source=0), - single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int64_wrapper:{}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=None, single_int32_wrapper=IntType(source=0), - single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_int64_wrapper:{value:-975}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=-975, single_int32_wrapper=IntType(source=0), - single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_int64_wrapper:{}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=None, single_int32_wrapper=IntType(source=0), - single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens('uint64_value:123'))) == UintType(source=123) - assert structure_builder(parse_serialized_value(Tokens('uint64_value:2000000'))) == UintType(source=2000000) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_uint32_wrapper:{value:432}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=432, single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_uint32_wrapper:{}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=None, single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_uint32_wrapper:{value:975}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=975, single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_uint32_wrapper:{}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=None, single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens('uint64_value:258'))) == UintType(source=258) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_uint64_wrapper:{value:432}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=432, - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_uint64_wrapper:{}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=None, - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_uint64_wrapper:{value:975}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=975, - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_uint64_wrapper:{}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=None, - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens('uint64_value:5123123123'))) == UintType( - source=5123123123) - assert structure_builder(parse_serialized_value(Tokens('double_value:-1500'))) == DoubleType(source=-1500) - assert structure_builder(parse_serialized_value(Tokens('double_value:-1.25e+06'))) == DoubleType( - source=-1250000.0) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_float_wrapper:{value:86.75}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=86.75, single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_float_wrapper:{}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=None, single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens('double_value:-12.375'))) == DoubleType( - source=-12.375) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_float_wrapper:{value:-9.75}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=-9.75, single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_float_wrapper:{}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=None, single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens('double_value:64.25'))) == DoubleType(source=64.25) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_double_wrapper:{value:86.75}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=86.75, - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_double_wrapper:{}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=None, - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_double_wrapper:{value:1.4e+55}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=1.4e+55, - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_double_wrapper:{value:-9.75}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=-9.75, - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_double_wrapper:{}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=None, - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_double_wrapper:{value:-9.9e-100}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=-9.9e-100, - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_bool_wrapper:{value:true}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=True, single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_bool_wrapper:{}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=None, single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_bool_wrapper:{value:true}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=True, single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_bool_wrapper:{}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=None, single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens('string_value:"foo"'))) == StringType(source='foo') - assert structure_builder(parse_serialized_value(Tokens('string_value:"flambé"'))) == StringType( - source='flambé') - assert structure_builder(parse_serialized_value(Tokens('string_value:"bar"'))) == StringType(source='bar') - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_string_wrapper:{value:"baz"}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper='baz', - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_string_wrapper:{}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=None, - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_string_wrapper:{value:"bletch"}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper='bletch', - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_string_wrapper:{}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=None, - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens('bytes_value:"fooS"'))) == BytesType(source=b'fooS') - assert structure_builder(parse_serialized_value(Tokens('bytes_value:"flambé"'))) == BytesType( - source=b'flamb\xc3\xa9') - assert structure_builder(parse_serialized_value(Tokens('bytes_value:"bar"'))) == BytesType(source=b'bar') - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_bytes_wrapper:{value:"baz"}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper='baz', - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_bytes_wrapper:{}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=None, - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_bytes_wrapper:{value:"bletch"}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper='bletch', - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_bytes_wrapper:{}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=None, - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'list_value:{values:{double_value:3} values:{string_value:"foo"} values:{null_value:NULL_VALUE}}'))) == ListType( - [DoubleType(source=3), StringType(source='foo'), None]) - assert structure_builder(parse_serialized_value(Tokens( - 'list_value:{values:{string_value:"bar"} values:{list_value:{values:{string_value:"a"} values:{string_value:"b"}}}}'))) == ListType( - [ - StringType(source='bar'), - ListType([StringType(source='a'), StringType(source='b')]) - ]) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{list_value:{values:{number_value:1} values:{string_value:"one"}}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=[DoubleType(source=1), StringType(source='one')]) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{list_value:{}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=None) - assert structure_builder(parse_serialized_value( - Tokens('list_value:{values:{double_value:1} values:{string_value:"one"}}'))) == ListType( - [DoubleType(source=1), StringType(source='one')]) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{list_value:{values:{number_value:1} values:{string_value:"one"}}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=[DoubleType(source=1), StringType(source='one')]) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{list_value:{}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=None) - assert structure_builder(parse_serialized_value(Tokens( - 'map_value:{entries:{key:{string_value:"uno"} value:{double_value:1}} entries:{key:{string_value:"dos"} value:{double_value:2}}}'))) == MapType( - {StringType(source='uno'): DoubleType(source=1), - StringType(source='dos'): DoubleType(source=2)}) - assert structure_builder(parse_serialized_value(Tokens( - 'map_value:{entries:{key:{string_value:"first"} value:{string_value:"Abraham"}} entries:{key:{string_value:"last"} value:{string_value:"Lincoln"}}}'))) == MapType( - {StringType(source='first'): StringType(source='Abraham'), - StringType(source='last'): StringType(source='Lincoln')}) - -def test_then_values_2(exception_equal): - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_struct:{fields:{key:"deux" value:{number_value:2}} fields:{key:"un" value:{number_value:1}}}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, - single_struct={"deux": DoubleType(2), "un": DoubleType(1)}, - single_value=None, - single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), - single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_struct:{}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct=None, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens('errors:{message:"bad key type"}'))) == CELEvalError( - 'bad key type') - assert structure_builder(parse_serialized_value(Tokens( - 'map_value:{entries:{key:{string_value:"one"} value:{double_value:1}}}'))) == MapType( - {StringType(source='one'): DoubleType(source=1)}) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_struct:{fields:{key:"deux" value:{number_value:2}} fields:{key:"un" value:{number_value:1}}}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, - single_struct={"deux": DoubleType(2), "un": DoubleType(1)}, - single_value=None, - single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), - single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_struct:{}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct=None, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_value:{null_value:NULL_VALUE}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_value:{null_value:NULL_VALUE}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens('double_value:12.5'))) == DoubleType(source=12.5) - assert structure_builder(parse_serialized_value(Tokens('double_value:-26.375'))) == DoubleType( - source=-26.375) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_value:{number_value:7e+23}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=DoubleType(source=7e+23), single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_value:{number_value:0}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=DoubleType(source=0), single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens('double_value:7e+23'))) == DoubleType(source=7e+23) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_value:{number_value:7e+23}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=DoubleType(source=7e+23), single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_value:{number_value:0}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=DoubleType(source=0), single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_value:{string_value:"baz"}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=StringType(source='baz'), single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_value:{string_value:""}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=StringType(source=''), single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens('string_value:"bletch"'))) == StringType( - source='bletch') - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_value:{string_value:"baz"}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=StringType(source='baz'), single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_value:{string_value:""}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=StringType(source=''), single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_value:{bool_value:true}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=BoolType(source=True), single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_value:{bool_value:false}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=BoolType(source=False), single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_value:{bool_value:true}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=BoolType(source=True), single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_value:{bool_value:false}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=BoolType(source=False), single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'map_value:{entries:{key:{string_value:"a"} value:{double_value:1}} entries:{key:{string_value:"b"} value:{string_value:"two"}}}'))) == MapType( - { - StringType(source='a'): DoubleType(source=1), - StringType(source='b'): StringType(source='two')}) - assert structure_builder(parse_serialized_value(Tokens( - 'map_value:{entries:{key:{string_value:"x"} value:{null_value:NULL_VALUE}} entries:{key:{string_value:"y"} value:{bool_value:false}}}'))) == MapType( - {StringType(source='x'): None, StringType(source='y'): BoolType(source=False)}) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_value:{struct_value:{fields:{key:"deux" value:{number_value:2}} fields:{key:"un" value:{number_value:1}}}}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value= - MessageType({'deux': DoubleType(source=2), 'un': DoubleType(source=1)}), - single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), - single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_value:{struct_value:{}}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=MessageType({}), single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value( - Tokens('map_value:{entries:{key:{string_value:"i"} value:{bool_value:true}}}'))) == MapType( - {StringType(source='i'): BoolType(source=True)}) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_value:{struct_value:{fields:{key:"deux" value:{number_value:2}} fields:{key:"un" value:{number_value:1}}}}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value= - MessageType({'deux': DoubleType(source=2), 'un': DoubleType(source=1)}), - single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), - single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_value:{struct_value:{}}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=MessageType({}), single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value( - Tokens('list_value:{values:{string_value:"a"} values:{double_value:3}}'))) == ListType( - [StringType(source='a'), DoubleType(source=3)]) - assert structure_builder(parse_serialized_value(Tokens( - 'list_value:{values:{double_value:1} values:{bool_value:true} values:{string_value:"hi"}}'))) == ListType( - [DoubleType(source=1), BoolType(source=True), StringType(source='hi')]) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_value:{list_value:{values:{string_value:"un"} values:{number_value:1}}}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=ListType([StringType(source='un'), DoubleType(source=1)]), - single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), - single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_value:{list_value:{}}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=ListType([]), single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value( - Tokens('list_value:{values:{string_value:"i"} values:{bool_value:true}}'))) == ListType( - [StringType(source='i'), BoolType(source=True)]) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_value:{list_value:{values:{string_value:"un"} values:{number_value:1}}}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=ListType([StringType(source='un'), DoubleType(source=1)]), - single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), - single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_value:{list_value:{}}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=ListType([]), single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int32:150}}'))) == TestAllTypes( - single_int32=150, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens('errors:{message:"conversion"}'))) == CELEvalError( - 'conversion') - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_any:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int32:150}}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=TestAllTypes(single_int32=150, single_int64=0, single_uint32=0, single_uint64=0, - single_sint32=0, single_sint64=0, single_fixed32=0, - single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', - single_bytes=b'', single_any=None, single_duration=None, - single_timestamp=None, single_struct={}, single_value=None, - single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), - single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])), single_duration=None, - single_timestamp=None, single_struct={}, single_value=None, - single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), - single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_any:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_int32:150}}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=TestAllTypes(single_int32=150, single_int64=0, single_uint32=0, single_uint64=0, - single_sint32=0, single_sint64=0, single_fixed32=0, - single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', - single_bytes=b'', single_any=None, single_duration=None, - single_timestamp=None, single_struct={}, single_value=None, - single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), - single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])), single_duration=None, - single_timestamp=None, single_struct={}, single_value=None, - single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), - single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_int32:150}}'))) == TestAllTypes( - single_int32=150, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'list_value:{values:{map_value:{entries:{key:{string_value:"almost"} value:{string_value:"done"}}}}}'))) == ListType( - [MapType({StringType(source='almost'): StringType(source='done')})]) - assert structure_builder(parse_serialized_value(Tokens('string_value:"happy"'))) == StringType( - source='happy') - assert structure_builder(parse_serialized_value(Tokens('uint64_value:100'))) == UintType(source=100) - assert structure_builder(parse_serialized_value(Tokens('int64_value:5'))) == IntType(source=5) - assert structure_builder(parse_serialized_value(Tokens('int64_value:1'))) == IntType(source=1) - assert structure_builder(parse_serialized_value(Tokens('int64_value:1024'))) == IntType(source=1024) - assert structure_builder(parse_serialized_value(Tokens('errors:{message:"no such key"}'))) == CELEvalError( - 'no such key') - assert structure_builder( - parse_serialized_value(Tokens('errors:{message:"no such key: \'name\'"}'))) == CELEvalError( - "no such key: 'name'") - assert structure_builder(parse_serialized_value(Tokens('string_value:"x"'))) == StringType(source='x') - assert structure_builder(parse_serialized_value(Tokens('double_value:15.15'))) == DoubleType(source=15.15) - assert structure_builder(parse_serialized_value(Tokens('uint64_value:1'))) == UintType(source=1) - assert structure_builder(parse_serialized_value(Tokens('list_value:{values:{int64_value:1}}'))) == ListType( - [IntType(source=1)]) - assert structure_builder(parse_serialized_value(Tokens('string_value:"yeah"'))) == StringType(source='yeah') - assert structure_builder(parse_serialized_value(Tokens( - 'errors:{message:"type \'list_type: > \' does not support field selection"}'))) == CELEvalError( - "type 'list_type: > ' does not support field selection") - assert structure_builder(parse_serialized_value(Tokens( - 'errors:{message:"type \'int64_type\' does not support field selection"}'))) == CELEvalError( - "type 'int64_type' does not support field selection") - assert structure_builder( - parse_serialized_value(Tokens('errors:{message:"unsupported key type"}'))) == CELEvalError( - 'unsupported key type') - assert structure_builder( - parse_serialized_value(Tokens('errors:{message:"Failed with repeated key"}'))) == CELEvalError( - 'Failed with repeated key') - assert structure_builder(parse_serialized_value(Tokens('double_value:19.5'))) == DoubleType(source=19.5) - assert structure_builder(parse_serialized_value(Tokens('double_value:10'))) == DoubleType(source=10) - assert structure_builder(parse_serialized_value(Tokens('double_value:-6.25'))) == DoubleType(source=-6.25) - assert structure_builder(parse_serialized_value(Tokens('double_value:30'))) == DoubleType(source=30) - assert structure_builder(parse_serialized_value(Tokens('double_value:64.875'))) == DoubleType(source=64.875) - assert structure_builder(parse_serialized_value(Tokens('double_value:-4.75'))) == DoubleType(source=-4.75) - assert structure_builder(parse_serialized_value(Tokens('double_value:8.5'))) == DoubleType(source=8.5) - assert structure_builder(parse_serialized_value(Tokens('double_value:-91.6875'))) == DoubleType( - source=-91.6875) - assert structure_builder(parse_serialized_value(Tokens('double_value:7.5'))) == DoubleType(source=7.5) - assert structure_builder(parse_serialized_value(Tokens('double_value:31.25'))) == DoubleType(source=31.25) - assert structure_builder(parse_serialized_value(Tokens('double_value:-1'))) == DoubleType(source=-1) - assert structure_builder(parse_serialized_value(Tokens('double_value:142'))) == DoubleType(source=142) - assert structure_builder(parse_serialized_value(Tokens( - 'errors:{message:"found no matching overload for \'_%_\' applied to \'(double, double)\'"}'))) == CELEvalError( - "found no matching overload for '_%_' applied to '(double, double)'") - assert structure_builder(parse_serialized_value(Tokens('double_value:-4.5'))) == DoubleType(source=-4.5) - assert structure_builder(parse_serialized_value(Tokens('double_value:1.25'))) == DoubleType(source=1.25) - assert structure_builder(parse_serialized_value(Tokens('double_value:inf'))) == DoubleType( - source=float("inf")) - assert structure_builder(parse_serialized_value(Tokens('double_value:1.75'))) == DoubleType(source=1.75) - assert structure_builder(parse_serialized_value(Tokens('double_value:2.5'))) == DoubleType(source=2.5) - assert structure_builder(parse_serialized_value(Tokens('double_value:45.25'))) == DoubleType(source=45.25) - assert structure_builder(parse_serialized_value(Tokens('double_value:-25.25'))) == DoubleType(source=-25.25) - assert structure_builder(parse_serialized_value(Tokens('double_value:-inf'))) == DoubleType( - source=float("-inf")) - assert structure_builder(parse_serialized_value(Tokens('int64_value:35'))) == IntType(source=35) - assert structure_builder(parse_serialized_value(Tokens('int64_value:-6'))) == IntType(source=-6) - assert structure_builder(parse_serialized_value(Tokens('int64_value:30'))) == IntType(source=30) - assert structure_builder(parse_serialized_value(Tokens('int64_value:64'))) == IntType(source=64) - assert structure_builder(parse_serialized_value(Tokens('int64_value:-30'))) == IntType(source=-30) - assert structure_builder(parse_serialized_value(Tokens('int64_value:84'))) == IntType(source=84) - assert structure_builder(parse_serialized_value(Tokens('int64_value:-80'))) == IntType(source=-80) - assert structure_builder(parse_serialized_value(Tokens('int64_value:60'))) == IntType(source=60) - assert structure_builder(parse_serialized_value(Tokens('int64_value:21'))) == IntType(source=21) - assert structure_builder(parse_serialized_value(Tokens('int64_value:-10'))) == IntType(source=-10) - assert structure_builder(parse_serialized_value(Tokens('int64_value:40'))) == IntType(source=40) - assert structure_builder(parse_serialized_value(Tokens('int64_value:3'))) == IntType(source=3) - assert structure_builder(parse_serialized_value(Tokens('int64_value:-2'))) == IntType(source=-2) - assert structure_builder(parse_serialized_value(Tokens('int64_value:-3'))) == IntType(source=-3) - assert structure_builder(parse_serialized_value(Tokens('int64_value:-42'))) == IntType(source=-42) - assert structure_builder( - parse_serialized_value(Tokens('errors:{message:"no_such_overload"}'))) == CELEvalError( - 'no_such_overload') - assert structure_builder( - parse_serialized_value(Tokens('errors:{message:"modulus by zero"}'))) == CELEvalError( - 'modulus by zero') - assert structure_builder( - parse_serialized_value(Tokens('errors:{message:"divide by zero"}'))) == CELEvalError( - 'divide by zero') - assert structure_builder(parse_serialized_value(Tokens('int64_value:17'))) == IntType(source=17) - assert structure_builder(parse_serialized_value(Tokens('int64_value:29'))) == IntType(source=29) - assert structure_builder(parse_serialized_value(Tokens('int64_value:45'))) == IntType(source=45) - assert structure_builder(parse_serialized_value(Tokens('int64_value:-25'))) == IntType(source=-25) - assert structure_builder( - parse_serialized_value(Tokens('errors:{message:"return error for overflow"}'))) == CELEvalError( - 'return error for overflow') - assert structure_builder(parse_serialized_value(Tokens('uint64_value:44'))) == UintType(source=44) - assert structure_builder(parse_serialized_value(Tokens('uint64_value:30'))) == UintType(source=30) - assert structure_builder(parse_serialized_value(Tokens('uint64_value:80'))) == UintType(source=80) - assert structure_builder(parse_serialized_value(Tokens('uint64_value:17'))) == UintType(source=17) - assert structure_builder(parse_serialized_value(Tokens('uint64_value:29'))) == UintType(source=29) - assert structure_builder(parse_serialized_value(Tokens('uint64_value:45'))) == UintType(source=45) - assert structure_builder(parse_serialized_value(Tokens('uint64_value:25'))) == UintType(source=25) - assert structure_builder(parse_serialized_value( - Tokens('list_value:{values:{int64_value:2} values:{int64_value:2}}'))) == ListType( - [IntType(source=2), IntType(source=2)]) - assert structure_builder(parse_serialized_value( - Tokens('list_value:{values:{int64_value:3} values:{int64_value:4}}'))) == ListType( - [IntType(source=3), IntType(source=4)]) - assert structure_builder(parse_serialized_value( - Tokens('list_value:{values:{int64_value:1} values:{int64_value:2}}'))) == ListType( - [IntType(source=1), IntType(source=2)]) - assert structure_builder(parse_serialized_value(Tokens('int64_value:7'))) == IntType(source=7) - assert structure_builder(parse_serialized_value(Tokens('string_value:"Ringo"'))) == StringType( - source='Ringo') - assert structure_builder( - parse_serialized_value(Tokens('errors:{message:"invalid_argument"}'))) == CELEvalError( - 'invalid_argument') - assert structure_builder( - parse_serialized_value(Tokens('errors:{message:"division by zero"}'))) == CELEvalError( - 'division by zero') - assert structure_builder(parse_serialized_value(Tokens('string_value:"cows"'))) == StringType(source='cows') - assert structure_builder( - parse_serialized_value(Tokens('errors:{message:"no matching overload"}'))) == CELEvalError( - 'no matching overload') - assert structure_builder(parse_serialized_value(Tokens('list_value:{values:{int64_value:9}}'))) == ListType( - [IntType(source=9)]) - assert structure_builder(parse_serialized_value(Tokens( - 'list_value:{values:{int64_value:1} values:{int64_value:2} values:{int64_value:3}}'))) == ListType( - [IntType(source=1), IntType(source=2), IntType(source=3)]) - assert structure_builder(parse_serialized_value(Tokens('list_value:{values:{int64_value:2}}'))) == ListType( - [IntType(source=2)]) - assert structure_builder(parse_serialized_value( - Tokens('list_value:{values:{int64_value:1} values:{int64_value:3}}'))) == ListType( - [IntType(source=1), IntType(source=3)]) - assert structure_builder( - parse_serialized_value(Tokens('list_value:{values:{string_value:"signer"}}'))) == ListType( - [StringType(source='signer')]) - assert structure_builder(parse_serialized_value(Tokens('int64_value:4'))) == IntType(source=4) - assert structure_builder(parse_serialized_value(Tokens('int64_value:19'))) == IntType(source=19) - assert structure_builder(parse_serialized_value(Tokens('string_value:"seventeen"'))) == StringType( - source='seventeen') - assert structure_builder(parse_serialized_value(Tokens('errors:{message:"foo"}'))) == CELEvalError( - 'foo') - assert structure_builder(parse_serialized_value(Tokens( - 'map_value:{entries:{key:{string_value:"k"} value:{string_value:"v"}} entries:{key:{string_value:"k1"} value:{string_value:"v1"}}}'))) == MapType( - { - StringType(source='k'): StringType(source='v'), - StringType(source='k1'): StringType(source='v1')}) - assert structure_builder(parse_serialized_value(Tokens( - 'list_value:{values:{int64_value:17} values:{string_value:"pancakes"}}'))) == ListType( - [IntType(source=17), StringType(source='pancakes')]) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int64:17}}'))) == TestAllTypes( - single_int32=0, single_int64=17, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int32:-34}}'))) == TestAllTypes( - single_int32=-34, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_uint32:1}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=1, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_uint64:9999}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=9999, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_sint32:-3}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=-3, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_sint64:255}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=255, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_fixed32:43}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=43, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_fixed64:1880}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=1880, single_sfixed32=0, - single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', - single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, - single_struct={}, single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_sfixed32:-404}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=-404, - single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', - single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, - single_struct={}, single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_sfixed64:-1}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=-1, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_float:3.1416}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=3.1416, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_double:6.022e+23}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=6.022e+23, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_bool:true}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=True, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_string:"foo"}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='foo', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_bytes:"\\xff"}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes='ÿ', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_any:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int32:1}}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=TestAllTypes(single_int32=1, single_int64=0, single_uint32=0, single_uint64=0, - single_sint32=0, single_sint64=0, single_fixed32=0, - single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', - single_bytes=b'', single_any=None, single_duration=None, - single_timestamp=None, single_struct={}, single_value=None, - single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), - single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])), single_duration=None, - single_timestamp=None, single_struct={}, single_value=None, - single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), - single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_duration:{seconds:123}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=123, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_timestamp:{seconds:1234567890}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=1234567890, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_struct:{fields:{key:"one" value:{number_value:1}} fields:{key:"two" value:{number_value:2}}}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, - single_struct={"two": DoubleType(2), "one": DoubleType(1)}, - single_value=None, - single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), - single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_value:{string_value:"foo"}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=StringType(source='foo'), single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int64_wrapper:{value:-321}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=-321, single_int32_wrapper=IntType(source=0), - single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_int32_wrapper:{value:-456}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=-456, - single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_double_wrapper:{value:2.71828}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=2.71828, - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_float_wrapper:{value:2.99792e+08}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=299792000.0, single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_uint64_wrapper:{value:8675309}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=8675309, - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_uint32_wrapper:{value:987}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=987, single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_string_wrapper:{value:"hubba"}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper='hubba', - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes]:{single_bytes_wrapper:{value:"\\xc1C"}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper='ÁC', - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens('int64_value:-99'))) == IntType(source=-99) - assert structure_builder(parse_serialized_value(Tokens('int64_value:-32'))) == IntType(source=-32) - # assert structure_builder(structure(Tokens('object_value:{[type.googleapis.com/google.api.expr.test.v1.proto2.TestAllTypes.NestedMessage]:{}}'))) == <__main__.NestedMessage object at 0x1a1acdc70> - assert structure_builder(parse_serialized_value(Tokens('errors:{message:"no_such_field"}'))) == CELEvalError( - 'no_such_field') - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_int64:17}}'))) == TestAllTypes( - single_int32=0, single_int64=17, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_int32:-34}}'))) == TestAllTypes( - single_int32=-34, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_uint32:1}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=1, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_uint64:9999}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=9999, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_sint32:-3}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=-3, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_sint64:255}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=255, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_fixed32:43}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=43, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_fixed64:1880}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=1880, single_sfixed32=0, - single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', - single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, - single_struct={}, single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_sfixed32:-404}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=-404, - single_sfixed64=0, single_float=0, single_double=0, single_bool=0, single_string='', - single_bytes=b'', single_any=None, single_duration=None, single_timestamp=None, - single_struct={}, single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_sfixed64:-1}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=-1, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_float:3.1416}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=3.1416, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_double:6.022e+23}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=6.022e+23, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_bool:true}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=True, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_string:"foo"}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='foo', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_bytes:"\\xff"}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes='ÿ', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_any:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_int32:1}}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=TestAllTypes(single_int32=1, single_int64=0, single_uint32=0, single_uint64=0, - single_sint32=0, single_sint64=0, single_fixed32=0, - single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', - single_bytes=b'', single_any=None, single_duration=None, - single_timestamp=None, single_struct={}, single_value=None, - single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), - single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])), single_duration=None, - single_timestamp=None, single_struct={}, single_value=None, - single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), - single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_duration:{seconds:123}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=123, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_timestamp:{seconds:1234567890}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=1234567890, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_struct:{fields:{key:"one" value:{number_value:1}} fields:{key:"two" value:{number_value:2}}}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, - single_struct={'one': DoubleType(source=1), 'two': DoubleType(source=2),}, - single_value=None, - single_int64_wrapper=IntType(source=0), single_int32_wrapper=IntType(source=0), - single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_value:{string_value:"foo"}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=StringType(source='foo'), single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_int64_wrapper:{value:-321}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=-321, single_int32_wrapper=IntType(source=0), - single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_int32_wrapper:{value:-456}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), single_int32_wrapper=-456, - single_double_wrapper=DoubleType(source=0), single_float_wrapper=DoubleType(source=0), - single_uint64_wrapper=UintType(source=0), single_uint32_wrapper=UintType(source=0), - single_string_wrapper=StringType(source=''), single_bool_wrapper=BoolType(source=False), - single_bytes_wrapper=BytesType(source=b''), list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_double_wrapper:{value:2.71828}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=2.71828, - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_float_wrapper:{value:2.99792e+08}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=299792000.0, single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_uint64_wrapper:{value:8675309}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=8675309, - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_uint32_wrapper:{value:987}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=987, single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_string_wrapper:{value:"hubba"}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper='hubba', - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper=BytesType(source=b''), - list_value=ListType([])) - assert structure_builder(parse_serialized_value(Tokens( - 'object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes]:{single_bytes_wrapper:{value:"\\xc1C"}}}'))) == TestAllTypes( - single_int32=0, single_int64=0, single_uint32=0, single_uint64=0, single_sint32=0, - single_sint64=0, single_fixed32=0, single_fixed64=0, single_sfixed32=0, single_sfixed64=0, - single_float=0, single_double=0, single_bool=0, single_string='', single_bytes=b'', - single_any=None, single_duration=None, single_timestamp=None, single_struct={}, - single_value=None, single_int64_wrapper=IntType(source=0), - single_int32_wrapper=IntType(source=0), single_double_wrapper=DoubleType(source=0), - single_float_wrapper=DoubleType(source=0), single_uint64_wrapper=UintType(source=0), - single_uint32_wrapper=UintType(source=0), single_string_wrapper=StringType(source=''), - single_bool_wrapper=BoolType(source=False), single_bytes_wrapper='ÁC', - list_value=ListType([])) - # assert structure_builder(structure(Tokens('object_value:{[type.googleapis.com/google.api.expr.test.v1.proto3.TestAllTypes.NestedMessage]:{}}'))) == <__main__.NestedMessage object at 0x1a1acd280> - assert structure_builder(parse_serialized_value(Tokens('string_value:"hello"'))) == StringType( - source='hello') - assert structure_builder(parse_serialized_value(Tokens('string_value:"¢ÿȀ"'))) == StringType(source='¢ÿȀ') - assert structure_builder(parse_serialized_value(Tokens('string_value:"rôle"'))) == StringType(source='rôle') - assert structure_builder(parse_serialized_value(Tokens('string_value:"Ω"'))) == StringType(source='Ω') - assert structure_builder(parse_serialized_value(Tokens('bytes_value:"abcdef"'))) == BytesType( - source=b'abcdef') - assert structure_builder(parse_serialized_value(Tokens('bytes_value:"\\xffoo"'))) == BytesType(source=b'\xffoo') - assert structure_builder(parse_serialized_value(Tokens('bytes_value:"zxy"'))) == BytesType(source=b'zxy') - assert structure_builder(parse_serialized_value(Tokens('int64_value:1234567890'))) == IntType( - source=1234567890) - assert structure_builder( - parse_serialized_value(Tokens('string_value:"2009-02-13T23:31:30Z"'))) == StringType( - source='2009-02-13T23:31:30Z') - assert structure_builder( - parse_serialized_value(Tokens('type_value:"google.protobuf.Timestamp"'))) == type_value( - value='google.protobuf.Timestamp') - assert structure_builder(parse_serialized_value(Tokens('string_value:"1000000s"'))) == StringType( - source='1000000s') - assert structure_builder( - parse_serialized_value(Tokens('type_value:"google.protobuf.Duration"'))) == type_value( - value='google.protobuf.Duration') - assert structure_builder(parse_serialized_value(Tokens('int64_value:13'))) == IntType(source=13) - assert structure_builder(parse_serialized_value(Tokens('int64_value:43'))) == IntType(source=43) - assert structure_builder(parse_serialized_value(Tokens('int64_value:2009'))) == IntType(source=2009) - assert structure_builder(parse_serialized_value(Tokens('int64_value:23'))) == IntType(source=23) - assert structure_builder(parse_serialized_value(Tokens('int64_value:31'))) == IntType(source=31) - assert structure_builder(parse_serialized_value(Tokens('int64_value:14'))) == IntType(source=14) - assert structure_builder(parse_serialized_value(Tokens('int64_value:11'))) == IntType(source=11) - assert structure_builder(parse_serialized_value(Tokens('int64_value:16'))) == IntType(source=16) - assert structure_builder(parse_serialized_value(Tokens('int64_value:123123'))) == IntType(source=123123) - assert structure_builder(parse_serialized_value(Tokens('int64_value:62'))) == IntType(source=62) - assert structure_builder(parse_serialized_value(Tokens('int64_value:3730'))) == IntType(source=3730) - -def test_type_env_values(): - assert structure_builder(parse_serialized_value(Tokens('type:{message_type:"google.protobuf.Int32Value"}'))) == type_value(value='google.protobuf.Int32Value') - assert structure_builder(parse_serialized_value(Tokens('type:{message_type:"google.protobuf.Int64Value"}'))) == type_value(value='google.protobuf.Int64Value') - assert structure_builder(parse_serialized_value(Tokens('type:{message_type:"google.protobuf.UInt32Value"}'))) == type_value(value='google.protobuf.UInt32Value') - assert structure_builder(parse_serialized_value(Tokens('type:{message_type:"google.protobuf.UInt64Value"}'))) == type_value(value='google.protobuf.UInt64Value') - assert structure_builder(parse_serialized_value(Tokens('type:{message_type:"google.protobuf.FloatValue"}'))) == type_value(value='google.protobuf.FloatValue') - assert structure_builder(parse_serialized_value(Tokens('type:{message_type:"google.protobuf.DoubleValue"}'))) == type_value(value='google.protobuf.DoubleValue') - assert structure_builder(parse_serialized_value(Tokens('type:{message_type:"google.protobuf.BoolValue"}'))) == type_value(value='google.protobuf.BoolValue') - assert structure_builder(parse_serialized_value(Tokens('type:{message_type:"google.protobuf.StringValue"}'))) == type_value(value='google.protobuf.StringValue') - assert structure_builder(parse_serialized_value(Tokens('type:{message_type:"google.protobuf.BytesValue"}'))) == type_value(value='google.protobuf.BytesValue') - assert structure_builder(parse_serialized_value(Tokens('type:{message_type:"google.protobuf.ListValue"}'))) == type_value(value='google.protobuf.ListValue') - assert structure_builder(parse_serialized_value(Tokens('type:{message_type:"google.protobuf.Struct"}'))) == type_value(value='google.protobuf.Struct') - assert structure_builder(parse_serialized_value(Tokens('type:{message_type:"google.protobuf.Value"}'))) == type_value(value='google.protobuf.Value') - assert structure_builder(parse_serialized_value(Tokens('type:{message_type:"google.protubuf.Any"}'))) == type_value(value='google.protubuf.Any') - -def test_type_repr(): - assert type_value("type").cel_name() == "celpy.celtypes.TypeType" - assert type_value("bool").cel_name() == "celpy.celtypes.BoolType" - assert type_value("bytes").cel_name() == "celpy.celtypes.BytesType" - assert type_value("double").cel_name() == "celpy.celtypes.DoubleType" - assert type_value("int").cel_name() == "celpy.celtypes.IntType" - assert type_value("list").cel_name() == "celpy.celtypes.ListType" - assert type_value("list_type").cel_name() == "celpy.celtypes.ListType" - assert type_value("map").cel_name() == "celpy.celtypes.MapType" - assert type_value("map_type").cel_name() == "celpy.celtypes.MapType" - assert type_value("null_type").cel_name() == "NoneType" - assert type_value("string").cel_name() == "celpy.celtypes.StringType" - assert type_value("uint").cel_name() == "celpy.celtypes.UintType" diff --git a/tools/wip.toml b/tools/wip.toml new file mode 100644 index 0000000..b2b0709 --- /dev/null +++ b/tools/wip.toml @@ -0,0 +1,1198 @@ +# The value for each scenario can be a string tag, an array of tags or a +# dictionary with a `tags` key containing an array of tags. For additional +# documentation, see the Config class in gherkinize.py. + +[bindings_ext.bind] +bind_nested = "@wip" +boolean_literal = "@wip" +macro_exists = "@wip" +macro_not_exists = "@wip" +string_concat = "@wip" + +[block_ext.basic] +adjacent_macros = "@wip" +call = "@wip" +inclusion_list = "@wip" +inclusion_map = "@wip" +int_add = "@wip" +macro_shadowed_variable_1 = "@wip" +macro_shadowed_variable_2 = "@wip" +map_index = "@wip" +multiple_macros_1 = "@wip" +multiple_macros_2 = "@wip" +multiple_macros_3 = "@wip" +nested_list_construction = "@wip" +nested_macros_1 = "@wip" +nested_macros_2 = "@wip" +nested_map_construction = "@wip" +nested_ternary = "@wip" +optional_list = "@wip" +optional_map = "@wip" +optional_map_chained = "@wip" +optional_message = "@wip" +presence_test = "@wip" +presence_test_2 = "@wip" +presence_test_with_ternary = "@wip" +presence_test_with_ternary_2 = "@wip" +presence_test_with_ternary_3 = "@wip" +presence_test_with_ternary_nested = "@wip" +select = "@wip" +select_nested_1 = "@wip" +select_nested_2 = "@wip" +select_nested_message_map_index_1 = "@wip" +select_nested_message_map_index_2 = "@wip" +size_1 = "@wip" +size_2 = "@wip" +size_3 = "@wip" +size_4 = "@wip" +ternary = "@wip" +timestamp = "@wip" + +[comparisons.eq_literal] +eq_double_int = "@wip" +eq_double_uint = "@wip" +eq_dyn_double_int = "@wip" +eq_dyn_double_uint = "@wip" +eq_dyn_int_double = "@wip" +eq_dyn_int_uint = "@wip" +eq_dyn_json_null = "@wip" +eq_dyn_uint_double = "@wip" +eq_dyn_uint_int = "@wip" +eq_int_double = "@wip" +eq_int_uint = "@wip" +eq_list_elem_mixed_types = "@wip" +eq_list_mixed_type_numbers = "@wip" +eq_map_mixed_type_numbers = "@wip" +eq_map_value_mixed_types = "@wip" +eq_mixed_types = "@wip" +eq_uint_double = "@wip" +eq_uint_int = "@wip" +not_eq_double_int = "@wip" +not_eq_double_nan = "@wip" +not_eq_double_uint = "@wip" +not_eq_dyn_double_int = "@wip" +not_eq_dyn_double_null = "@wip" +not_eq_dyn_double_uint = "@wip" +not_eq_dyn_int_double = "@wip" +not_eq_dyn_int_null = "@wip" +not_eq_dyn_int_uint = "@wip" +not_eq_dyn_list_null = "@wip" +not_eq_dyn_map_null = "@wip" +not_eq_dyn_timestamp_null = "@wip" +not_eq_dyn_uint_double = "@wip" +not_eq_dyn_uint_int = "@wip" +not_eq_int_double = "@wip" +not_eq_int_double_nan = "@wip" +not_eq_int_uint = "@wip" +not_eq_list_elem_null = "@wip" +not_eq_list_mixed_type_numbers = "@wip" +not_eq_map_null = "@wip" +not_eq_uint_double = "@wip" +not_eq_uint_double_nan = "@wip" +not_eq_uint_int = "@wip" + +[comparisons.eq_wrapper] +eq_bool = "@wip" +eq_bool_empty = "@wip" +eq_bool_not_null = "@wip" +eq_bool_proto2_null = "@wip" +eq_bool_proto3_null = "@wip" +eq_bytes = "@wip" +eq_bytes_proto2_null = "@wip" +eq_bytes_proto3_null = "@wip" +eq_double = "@wip" +eq_double_empty = "@wip" +eq_double_not_null = "@wip" +eq_double_proto2_null = "@wip" +eq_double_proto3_null = "@wip" +eq_float = "@wip" +eq_float_empty = "@wip" +eq_float_not_null = "@wip" +eq_float_proto2_null = "@wip" +eq_float_proto3_null = "@wip" +eq_int32 = "@wip" +eq_int32_empty = "@wip" +eq_int32_not_null = "@wip" +eq_int32_proto2_null = "@wip" +eq_int32_proto3_null = "@wip" +eq_int64 = "@wip" +eq_int64_empty = "@wip" +eq_int64_not_null = "@wip" +eq_int64_proto2_null = "@wip" +eq_int64_proto3_null = "@wip" +eq_proto2_any_unpack_bytewise_fallback_equal = "@wip" +eq_proto2_any_unpack_bytewise_fallback_not_equal = "@wip" +eq_proto2_any_unpack_equal = "@wip" +eq_proto2_any_unpack_not_equal = "@wip" +eq_proto2_missing_fields_neq = "@wip" +eq_proto3_any_unpack_bytewise_fallback_equal = "@wip" +eq_proto3_any_unpack_bytewise_fallback_not_equal = "@wip" +eq_proto3_any_unpack_equal = "@wip" +eq_proto3_any_unpack_not_equal = "@wip" +eq_proto3_missing_fields_neq = "@wip" +eq_string = "@wip" +eq_string_empty = "@wip" +eq_string_proto2_null = "@wip" +eq_string_proto3_null = "@wip" +eq_uint32 = "@wip" +eq_uint32_empty = "@wip" +eq_uint32_not_null = "@wip" +eq_uint32_proto2_null = "@wip" +eq_uint32_proto3_null = "@wip" +eq_uint64 = "@wip" +eq_uint64_empty = "@wip" +eq_uint64_not_null = "@wip" +eq_uint64_proto2_null = "@wip" +eq_uint64_proto3_null = "@wip" + +[comparisons.gt_literal] +gt_dyn_int_double = "@wip" +gt_dyn_int_small_lossy_double_greater = "@wip" +gt_dyn_int_uint = "@wip" +not_gt_dyn_big_double_int = "@wip" +not_gt_dyn_int_big_double = "@wip" +not_gt_dyn_int_big_uint = "@wip" +not_gt_dyn_int_double = "@wip" +not_gt_dyn_int_small_lossy_double = "@wip" +not_gt_dyn_int_uint = "@wip" +not_gt_dyn_small_double_int = "@wip" +not_gt_dyn_small_int_uint = "@wip" + +[comparisons.gte_literal] +gte_dyn_int_big_lossy_double = "@wip" +gte_dyn_int_double = "@wip" +gte_dyn_int_small_lossy_double_equal = "@wip" +gte_dyn_int_small_lossy_double_greater = "@wip" +gte_dyn_int_uint = "@wip" +gte_dyn_small_double_int = "@wip" +not_gte_dyn_int_big_double = "@wip" +not_gte_dyn_int_big_uint = "@wip" +not_gte_dyn_int_double = "@wip" +not_gte_dyn_int_uint = "@wip" +not_gte_dyn_small_int_uint = "@wip" + +[comparisons.in_list_literal] +elem_in_mixed_type_list_cross_type = "@wip" + +[comparisons.in_map_literal] +key_in_mixed_key_type_map_cross_type = "@wip" + +[comparisons.lt_literal] +lt_dyn_int_big_lossy_double = "@wip" +lt_dyn_int_big_uint = "@wip" +lt_dyn_int_double = "@wip" +lt_dyn_int_uint = "@wip" +lt_dyn_small_int_uint = "@wip" +not_lt_dyn_int_big_lossy_double = "@wip" +not_lt_dyn_int_double = "@wip" +not_lt_dyn_int_small_double = "@wip" +not_lt_dyn_int_small_lossy_double = "@wip" +not_lt_dyn_int_uint = "@wip" +not_lt_dyn_small_double_int = "@wip" + +[comparisons.lte_literal] +lte_dyn_big_double_int = "@wip" +lte_dyn_int_big_double = "@wip" +lte_dyn_int_big_uint = "@wip" +lte_dyn_int_double = "@wip" +lte_dyn_int_small_lossy_double = "@wip" +lte_dyn_int_uint = "@wip" +lte_dyn_small_double_int = "@wip" +lte_dyn_small_int_uint = "@wip" +not_lte_dyn_int_double = "@wip" +not_lte_dyn_int_small_lossy_double_less = "@wip" +not_lte_dyn_int_uint = "@wip" + +[comparisons.ne_literal] +ne_double_int = "@wip" +ne_double_nan = "@wip" +ne_double_uint = "@wip" +ne_int_double = "@wip" +ne_int_uint = "@wip" +ne_mixed_types = "@wip" +ne_proto2_any_unpack = "@wip" +ne_proto2_any_unpack_bytewise_fallback = "@wip" +ne_proto3_any_unpack = "@wip" +ne_proto3_any_unpack_bytewise_fallback = "@wip" +ne_proto_different_types = "@wip" +ne_uint_double = "@wip" +not_ne_double_int = "@wip" +not_ne_double_nan = "@wip" +not_ne_double_uint = "@wip" +not_ne_int_double = "@wip" +not_ne_int_double_nan = "@wip" +not_ne_int_uint = "@wip" +not_ne_uint_double = "@wip" +not_ne_uint_double_nan = "@wip" + +[conversions.bool] +string_f = "@wip" +string_false_lowercase = "@wip" +string_false_pascalcase = "@wip" +string_false_uppercase = "@wip" +string_t = "@wip" +string_true_lowercase = "@wip" +string_true_pascalcase = "@wip" +string_true_uppercase = "@wip" + +[conversions.identity] +timestamp = "@wip" + +[conversions.int] +double_half_neg = "@wip" +double_half_pos = "@wip" +double_int_min_range = "@wip" +double_truncate = "@wip" +double_truncate_neg = "@wip" + +[conversions.uint] +double_half = "@wip" +double_truncate = "@wip" + +[dynamic.any] +literal = "@wip" + +[dynamic.bool] +literal = "@wip" +literal_empty = "@wip" + +[dynamic.bytes] +literal = "@wip" +literal_unicode = "@wip" + +[dynamic.double] +field_read_proto2_unset = "@wip" +field_read_proto3_unset = "@wip" +literal = "@wip" +literal_zero = "@wip" + +[dynamic.float] +field_assign_proto2_range = "@wip" +field_assign_proto2_round_to_zero = "@wip" +field_assign_proto2_subnorm = "@wip" +field_assign_proto3_range = "@wip" +field_assign_proto3_round_to_zero = "@wip" +field_read_proto2_unset = "@wip" +field_read_proto3_unset = "@wip" +literal = "@wip" +literal_not_double = "@wip" +literal_zero = "@wip" + +[dynamic.int32] +field_assign_proto2_range = "@wip" +field_assign_proto3_range = "@wip" +field_read_proto2_unset = "@wip" +field_read_proto3_unset = "@wip" +literal = "@wip" +literal_zero = "@wip" + +[dynamic.int64] +literal = "@wip" +literal_zero = "@wip" + +[dynamic.list] +literal = "@wip" +literal_empty = "@wip" + +[dynamic.string] +literal = "@wip" +literal_empty = "@wip" +literal_unicode = "@wip" + +[dynamic.struct] +field_assign_proto2_bad = "@wip" +field_assign_proto3_bad = "@wip" +literal = "@wip" +literal_empty = "@wip" +literal_no_field_access = "@wip" + +[dynamic.uint32] +field_assign_proto2_range = "@wip" +field_assign_proto3_range = "@wip" +field_read_proto2_unset = "@wip" +literal = "@wip" +literal_zero = "@wip" + +[dynamic.uint64] +field_read_proto2_unset = "@wip" +literal = "@wip" +literal_zero = "@wip" + +[dynamic.value_bool] +literal = "@wip" +literal_false = "@wip" + +[dynamic.value_list] +literal = "@wip" +literal_empty = "@wip" + +[dynamic.value_null] +field_read_proto2_unset = "@wip" +field_read_proto3_unset = "@wip" +literal = "@wip" +literal_unset = "@wip" + +[dynamic.value_number] +literal = "@wip" +literal_zero = "@wip" + +[dynamic.value_string] +literal = "@wip" +literal_empty = "@wip" + +[dynamic.value_struct] +literal = "@wip" +literal_empty = "@wip" + +[encoders_ext.decode] +hello = "@wip" +hello_without_padding = "@wip" + +[encoders_ext.encode] +hello = "@wip" + +[encoders_ext.round_trip] +hello = "@wip" + +[enums.legacy_proto2] +access_repeated_enum = "@wip" +arithmetic = "@wip" +assign_repeated_enum = "@wip" +assign_standalone_int_too_big = "@wip" +assign_standalone_int_too_neg = "@wip" +assign_standalone_name = "@wip" +comparison = "@wip" +enum_as_int = "@wip" +field_type = "@wip" +list_enum_as_list_int = "@wip" +literal_global = "@wip" +literal_nested = "@wip" +literal_zero = "@wip" +select_default = "@wip" +type_global = "@wip" +type_nested = "@wip" + +[enums.legacy_proto3] +access_repeated_enum = "@wip" +arithmetic = "@wip" +assign_repeated_enum = "@wip" +assign_standalone_int_too_big = "@wip" +assign_standalone_int_too_neg = "@wip" +assign_standalone_name = "@wip" +comparison = "@wip" +enum_as_int = "@wip" +field_type = "@wip" +list_enum_as_list_int = "@wip" +literal_global = "@wip" +literal_nested = "@wip" +literal_zero = "@wip" +select_default = "@wip" +type_global = "@wip" +type_nested = "@wip" + +[enums.strong_proto2] +assign_standalone_int = "@wip" +assign_standalone_name = "@wip" +comparison_false = "@wip" +comparison_true = "@wip" +convert_symbol_to_int = "@wip" + +[enums.strong_proto3] +assign_standalone_int = "@wip" +assign_standalone_int_big = "@wip" +assign_standalone_int_neg = "@wip" +assign_standalone_name = "@wip" +comparison_false = "@wip" +comparison_true = "@wip" +convert_symbol_to_int = "@wip" + +[fields.in] +mixed_numbers_and_keys_absent = "@wip" +mixed_numbers_and_keys_present = "@wip" + +[fields.map_fields] +map_key_mixed_numbers_double_key = "@wip" +map_key_mixed_numbers_int_key = "@wip" +map_key_mixed_numbers_uint_key = "@wip" + +[fields.quoted_map_fields] +field_access_dash = "@wip" +field_access_dot = "@wip" +field_access_slash = "@wip" +has_field_dash = "@wip" +has_field_dot = "@wip" +has_field_slash = "@wip" + +[lists.in] +double_in_ints = "@wip" +double_in_uints = "@wip" +int_in_doubles = "@wip" +int_in_uints = "@wip" +uint_in_doubles = "@wip" +uint_in_ints = "@wip" + +[lists.index] +zero_based_double = "@wip" + +[macros.exists] +list_elem_type_exhaustive = "@wip" +map_key_type_exhaustive = "@wip" + +[macros2.all] +list_elem_all_true = "@wip" +list_elem_error_exhaustive = "@wip" +list_elem_error_shortcircuit = "@wip" +list_elem_none_true = "@wip" +list_elem_some_true = "@wip" +list_elem_type_error_exhaustive = "@wip" +list_elem_type_exhaustive = "@wip" +list_elem_type_shortcircuit = "@wip" +list_empty = "@wip" +map_key = "@wip" + +[macros2.exists] +list_elem_all_true = "@wip" +list_elem_exists_error = "@wip" +list_elem_none_true = "@wip" +list_elem_some_true = "@wip" +list_elem_type_exhaustive = "@wip" +list_elem_type_shortcircuit = "@wip" +list_empty = "@wip" +map_key = "@wip" +map_key_type_exhaustive = "@wip" +map_key_type_shortcircuit = "@wip" +not_map_key = "@wip" + +[macros2.existsOne] +list_all = "@wip" +list_empty = "@wip" +list_many = "@wip" +list_none = "@wip" +list_one = "@wip" +list_one_false = "@wip" +list_one_true = "@wip" +map_one = "@wip" + +[macros2.transformList] +empty = "@wip" +empty_filter = "@wip" +many = "@wip" +many_filter = "@wip" +one = "@wip" +one_filter = "@wip" + +[macros2.transformMap] +empty = "@wip" +empty_filter = "@wip" +many = "@wip" +many_filter = "@wip" +one = "@wip" +one_filter = "@wip" + +[math_ext.abs] +negative_double = "@wip" +negative_int = "@wip" +positive_double = "@wip" +positive_int = "@wip" +uint = "@wip" + +[math_ext.bit_and] +int_int_intersect = "@wip" +int_int_intersect_neg = "@wip" +int_int_non_intersect = "@wip" +uint_uint_intersect = "@wip" +uint_uint_non_intersect = "@wip" + +[math_ext.bit_not] +int_negative = "@wip" +int_positive = "@wip" +int_zero = "@wip" +uint_positive = "@wip" +uint_zero = "@wip" + +[math_ext.bit_or] +int_int_positive = "@wip" +int_int_positive_negative = "@wip" +uint_uint = "@wip" + +[math_ext.bit_shift_left] +int = "@wip" +int_large_shift = "@wip" +int_negative_large_shift = "@wip" +uint = "@wip" +uint_large_shift = "@wip" + +[math_ext.bit_shift_right] +int = "@wip" +int_large_shift = "@wip" +int_negative = "@wip" +int_negative_large_shift = "@wip" +uint = "@wip" +uint_large_shift = "@wip" + +[math_ext.bit_xor] +int_int_positive = "@wip" +int_int_positive_negative = "@wip" +uint_uint = "@wip" + +[math_ext.ceil] +negative = "@wip" +positive = "@wip" + +[math_ext.floor] +negative = "@wip" +positive = "@wip" + +[math_ext.greatest_double_result] +binary_first_arg_double_max = "@wip" +binary_first_arg_double_min = "@wip" +binary_first_arg_greater = "@wip" +binary_same_args = "@wip" +binary_second_arg_double_max = "@wip" +binary_second_arg_double_min = "@wip" +binary_second_arg_greater = "@wip" +binary_with_int = "@wip" +binary_with_uint = "@wip" +quaternary_mixed = "@wip" +quaternary_mixed_array = "@wip" +quaternary_mixed_dyn_array = "@wip" +ternary_double_max = "@wip" +ternary_double_min = "@wip" +ternary_first_arg_greatest = "@wip" +ternary_same_args = "@wip" +ternary_third_arg_greatest = "@wip" +ternary_with_int = "@wip" +ternary_with_negatives = "@wip" +ternary_with_uint = "@wip" +unary_negative = "@wip" +unary_positive = "@wip" + +[math_ext.greatest_int_result] +binary_first_arg_greater = "@wip" +binary_first_arg_int_max = "@wip" +binary_first_arg_int_min = "@wip" +binary_same_args = "@wip" +binary_second_arg_greater = "@wip" +binary_second_arg_int_max = "@wip" +binary_second_arg_int_min = "@wip" +binary_with_decimal = "@wip" +binary_with_uint = "@wip" +quaternary_mixed = "@wip" +quaternary_mixed_array = "@wip" +quaternary_mixed_dyn_array = "@wip" +ternary_first_arg_greatest = "@wip" +ternary_int_max = "@wip" +ternary_int_min = "@wip" +ternary_same_args = "@wip" +ternary_third_arg_greatest = "@wip" +ternary_with_decimal = "@wip" +ternary_with_negatives = "@wip" +ternary_with_uint = "@wip" +unary_negative = "@wip" +unary_positive = "@wip" + +[math_ext.greatest_uint_result] +binary_first_arg_greater = "@wip" +binary_first_arg_uint_max = "@wip" +binary_same_args = "@wip" +binary_second_arg_greater = "@wip" +binary_second_arg_uint_max = "@wip" +binary_with_decimal = "@wip" +binary_with_int = "@wip" +quaternary_mixed = "@wip" +quaternary_mixed_array = "@wip" +quaternary_mixed_dyn_array = "@wip" +ternary_first_arg_greatest = "@wip" +ternary_int_max = "@wip" +ternary_same_args = "@wip" +ternary_third_arg_greatest = "@wip" +ternary_with_decimal = "@wip" +ternary_with_int = "@wip" +unary = "@wip" + +[math_ext.isFinite] +false_inf = "@wip" +false_nan = "@wip" +true = "@wip" + +[math_ext.isInf] +false = "@wip" +true = "@wip" + +[math_ext.isNaN] +false = "@wip" +true = "@wip" + +[math_ext.least_double_result] +binary_first_arg_double_max = "@wip" +binary_first_arg_double_min = "@wip" +binary_first_arg_least = "@wip" +binary_same_args = "@wip" +binary_second_arg_double_max = "@wip" +binary_second_arg_double_min = "@wip" +binary_second_arg_least = "@wip" +binary_with_int = "@wip" +binary_with_uint = "@wip" +quaternary_mixed = "@wip" +quaternary_mixed_array = "@wip" +quaternary_mixed_dyn_array = "@wip" +ternary_double_max = "@wip" +ternary_double_min = "@wip" +ternary_first_arg_least = "@wip" +ternary_same_args = "@wip" +ternary_third_arg_least = "@wip" +ternary_with_int = "@wip" +ternary_with_negatives = "@wip" +ternary_with_uint = "@wip" +unary_negative = "@wip" +unary_positive = "@wip" + +[math_ext.least_int_result] +binary_first_arg_int_max = "@wip" +binary_first_arg_int_min = "@wip" +binary_first_arg_least = "@wip" +binary_same_args = "@wip" +binary_second_arg_int_max = "@wip" +binary_second_arg_int_min = "@wip" +binary_second_arg_least = "@wip" +binary_with_decimal = "@wip" +binary_with_uint = "@wip" +quaternary_mixed = "@wip" +quaternary_mixed_array = "@wip" +quaternary_mixed_dyn_array = "@wip" +ternary_first_arg_least = "@wip" +ternary_int_max = "@wip" +ternary_int_min = "@wip" +ternary_same_args = "@wip" +ternary_third_arg_least = "@wip" +ternary_with_decimal = "@wip" +ternary_with_negatives = "@wip" +ternary_with_uint = "@wip" +unary_negative = "@wip" +unary_positive = "@wip" + +[math_ext.least_uint_result] +binary_first_arg_least = "@wip" +binary_first_arg_uint_max = "@wip" +binary_same_args = "@wip" +binary_second_arg_least = "@wip" +binary_second_arg_uint_max = "@wip" +binary_with_decimal = "@wip" +binary_with_int = "@wip" +quaternary_mixed = "@wip" +quaternary_mixed_array = "@wip" +quaternary_mixed_dyn_array = "@wip" +ternary_first_arg_least = "@wip" +ternary_same_args = "@wip" +ternary_third_arg_least = "@wip" +ternary_uint_max = "@wip" +ternary_with_decimal = "@wip" +ternary_with_int = "@wip" +unary = "@wip" + +[math_ext.round] +nan = "@wip" +negative_down = "@wip" +negative_mid = "@wip" +negative_up = "@wip" +positive_down = "@wip" +positive_up = "@wip" + +[math_ext.sign] +negative_double = "@wip" +negative_int = "@wip" +positive_double = "@wip" +positive_int = "@wip" +positive_uint = "@wip" +zero_double = "@wip" +zero_int = "@wip" +zero_uint = "@wip" + +[math_ext.trunc] +nan = "@wip" +negative = "@wip" +positive = "@wip" + +[optionals.optionals] +empty_list_optindex_hasValue = "@wip" +empty_map_optFlatMap_hasValue = "@wip" +empty_struct_optindex_hasValue = "@wip" +has_map_optindex = "@wip" +has_map_optindex_field = "@wip" +has_optional_ofNonZeroValue_struct_optional_ofNonZeroValue_map_optindex_field = "@wip" +list_optindex_value = "@wip" +map_absent_key_absent_field_none = "@wip" +map_empty_submap_optFlatMap_hasValue = "@wip" +map_key_mixed_numbers_double_key_optindex_value = "@wip" +map_key_mixed_numbers_int_key_optindex_value = "@wip" +map_key_mixed_numbers_uint_key_optindex_value = "@wip" +map_key_mixed_type_optindex_value = "@wip" +map_null_entry_hasValue = "@wip" +map_optindex_hasValue = "@wip" +map_optindex_optFlatMap_optional_ofNonZeroValue_hasValue = "@wip" +map_optional_entry_has = "@wip" +map_optional_has = "@wip" +map_submap_optFlatMap_value = "@wip" +map_submap_subkey_optFlatMap_value = "@wip" +map_undefined_entry_hasValue = "@wip" +none_optMap_hasValue = "@wip" +none_or_none_or_value = "@wip" +null = "@wip" +null_non_zero_value = "@wip" +optional_chaining_1 = "@wip" +optional_chaining_11 = "@wip" +optional_chaining_12 = "@wip" +optional_chaining_13 = "@wip" +optional_chaining_14 = "@wip" +optional_chaining_15 = "@wip" +optional_chaining_16 = "@wip" +optional_chaining_2 = "@wip" +optional_chaining_3 = "@wip" +optional_chaining_4 = "@wip" +optional_chaining_5 = "@wip" +optional_chaining_6 = "@wip" +optional_chaining_7 = "@wip" +optional_chaining_8 = "@wip" +optional_chaining_9 = "@wip" +optional_empty_list_optindex_hasValue = "@wip" +optional_empty_map_optindex_hasValue = "@wip" +optional_empty_struct_optindex_hasValue = "@wip" +optional_eq_int_int = "@wip" +optional_eq_int_none = "@wip" +optional_eq_none_int = "@wip" +optional_eq_none_none = "@wip" +optional_list_optindex_value = "@wip" +optional_ne_int_int = "@wip" +optional_ne_int_none = "@wip" +optional_ne_none_int = "@wip" +optional_ne_none_none = "@wip" +optional_none_optindex_hasValue = "@wip" +optional_none_optselect_hasValue = "@wip" +optional_ofNonZeroValue_or_optional_value = "@wip" +optional_ofNonZeroValue_struct_optional_ofNonZeroValue_map_optindex_field = "@wip" +optional_of_optMap_value = "@wip" +optional_struct_optindex_index_value = "@wip" +optional_struct_optindex_value = "@wip" +struct_list_optindex_field = "@wip" +struct_map_optindex_field = "@wip" +struct_map_optindex_field_nested = "@wip" +struct_optindex_value = "@wip" +struct_optional_ofNonZeroValue_map_optindex_field = "@wip" +ternary_optional_hasValue = "@wip" +type = "@wip" + +[parse.comments] +new_line_terminated = "@wip" + +[parse.whitespace] +carriage_returns = "@wip" +new_lines = "@wip" +new_pages = "@wip" +spaces = "@wip" +tabs = "@wip" + +[proto2.empty_field] +nested_message_subfield = "@wip" +repeated_enum = "@wip" +repeated_nested = "@wip" +repeated_scalar = "@wip" +scalar_no_default = "@wip" +scalar_with_default = "@wip" +wkt = "@wip" + +[proto2.extensions_get] +message_scoped_int64 = "@wip" +message_scoped_nested_enum_ext = "@wip" +message_scoped_nested_ext = "@wip" +message_scoped_repeated_test_all_types = "@wip" +package_scoped_int32 = "@wip" +package_scoped_nested_ext = "@wip" +package_scoped_repeated_test_all_types = "@wip" +package_scoped_test_all_types_ext = "@wip" +package_scoped_test_all_types_nested_enum_ext = "@wip" + +[proto2.extensions_has] +message_scoped_int64 = "@wip" +message_scoped_nested_enum_ext = "@wip" +message_scoped_nested_ext = "@wip" +message_scoped_repeated_test_all_types = "@wip" +package_scoped_int32 = "@wip" +package_scoped_nested_ext = "@wip" +package_scoped_repeated_test_all_types = "@wip" +package_scoped_test_all_types_ext = "@wip" +package_scoped_test_all_types_nested_enum_ext = "@wip" + +[proto2.has] +map_none_explicit = "@wip" +map_none_implicit = "@wip" +oneof_other_set = "@wip" +oneof_set = "@wip" +oneof_set_default = "@wip" +oneof_unset = "@wip" +optional_enum_set = "@wip" +optional_enum_set_zero = "@wip" +optional_enum_unset = "@wip" +optional_message_set = "@wip" +optional_message_unset = "@wip" +optional_unset_no_default = "@wip" +optional_unset_with_default = "@wip" +repeated_none_explicit = "@wip" +repeated_none_implicit = "@wip" +required = "@wip" +undefined = "@wip" + +[proto2.literal_singular] +float = "@wip" +float_eq_int = "@wip" +float_eq_uint = "@wip" +int32_eq_double = "@wip" +int32_eq_uint = "@wip" +int64_nocontainer = "@wip" +not_float_eq_int = "@wip" +not_float_eq_uint = "@wip" +not_int32_eq_double = "@wip" +not_int32_eq_uint = "@wip" +not_uint32_eq_double = "@wip" +not_uint32_eq_int = "@wip" +uint32_eq_double = "@wip" +uint32_eq_int = "@wip" + +[proto2.literal_wellknown] +struct = "@wip" + +[proto2.quoted_fields] +get_field_with_quoted_name = "@wip" +set_field_with_quoted_name = "@wip" + +[proto2.set_null] +list_value = "@wip" +map = "@wip" +repeated = "@wip" +single_scalar = "@wip" +single_struct = "@wip" + +[proto2_ext.get_ext] +message_scoped_int64 = "@wip" +message_scoped_nested_enum_ext = "@wip" +message_scoped_nested_ext = "@wip" +message_scoped_repeated_test_all_types = "@wip" +package_scoped_int32 = "@wip" +package_scoped_nested_ext = "@wip" +package_scoped_repeated_test_all_types = "@wip" +package_scoped_test_all_types_ext = "@wip" +package_scoped_test_all_types_nested_enum_ext = "@wip" + +[proto2_ext.has_ext] +message_scoped_int64 = "@wip" +message_scoped_nested_enum_ext = "@wip" +message_scoped_nested_ext = "@wip" +message_scoped_repeated_test_all_types = "@wip" +package_scoped_int32 = "@wip" +package_scoped_nested_ext = "@wip" +package_scoped_repeated_test_all_types = "@wip" +package_scoped_test_all_types_ext = "@wip" +package_scoped_test_all_types_nested_enum_ext = "@wip" + +[proto3.empty_field] +nested_message_subfield = "@wip" +repeated_enum = "@wip" +repeated_nested = "@wip" +repeated_scalar = "@wip" +scalar = "@wip" +wkt = "@wip" + +[proto3.has] +map_none_explicit = "@wip" +map_none_implicit = "@wip" +oneof_other_set = "@wip" +oneof_set = "@wip" +oneof_set_default = "@wip" +oneof_unset = "@wip" +repeated_none_explicit = "@wip" +repeated_none_implicit = "@wip" +single_enum_set = "@wip" +single_enum_unset = "@wip" +single_message_set = "@wip" +single_message_set_to_default = "@wip" +single_message_unset = "@wip" +single_set_to_default = "@wip" +single_unset = "@wip" +undefined = "@wip" + +[proto3.literal_singular] +float = "@wip" +int64_nocontainer = "@wip" + +[proto3.literal_wellknown] +struct = "@wip" + +[proto3.quoted_fields] +get_field = "@wip" +set_field = "@wip" + +[proto3.set_null] +list_value = "@wip" +map = "@wip" +repeated = "@wip" +single_scalar = "@wip" +single_struct = "@wip" + +[string_ext.ascii_casing] +lowerascii = "@wip" +lowerascii_unicode = "@wip" +lowerascii_unicode_with_space = "@wip" +upperascii = "@wip" +upperascii_unicode = "@wip" +upperascii_unicode_with_space = "@wip" + +[string_ext.char_at] +end_index = "@wip" +middle_index = "@wip" +multiple = "@wip" + +[string_ext.format] +"NaN support for decimal" = "@wip" +"NaN support for fixed-point" = "@wip" +"NaN support for scientific notation" = "@wip" +"binary formatting clause" = "@wip" +"binary formatting clause in a string variable" = "@wip" +"bool support for binary formatting" = "@wip" +"boolean support for %s" = "@wip" +"byte support with hexadecimal formatting clause" = "@wip" +"byte support with uppercase hexadecimal formatting clause" = "@wip" +"bytes support for string" = "@wip" +"default precision for fixed-point clause" = "@wip" +"default precision for fixed-point clause in a string variable" = "@wip" +"default precision for scientific notation" = "@wip" +"duration support for string" = "@wip" +"dyntype NaN/infinity support" = "@wip" +"dyntype support for duration" = "@wip" +"dyntype support for fixed-point formatting clause" = "@wip" +"dyntype support for hex formatting clause" = "@wip" +"dyntype support for hex formatting clause (uppercase)" = "@wip" +"dyntype support for integer formatting clause" = "@wip" +"dyntype support for integer formatting clause (unsigned)" = "@wip" +"dyntype support for lists" = "@wip" +"dyntype support for maps" = "@wip" +"dyntype support for numbers with string formatting clause" = "@wip" +"dyntype support for scientific notation" = "@wip" +"dyntype support for string formatting clause" = "@wip" +"dyntype support for timestamp" = "@wip" +"dyntype support for unsigned hex formatting clause" = "@wip" +"fixed point formatting clause" = "@wip" +"fixed point formatting clause in a string variable" = "@wip" +"int support for string" = "@wip" +"list support for string" = "@wip" +"lowercase hexadecimal formatting clause" = "@wip" +"map support (all key types)" = "@wip" +"map support for string" = "@wip" +"mid-string substitution" = "@wip" +"multiple substitutions" = "@wip" +"multiple substitutions in a string variable" = "@wip" +"negative infinity support for decimal" = "@wip" +"negative infinity support for fixed-point" = "@wip" +"negative infinity support for scientific notation" = "@wip" +no-op = "@wip" +"null support for string" = "@wip" +"octal formatting clause" = "@wip" +"percent escaping" = "@wip" +"percent sign escape sequence support" = "@wip" +"positive infinity support for decimal" = "@wip" +"positive infinity support for fixed-point" = "@wip" +"positive infinity support for scientific notation" = "@wip" +"scientific notation formatting clause" = "@wip" +"scientific notation formatting clause in a string variable" = "@wip" +"string substitution in a string variable" = "@wip" +"string support with hexadecimal formatting clause" = "@wip" +"string support with uppercase hexadecimal formatting clause" = "@wip" +"substitution inside escaped percent signs" = "@wip" +"substitution inside escaped percent signs in a string variable" = "@wip" +"substitution with one escaped percent sign on the left" = "@wip" +"substitution with one escaped percent sign on the right" = "@wip" +"timestamp support for string" = "@wip" +"type() support for string" = "@wip" +"uint support for binary formatting" = "@wip" +"uint support for decimal clause" = "@wip" +"uint support for octal formatting clause" = "@wip" +"unsigned support for hexadecimal formatting clause" = "@wip" +"uppercase hexadecimal formatting clause" = "@wip" + +[string_ext.index_of] +char_index = "@wip" +empty_index = "@wip" +nomatch = "@wip" +string_index = "@wip" +string_nomatch_index = "@wip" +string_with_space_fullmatch = "@wip" +string_with_space_index = "@wip" +unicode_char = "@wip" +unicode_char_index = "@wip" +unicode_string_index = "@wip" +unicode_string_nomatch_index = "@wip" + +[string_ext.join] +dash_separator = "@wip" +empty_separator = "@wip" +empty_string_dash_separator = "@wip" +empty_string_empty_separator = "@wip" + +[string_ext.last_index_of] +char_index = "@wip" +empty = "@wip" +empty_index = "@wip" +repeated_string = "@wip" +string = "@wip" +string_nomatch = "@wip" +string_with_space_fullmatch = "@wip" +string_with_space_string_index = "@wip" +string_with_space_string_nomatch = "@wip" +string_with_space_string_with_space_nomatch = "@wip" +unicode_char = "@wip" +unicode_char_index = "@wip" +unicode_string_index = "@wip" + +[string_ext.quote] +backspace = "@wip" +carriage_return = "@wip" +double_slash = "@wip" +empty_quote = "@wip" +ends_with = "@wip" +escaped = "@wip" +form_feed = "@wip" +horizontal_tab = "@wip" +mid_string_quote = "@wip" +multiline = "@wip" +printable_unicode = "@wip" +single_quote_with_double_quote = "@wip" +size_unicode_char = "@wip" +size_unicode_string = "@wip" +starts_with = "@wip" +two_escape_sequences = "@wip" +unicode = "@wip" +unicode_2 = "@wip" +unicode_code_points = "@wip" +verbatim = "@wip" +vertical_tab = "@wip" + +[string_ext.replace] +basic = "@wip" +chained = "@wip" +no_placeholder = "@wip" +unicode = "@wip" + +[string_ext.split] +empty = "@wip" +one_limit = "@wip" +unicode_negative_limit = "@wip" +zero_limit = "@wip" + +[string_ext.substring] +start = "@wip" +start_and_end = "@wip" +start_and_end_equal_value = "@wip" +start_with_max_length = "@wip" +unicode_start_and_end = "@wip" +unicode_start_and_end_equal_value = "@wip" + +[string_ext.trim] +blank_spaces_escaped_chars = "@wip" +unicode_no_trim = "@wip" +unicode_space_chars_1 = "@wip" +unicode_space_chars_2 = "@wip" +unicode_space_chars_3 = "@wip" + +[string_ext.type_errors] +charat_invalid_argument = "@wip" +replace_binary_invalid_argument = "@wip" +replace_binary_invalid_argument_2 = "@wip" +replace_quaternary_invalid_argument = "@wip" +replace_ternary_invalid_argument_2 = "@wip" +replace_ternary_invalid_argument_3 = "@wip" +replace_ternary_invalid_argument_4 = "@wip" +substring_binary_invalid_argument = "@wip" +substring_binary_invalid_argument_2 = "@wip" +substring_ternary_invalid_argument = "@wip" + +[string_ext.value_errors] +charat_out_of_range = "@wip" +substring_begin_index_out_of_range = "@wip" +substring_end_index_greater_than_begin_index = "@wip" +substring_end_index_out_of_range = "@wip" +substring_negative_index = "@wip" +substring_out_of_range = "@wip" + +[timestamps.duration_conversions] +type_comparison = "@wip" + +[timestamps.duration_converters] +get_milliseconds = "@wip" + +[timestamps.duration_range] +sub_over = "@wip" +sub_under = "@wip" + +[timestamps.timestamp_conversions] +toString_timestamp_nanos = "@wip" +type_comparison = "@wip" + +[timestamps.timestamp_range] +add_duration_nanos_over = "@wip" +add_duration_nanos_under = "@wip" +sub_time_duration_over = "@wip" +sub_time_duration_under = "@wip" + +[wrappers.bool] +to_any = "@wip" +to_json = "@wip" + +[wrappers.bytes] +to_any = "@wip" +to_json = "@wip" + +[wrappers.double] +to_any = "@wip" +to_json = "@wip" + +[wrappers.duration] +to_json = "@wip" + +[wrappers.empty] +to_json = "@wip" + +[wrappers.field_mask] +to_json = "@wip" + +[wrappers.float] +to_any = "@wip" +to_json = "@wip" +to_null = "@wip" + +[wrappers.int32] +to_any = "@wip" +to_json = "@wip" +to_null = "@wip" + +[wrappers.int64] +to_any = "@wip" +to_json_number = "@wip" +to_json_string = "@wip" + +[wrappers.string] +to_any = "@wip" +to_json = "@wip" + +[wrappers.timestamp] +to_json = "@wip" + +[wrappers.uint32] +to_any = "@wip" +to_json = "@wip" +to_null = "@wip" + +[wrappers.uint64] +to_any = "@wip" +to_json_number = "@wip" +to_json_string = "@wip" + +[wrappers.value] +default_to_json = "@wip" diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 83c4394..0000000 --- a/tox.ini +++ /dev/null @@ -1,92 +0,0 @@ -# SPDX-Copyright: Copyright (c) Capital One Services, LLC -# SPDX-License-Identifier: Apache-2.0 -# Copyright 2020 Capital One Services, LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and limitations under the License. - -[tox] -envlist = py39,py310,py311,py312,py313,re2,lint -minversion = 4.24.0 - -[testenv] -usedevelop = true # Some of the acceptance tests import the source -deps = - pytest - behave -setenv = - PYTHONPATH = {toxinidir}/src -commands = - pytest -vv - pytest -v --doctest-modules src - pytest -v --doctest-modules README.rst - behave --tags=~@wip --tags=~@future -D env='{envname}' --stop - behave --tags=~@wip --tags=~@future -D env='{envname}' -D runner='compiled' --stop - python -m doctest {toxinidir}/docs/source/api.rst {toxinidir}/docs/source/cli.rst {toxinidir}/docs/source/index.rst {toxinidir}/docs/source/integration.rst - pytest -v -o python_classes='PYTest*' tools - -[testenv:re2] -description = "The re-only test(s) are skipped and re2 test(s) are run" -basepython = py312 -deps = - google-re2 - pytest -commands = - pytest -vv -k test_function_matches_re - -[testenv:lint] -basepython = py312 -deps = - pytest - pytest-cov - coverage - ruff - mypy - # pyright - google-re2-stubs - types-pyyaml>=6.0.12.20250516 - tomli -commands = - coverage erase - pytest -vv -x --cov=src --cov-report=term-missing - coverage html - coverage xml - mypy --lineprecision-report type_check --strict --disable-error-code type-arg --show-error-codes src - # pyright src - ruff check src - -[testenv:tools] -basepython = py312 -description = "Tests the textproto-to-gherkin tool and the Lark grammar it uses." -depends = py312 -deps = - pytest - pytest-cov -commands = - pytest -v --doctest-modules tools/pb2g.py - pytest -vv --cov=tools --cov-report=term-missing --log-level=DEBUG tools - pytest -v -o python_classes='PYTest*' tools - -[testenv:wip] -basepython = py312 -description = "Deferred Work-in-Progress." -depends = py312 -deps = - behave -usedevelop = true -setenv = - docs = $(ls {toxinidir}/docs/source/*.rst) - PYTHONPATH = {toxinidir}/src -allowlist_externals = poetry -commands = - behave --tags=@wip --no-logcapture --logging-level WARNING --no-color features/dynamic.feature - # behave --tags=@wip --no-logcapture --logging-level WARNING features/proto2.feature - # behave --tags=@wip --no-logcapture --logging-level WARNING features/proto3.feature diff --git a/type_check/lineprecision.txt b/type_check/lineprecision.txt index 65e9875..2b1f945 100644 --- a/type_check/lineprecision.txt +++ b/type_check/lineprecision.txt @@ -1,11 +1,13 @@ Name Lines Precise Imprecise Any Empty Unanalyzed ------------------------------------------------------------------- -celpy 306 79 12 4 211 0 -celpy.__main__ 549 243 14 60 232 0 -celpy.adapter 142 34 3 9 90 6 +celpy 351 79 12 4 256 0 +celpy.__main__ 551 243 12 63 233 0 +celpy.adapter 163 34 3 9 111 6 celpy.c7nlib 1663 344 16 152 1151 0 -celpy.celparser 411 138 67 23 183 0 -celpy.celtypes 1480 385 15 234 809 37 -celpy.evaluation 3875 1134 249 244 2232 16 +celpy.celparser 411 136 68 23 184 0 +celpy.celtypes 1483 386 15 235 810 37 +celpy.evaluation 3859 1127 252 242 2222 16 +gherkinize 1142 531 14 96 481 20 +test_gherkinize 5581 5014 135 4 428 0 xlate 0 0 0 0 0 0 -xlate.c7n_to_cel 1755 397 103 144 1105 6 +xlate.c7n_to_cel 1755 387 103 144 1115 6 diff --git a/uv.lock b/uv.lock index 6a9bf48..e0d53ba 100644 --- a/uv.lock +++ b/uv.lock @@ -84,17 +84,26 @@ dependencies = [ dev = [ { name = "behave" }, { name = "coverage" }, + { name = "google-cel-spec-protocolbuffers-pyi" }, + { name = "google-cel-spec-protocolbuffers-python" }, { name = "google-re2-stubs" }, + { name = "jinja2" }, { name = "mypy" }, + { name = "protobuf" }, { name = "pytest" }, + { name = "pytest-cov" }, { name = "ruff" }, { name = "sphinx", version = "7.4.7", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, { name = "sphinx", version = "8.1.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.10.*'" }, { name = "sphinx", version = "8.2.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, { name = "sphinxcontrib-plantuml" }, + { name = "sphinxcontrib-programoutput" }, + { name = "toml" }, { name = "tox" }, { name = "tox-uv" }, + { name = "types-protobuf" }, { name = "types-pyyaml" }, + { name = "types-toml" }, ] [package.metadata] @@ -112,15 +121,24 @@ requires-dist = [ dev = [ { name = "behave", specifier = ">=1.2.6" }, { name = "coverage", specifier = ">=7.8.1" }, + { name = "google-cel-spec-protocolbuffers-pyi", specifier = "==32.1.0.1.20250512201741+dffb8c8cf781" }, + { name = "google-cel-spec-protocolbuffers-python", specifier = "==32.1.0.1.20250512201741+dffb8c8cf781" }, { name = "google-re2-stubs" }, + { name = "jinja2", specifier = ">=3.1.6" }, { name = "mypy", specifier = ">=1.15.0" }, + { name = "protobuf", specifier = ">=6.32.1" }, { name = "pytest", specifier = ">=8.3.5" }, + { name = "pytest-cov", specifier = ">=6.3.0" }, { name = "ruff", specifier = ">=0.11.10" }, { name = "sphinx", specifier = ">=7.4.7" }, { name = "sphinxcontrib-plantuml", specifier = ">=0.30" }, + { name = "sphinxcontrib-programoutput", specifier = ">=0.18" }, + { name = "toml", specifier = ">=0.10.2" }, { name = "tox", specifier = ">=4.24" }, { name = "tox-uv", specifier = ">=1.25.0" }, + { name = "types-protobuf", specifier = ">=6.30.2.20250914" }, { name = "types-pyyaml", specifier = ">=6.0.12.20250516" }, + { name = "types-toml", specifier = ">=0.10.8.20240310" }, ] [[package]] @@ -294,6 +312,11 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/1b/a1/4d968d4605f3a87a809f0c8f495eed81656c93cf6c00818334498ad6ad45/coverage-7.8.1-py3-none-any.whl", hash = "sha256:e54b80885b0e61d346accc5709daf8762471a452345521cc9281604a907162c2", size = 203623, upload-time = "2025-05-21T12:39:43.473Z" }, ] +[package.optional-dependencies] +toml = [ + { name = "tomli", marker = "python_full_version <= '3.11'" }, +] + [[package]] name = "distlib" version = "0.3.9" @@ -333,6 +356,32 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/4d/36/2a115987e2d8c300a974597416d9de88f2444426de9571f4b59b2cca3acc/filelock-3.18.0-py3-none-any.whl", hash = "sha256:c401f4f8377c4464e6db25fff06205fd89bdd83b65eb0488ed1b160f780e21de", size = 16215, upload-time = "2025-03-14T07:11:39.145Z" }, ] +[[package]] +name = "google-cel-spec-protocolbuffers-pyi" +version = "32.1.0.1.20250512201741+dffb8c8cf781" +source = { registry = "https://buf.build/gen/python" } +dependencies = [ + { name = "googleapis-googleapis-protocolbuffers-pyi" }, + { name = "protobuf" }, + { name = "types-protobuf" }, +] +wheels = [ + { url = "https://buf.build/gen/python/google-cel-spec-protocolbuffers-pyi/google_cel_spec_protocolbuffers_pyi-32.1.0.1.20250512201741+dffb8c8cf781-py3-none-any.whl" }, +] + +[[package]] +name = "google-cel-spec-protocolbuffers-python" +version = "32.1.0.1.20250512201741+dffb8c8cf781" +source = { registry = "https://buf.build/gen/python" } +dependencies = [ + { name = "google-cel-spec-protocolbuffers-pyi" }, + { name = "googleapis-googleapis-protocolbuffers-python" }, + { name = "protobuf" }, +] +wheels = [ + { url = "https://buf.build/gen/python/google-cel-spec-protocolbuffers-python/google_cel_spec_protocolbuffers_python-32.1.0.1.20250512201741+dffb8c8cf781-py3-none-any.whl" }, +] + [[package]] name = "google-re2" version = "1.1.20240702" @@ -463,6 +512,30 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/7e/86/2134e8ff65a22e30883bfc38ac34c5c76fd88cc9cef02ff3561f05db2b68/google_re2_stubs-0.1.1-py3-none-any.whl", hash = "sha256:a82eb6c3accd20879d711cd38151583d8a154fcca755f43a5595143a484c8118", size = 3676, upload-time = "2024-10-21T15:22:43.08Z" }, ] +[[package]] +name = "googleapis-googleapis-protocolbuffers-pyi" +version = "32.1.0.1.20250411203938+61b203b9a916" +source = { registry = "https://buf.build/gen/python" } +dependencies = [ + { name = "protobuf" }, + { name = "types-protobuf" }, +] +wheels = [ + { url = "https://buf.build/gen/python/googleapis-googleapis-protocolbuffers-pyi/googleapis_googleapis_protocolbuffers_pyi-32.1.0.1.20250411203938+61b203b9a916-py3-none-any.whl" }, +] + +[[package]] +name = "googleapis-googleapis-protocolbuffers-python" +version = "32.1.0.1.20250411203938+61b203b9a916" +source = { registry = "https://buf.build/gen/python" } +dependencies = [ + { name = "googleapis-googleapis-protocolbuffers-pyi" }, + { name = "protobuf" }, +] +wheels = [ + { url = "https://buf.build/gen/python/googleapis-googleapis-protocolbuffers-python/googleapis_googleapis_protocolbuffers_python-32.1.0.1.20250411203938+61b203b9a916-py3-none-any.whl" }, +] + [[package]] name = "idna" version = "3.10" @@ -777,6 +850,22 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746", size = 20538, upload-time = "2025-05-15T12:30:06.134Z" }, ] +[[package]] +name = "protobuf" +version = "6.32.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/fa/a4/cc17347aa2897568beece2e674674359f911d6fe21b0b8d6268cd42727ac/protobuf-6.32.1.tar.gz", hash = "sha256:ee2469e4a021474ab9baafea6cd070e5bf27c7d29433504ddea1a4ee5850f68d", size = 440635, upload-time = "2025-09-11T21:38:42.935Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/c0/98/645183ea03ab3995d29086b8bf4f7562ebd3d10c9a4b14ee3f20d47cfe50/protobuf-6.32.1-cp310-abi3-win32.whl", hash = "sha256:a8a32a84bc9f2aad712041b8b366190f71dde248926da517bde9e832e4412085", size = 424411, upload-time = "2025-09-11T21:38:27.427Z" }, + { url = "https://files.pythonhosted.org/packages/8c/f3/6f58f841f6ebafe076cebeae33fc336e900619d34b1c93e4b5c97a81fdfa/protobuf-6.32.1-cp310-abi3-win_amd64.whl", hash = "sha256:b00a7d8c25fa471f16bc8153d0e53d6c9e827f0953f3c09aaa4331c718cae5e1", size = 435738, upload-time = "2025-09-11T21:38:30.959Z" }, + { url = "https://files.pythonhosted.org/packages/10/56/a8a3f4e7190837139e68c7002ec749190a163af3e330f65d90309145a210/protobuf-6.32.1-cp39-abi3-macosx_10_9_universal2.whl", hash = "sha256:d8c7e6eb619ffdf105ee4ab76af5a68b60a9d0f66da3ea12d1640e6d8dab7281", size = 426454, upload-time = "2025-09-11T21:38:34.076Z" }, + { url = "https://files.pythonhosted.org/packages/3f/be/8dd0a927c559b37d7a6c8ab79034fd167dcc1f851595f2e641ad62be8643/protobuf-6.32.1-cp39-abi3-manylinux2014_aarch64.whl", hash = "sha256:2f5b80a49e1eb7b86d85fcd23fe92df154b9730a725c3b38c4e43b9d77018bf4", size = 322874, upload-time = "2025-09-11T21:38:35.509Z" }, + { url = "https://files.pythonhosted.org/packages/5c/f6/88d77011b605ef979aace37b7703e4eefad066f7e84d935e5a696515c2dd/protobuf-6.32.1-cp39-abi3-manylinux2014_x86_64.whl", hash = "sha256:b1864818300c297265c83a4982fd3169f97122c299f56a56e2445c3698d34710", size = 322013, upload-time = "2025-09-11T21:38:37.017Z" }, + { url = "https://files.pythonhosted.org/packages/05/9d/d6f1a8b6657296920c58f6b85f7bca55fa27e3ca7fc5914604d89cd0250b/protobuf-6.32.1-cp39-cp39-win32.whl", hash = "sha256:68ff170bac18c8178f130d1ccb94700cf72852298e016a2443bdb9502279e5f1", size = 424505, upload-time = "2025-09-11T21:38:38.415Z" }, + { url = "https://files.pythonhosted.org/packages/ed/cd/891bd2d23558f52392a5687b2406a741e2e28d629524c88aade457029acd/protobuf-6.32.1-cp39-cp39-win_amd64.whl", hash = "sha256:d0975d0b2f3e6957111aa3935d08a0eb7e006b1505d825f862a1fffc8348e122", size = 435825, upload-time = "2025-09-11T21:38:39.773Z" }, + { url = "https://files.pythonhosted.org/packages/97/b7/15cc7d93443d6c6a84626ae3258a91f4c6ac8c0edd5df35ea7658f71b79c/protobuf-6.32.1-py3-none-any.whl", hash = "sha256:2601b779fc7d32a866c6b4404f9d42a3f67c5b9f3f15b4db3cccabe06b95c346", size = 169289, upload-time = "2025-09-11T21:38:41.234Z" }, +] + [[package]] name = "pygments" version = "2.19.1" @@ -816,6 +905,20 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/30/3d/64ad57c803f1fa1e963a7946b6e0fea4a70df53c1a7fed304586539c2bac/pytest-8.3.5-py3-none-any.whl", hash = "sha256:c69214aa47deac29fad6c2a4f590b9c4a9fdb16a403176fe154b79c0b4d4d820", size = 343634, upload-time = "2025-03-02T12:54:52.069Z" }, ] +[[package]] +name = "pytest-cov" +version = "6.3.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "coverage", extra = ["toml"] }, + { name = "pluggy" }, + { name = "pytest" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/30/4c/f883ab8f0daad69f47efdf95f55a66b51a8b939c430dadce0611508d9e99/pytest_cov-6.3.0.tar.gz", hash = "sha256:35c580e7800f87ce892e687461166e1ac2bcb8fb9e13aea79032518d6e503ff2", size = 70398, upload-time = "2025-09-06T15:40:14.361Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/80/b4/bb7263e12aade3842b938bc5c6958cae79c5ee18992f9b9349019579da0f/pytest_cov-6.3.0-py3-none-any.whl", hash = "sha256:440db28156d2468cafc0415b4f8e50856a0d11faefa38f30906048fe490f1749", size = 25115, upload-time = "2025-09-06T15:40:12.44Z" }, +] + [[package]] name = "python-dateutil" version = "2.9.0.post0" @@ -1090,6 +1193,20 @@ dependencies = [ ] sdist = { url = "https://files.pythonhosted.org/packages/4d/e0/91ee50f1a020e2ed48d370a054f94b012ba0d757214a420ac43c9327f818/sphinxcontrib-plantuml-0.30.tar.gz", hash = "sha256:2a1266ca43bddf44640ae44107003df4490de2b3c3154a0d627cfb63e9a169bf", size = 15084, upload-time = "2024-05-22T13:34:43.339Z" } +[[package]] +name = "sphinxcontrib-programoutput" +version = "0.18" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "sphinx", version = "7.4.7", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, + { name = "sphinx", version = "8.1.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.10.*'" }, + { name = "sphinx", version = "8.2.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/3f/c0/834af2290f8477213ec0dd60e90104f5644aa0c37b1a0d6f0a2b5efe03c4/sphinxcontrib_programoutput-0.18.tar.gz", hash = "sha256:09e68b6411d937a80b6085f4fdeaa42e0dc5555480385938465f410589d2eed8", size = 26333, upload-time = "2024-12-06T20:38:36.959Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/04/2c/7aec6e0580f666d4f61474a50c4995a98abfff27d827f0e7bc8c4fa528f5/sphinxcontrib_programoutput-0.18-py3-none-any.whl", hash = "sha256:8a651bc85de69a808a064ff0e48d06c12b9347da4fe5fdb1e94914b01e1b0c36", size = 20346, upload-time = "2024-12-06T20:38:22.406Z" }, +] + [[package]] name = "sphinxcontrib-qthelp" version = "2.0.0" @@ -1108,6 +1225,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/52/a7/d2782e4e3f77c8450f727ba74a8f12756d5ba823d81b941f1b04da9d033a/sphinxcontrib_serializinghtml-2.0.0-py3-none-any.whl", hash = "sha256:6e2cb0eef194e10c27ec0023bfeb25badbbb5868244cf5bc5bdc04e4464bf331", size = 92072, upload-time = "2024-07-29T01:10:08.203Z" }, ] +[[package]] +name = "toml" +version = "0.10.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/be/ba/1f744cdc819428fc6b5084ec34d9b30660f6f9daaf70eead706e3203ec3c/toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f", size = 22253, upload-time = "2020-11-01T01:40:22.204Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/44/6f/7120676b6d73228c96e17f1f794d8ab046fc910d781c8d151120c3f1569e/toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b", size = 16588, upload-time = "2020-11-01T01:40:20.672Z" }, +] + [[package]] name = "tomli" version = "2.2.1" @@ -1184,6 +1310,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/3c/a7/f5c29e0e6faaccefcab607f672b176927144e9412c8183d21301ea2a6f6c/tox_uv-1.25.0-py3-none-any.whl", hash = "sha256:50cfe7795dcd49b2160d7d65b5ece8717f38cfedc242c852a40ec0a71e159bf7", size = 16431, upload-time = "2025-02-21T16:37:49.657Z" }, ] +[[package]] +name = "types-protobuf" +version = "6.30.2.20250914" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/36/d1/e12dad323fe6e2455b768828de288f60d5160f41dad5d31af8ef92a6acbb/types_protobuf-6.30.2.20250914.tar.gz", hash = "sha256:c2105326d0a52de3d33b84af0010d834ebbd4c17c50ff261fa82551ab75d9559", size = 62424, upload-time = "2025-09-14T02:56:00.798Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/6c/c4/3fcb1f8e03456a8a33a5dfb9f9788b0a91023e5fad6a37d46fc6831629a7/types_protobuf-6.30.2.20250914-py3-none-any.whl", hash = "sha256:cfc24977c0f38cf2896d918a59faed7650eb983be6070343a6204ac8ac0a297e", size = 76546, upload-time = "2025-09-14T02:55:59.489Z" }, +] + [[package]] name = "types-pyyaml" version = "6.0.12.20250516" @@ -1193,6 +1328,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/99/5f/e0af6f7f6a260d9af67e1db4f54d732abad514252a7a378a6c4d17dd1036/types_pyyaml-6.0.12.20250516-py3-none-any.whl", hash = "sha256:8478208feaeb53a34cb5d970c56a7cd76b72659442e733e268a94dc72b2d0530", size = 20312, upload-time = "2025-05-16T03:08:04.019Z" }, ] +[[package]] +name = "types-toml" +version = "0.10.8.20240310" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/86/47/3e4c75042792bff8e90d7991aa5c51812cc668828cc6cce711e97f63a607/types-toml-0.10.8.20240310.tar.gz", hash = "sha256:3d41501302972436a6b8b239c850b26689657e25281b48ff0ec06345b8830331", size = 4392, upload-time = "2024-03-10T02:18:37.518Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/da/a2/d32ab58c0b216912638b140ab2170ee4b8644067c293b170e19fba340ccc/types_toml-0.10.8.20240310-py3-none-any.whl", hash = "sha256:627b47775d25fa29977d9c70dc0cbab3f314f32c8d8d0c012f2ef5de7aaec05d", size = 4777, upload-time = "2024-03-10T02:18:36.568Z" }, +] + [[package]] name = "typing-extensions" version = "4.13.2"