From 25b1c07269b3d3df81f39678c360e51c6a27be5f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Dec 2023 09:31:17 +1100 Subject: [PATCH 1/3] =?UTF-8?q?=E2=AC=86=20Bump=20codecov/codecov-action?= =?UTF-8?q?=20from=203=20to=204=20(#83)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3 to 4. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v3...v4) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/python-package.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yaml b/.github/workflows/python-package.yaml index c87751c..bfb1909 100644 --- a/.github/workflows/python-package.yaml +++ b/.github/workflows/python-package.yaml @@ -60,7 +60,7 @@ jobs: pip install pytest pyjwt pytest - name: Upload coverage - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: files: ./dist/coverage/python/coverage.xml - name: Upload pants log From 0186c1fcfcca0fecb475b188e576226376ca0876 Mon Sep 17 00:00:00 2001 From: Andy Challis Date: Mon, 4 Dec 2023 10:25:31 +1100 Subject: [PATCH 2/3] =?UTF-8?q?Revert=20"=E2=AC=86=20Bump=20codecov/codeco?= =?UTF-8?q?v-action=20from=203=20to=204"=20(#86)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Revert "⬆ Bump codecov/codecov-action from 3 to 4 (#83)" This reverts commit 25b1c07269b3d3df81f39678c360e51c6a27be5f. * Fixing date-time regex * fix formatting --- .github/workflows/python-package.yaml | 2 +- jsf/tests/test_default_fake.py | 50 ++++++++++++--------------- 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/.github/workflows/python-package.yaml b/.github/workflows/python-package.yaml index bfb1909..c87751c 100644 --- a/.github/workflows/python-package.yaml +++ b/.github/workflows/python-package.yaml @@ -60,7 +60,7 @@ jobs: pip install pytest pyjwt pytest - name: Upload coverage - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v3 with: files: ./dist/coverage/python/coverage.xml - name: Upload pants log diff --git a/jsf/tests/test_default_fake.py b/jsf/tests/test_default_fake.py index 36fa30d..3a304db 100644 --- a/jsf/tests/test_default_fake.py +++ b/jsf/tests/test_default_fake.py @@ -1,5 +1,6 @@ import json import re +from typing import Optional import jwt # pants: no-infer-dep from jsf.parser import JSF @@ -314,6 +315,10 @@ def test_fake_object_pattern_properties(TestData): assert len(all_int_names) > 0 +def assert_regex(pattern: str, string: str, info: Optional[str]) -> None: + assert bool(re.match(pattern, string)), (string, info) + + def test_fake_string_format(TestData): with open(TestData / "string-format.json", "r") as file: schema = json.load(file) @@ -321,34 +326,25 @@ def test_fake_string_format(TestData): assert isinstance(p.generate(), dict) fake_data = [p.generate() for _ in range(10)] - assert all(bool(re.match(r".*@.*", d["email"])) for d in fake_data), fake_data - assert all(bool(re.match(r".*@.*", d["idn-email"])) for d in fake_data), fake_data - assert all( - bool(re.match(r"\d{4}-\d{2}-\d{2}T\d{2}\:\d{2}\:\d{2}\+\d{2}\:\d{2}", d["date-time"])) - for d in fake_data - ), fake_data - assert all(bool(re.match(r"\d{4}-\d{2}-\d{2}", d["date"])) for d in fake_data), fake_data - assert all( - bool( - re.match( - r"^(-?)P(?=\d|T\d)(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+(?:\.\d+)?)S)?)?$", - d["duration"], - ) + + for d in fake_data: + assert_regex(r".*@.*", d["email"], "email") + assert_regex(r".*@.*", d["idn-email"], "idn-email") + assert_regex( + r"\d{4}-\d{2}-\d{2}T\d{2}\:\d{2}\:\d{2}\.*\d*[-\+]\d{2}\:\d{2}", + d["date-time"], + "date-time", ) - for d in fake_data - ), fake_data - assert all( - bool(re.match(r"\d{2}\:\d{2}\:\d{2}\+\d{2}\:\d{2}", d["time"])) for d in fake_data - ), fake_data - assert all( - bool(re.match(r"[a-zA-Z0-9+-\.]{1,33}\.[a-z]{2,4}", d["hostname"])) for d in fake_data - ) - assert all( - bool(re.match(r"[a-zA-Z0-9+-\.]{1,33}\.[a-z]{2,4}", d["idn-hostname"])) for d in fake_data - ) - assert all(bool(re.match(r"[a-f0-9]{0,4}(:[a-f0-9]{0,4}){7}", d["ipv6"])) for d in fake_data), [ - d["ipv6"] for d in fake_data - ] + assert_regex(r"\d{4}-\d{2}-\d{2}", d["date"], "date") + assert_regex( + r"^(-?)P(?=\d|T\d)(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+(?:\.\d+)?)S)?)?$", + d["duration"], + "duration", + ) + assert_regex(r"\d{2}\:\d{2}\:\d{2}\.*\d*[-\+]\d{2}\:\d{2}", d["time"], "time") + assert_regex(r"[a-zA-Z0-9+-\.]{1,33}\.[a-z]{2,4}", d["hostname"], "hostname") + assert_regex(r"[a-zA-Z0-9+-\.]{1,33}\.[a-z]{2,4}", d["idn-hostname"], "idn-hostname") + assert_regex(r"[a-f0-9]{0,4}(:[a-f0-9]{0,4}){7}", d["ipv6"], "ipv6") # TODO: add more regex tests # "ipv4" From 1d94ad1a6412531dd2d0ead7fc86f572ae34ade2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Dec 2023 10:28:34 +1100 Subject: [PATCH 3/3] =?UTF-8?q?=E2=AC=86=20Bump=20actions/checkout=20from?= =?UTF-8?q?=203=20to=204=20(#81)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Andy Challis --- .github/workflows/mkdoc-gh-pages.yaml | 2 +- .github/workflows/python-package.yaml | 2 +- .github/workflows/python-publish.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/mkdoc-gh-pages.yaml b/.github/workflows/mkdoc-gh-pages.yaml index 5cb7451..e41e5a0 100644 --- a/.github/workflows/mkdoc-gh-pages.yaml +++ b/.github/workflows/mkdoc-gh-pages.yaml @@ -8,7 +8,7 @@ jobs: name: Deploy docs runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python 3.8 uses: actions/setup-python@v4 with: diff --git a/.github/workflows/python-package.yaml b/.github/workflows/python-package.yaml index c87751c..45ceaa0 100644 --- a/.github/workflows/python-package.yaml +++ b/.github/workflows/python-package.yaml @@ -17,7 +17,7 @@ jobs: python-version: ["3.8", "3.9"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/cache@v3 id: cache with: diff --git a/.github/workflows/python-publish.yaml b/.github/workflows/python-publish.yaml index 7273c22..323c0f2 100644 --- a/.github/workflows/python-publish.yaml +++ b/.github/workflows/python-publish.yaml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: