From f093f5444d891055b464de463e25453953749b07 Mon Sep 17 00:00:00 2001 From: ingmarvdg Date: Thu, 4 Jul 2024 17:17:45 +0200 Subject: [PATCH 1/2] fix iso8601 format check and add test cases --- soda/core/tests/data_source/test_formats.py | 2 +- soda/mysql/soda/data_sources/mysql_data_source.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/soda/core/tests/data_source/test_formats.py b/soda/core/tests/data_source/test_formats.py index d7b17e9f7..1dfa32e10 100644 --- a/soda/core/tests/data_source/test_formats.py +++ b/soda/core/tests/data_source/test_formats.py @@ -2,7 +2,6 @@ from helpers.data_source_fixture import DataSourceFixture from helpers.fixtures import test_data_source - def test_formats(data_source_fixture: DataSourceFixture): table_name = data_source_fixture.ensure_test_table(customers_test_table) @@ -107,6 +106,7 @@ def test_formats(data_source_fixture: DataSourceFixture): "2020-02-08 09Z", "2020-04-30", "2020-04-30T00:00:00.000", + "1981-10-10T00:00:00.000" ], "failing_values": [ "", diff --git a/soda/mysql/soda/data_sources/mysql_data_source.py b/soda/mysql/soda/data_sources/mysql_data_source.py index 484f2d5e2..75e587f3a 100644 --- a/soda/mysql/soda/data_sources/mysql_data_source.py +++ b/soda/mysql/soda/data_sources/mysql_data_source.py @@ -71,7 +71,7 @@ def __init__(self, logs: Logs, data_source_name: str, data_source_properties: di "integer": r"^[[:blank:]]*[-+]?[[:blank:]]*[[:digit:]]+$", "positive integer": r"^[[:blank:]]*[+]?[[:blank:]]*[[:digit:]]+$", "negative integer": r"^[[:blank:]]*(-[[:blank:]]*[[:digit:]]+|0)[[:blank:]]*$", - "date iso 8601": r"^ *(19|20)[[:digit:]][[:digit:]]-?((0[0-9]|1[12])-?([012][0-9]|3[01])|W[0-5][[:digit:]](-?[1-7])?|[0-3][[:digit:]][[:digit:]])([ T](0[0-9]|1[012])(:?[0-5][0-9](:?[0-5][0-9]([.,][[:digit:]]+)?)?)?([+-](0[0-9]|1[012]):?[0-5][0-9]|Z)?)? *$", + "date iso 8601": r"^ *(19|20)[[:digit:]][[:digit:]]-?((0[0-9]|1[0-2])-?([012][0-9]|3[01])|W[0-5][[:digit:]](-?[1-7])?|[0-3][[:digit:]][[:digit:]])([ T](0[0-9]|1[012])(:?[0-5][0-9](:?[0-5][0-9]([.,][[:digit:]]+)?)?)?([+-](0[0-9]|1[012]):?[0-5][0-9]|Z)?)? *$", } ) From d867c603ccac778573010db68789bb7ade46637e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 4 Jul 2024 15:18:56 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- soda/core/tests/data_source/test_formats.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/soda/core/tests/data_source/test_formats.py b/soda/core/tests/data_source/test_formats.py index 1dfa32e10..6ba1de286 100644 --- a/soda/core/tests/data_source/test_formats.py +++ b/soda/core/tests/data_source/test_formats.py @@ -2,6 +2,7 @@ from helpers.data_source_fixture import DataSourceFixture from helpers.fixtures import test_data_source + def test_formats(data_source_fixture: DataSourceFixture): table_name = data_source_fixture.ensure_test_table(customers_test_table) @@ -106,7 +107,7 @@ def test_formats(data_source_fixture: DataSourceFixture): "2020-02-08 09Z", "2020-04-30", "2020-04-30T00:00:00.000", - "1981-10-10T00:00:00.000" + "1981-10-10T00:00:00.000", ], "failing_values": [ "",