diff --git a/.changes/unreleased/Features-20230725-122847.yaml b/.changes/unreleased/Features-20230725-122847.yaml deleted file mode 100644 index 03f3b5a1885..00000000000 --- a/.changes/unreleased/Features-20230725-122847.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Features -body: Supports non half width alphanumeric for generic test -time: 2023-07-25T12:28:47.88711+09:00 -custom: - Author: d-kaneshiro - Issue: "8204" diff --git a/core/dbt/parser/generic_test_builders.py b/core/dbt/parser/generic_test_builders.py index 4545596d078..d6ff1ad7382 100644 --- a/core/dbt/parser/generic_test_builders.py +++ b/core/dbt/parser/generic_test_builders.py @@ -56,7 +56,7 @@ def synthesize_generic_test_names( flat_args.extend([str(part) for part in parts]) - clean_flat_args = [re.sub(r"\W+", "_", arg) for arg in flat_args] + clean_flat_args = [re.sub("[^0-9a-zA-Z_]+", "_", arg) for arg in flat_args] unique = "__".join(clean_flat_args) # for the file path + alias, the name must be <64 characters diff --git a/tests/adapter/dbt/tests/adapter/basic/files.py b/tests/adapter/dbt/tests/adapter/basic/files.py index 35632430235..b035766d641 100644 --- a/tests/adapter/dbt/tests/adapter/basic/files.py +++ b/tests/adapter/dbt/tests/adapter/basic/files.py @@ -12,20 +12,6 @@ 10,Nora,1976-03-01T16:51:39 """.lstrip() -seeds_jp_base_csv = """ -id,名前,ふりがな,部署コード,イニシャル -1,比嘉,ひが,10000,H -2,金城,きんじょう,10000,K -3,大城,おおしろ,10001,O -4,宮城,みやぎ,10001,M -5,新垣,あらかき,10002,A -6,玉城,たましろ,10002,T -7,上原,うえはら,10002,U -8,島袋,しまぶくろ,10003,S -9,平良,たいら,10003,T -10,山城,やましろ,10003,Y -""".lstrip() - seeds_added_csv = ( seeds_base_csv @@ -75,18 +61,6 @@ - name: id tests: - not_null - - name: 名前 - tests: - - not_null - - name: ふりがな - tests: - - not_null - - name: 部署コード - tests: - - not_null - - name: イニシャル - tests: - - not_null """ generic_test_view_yml = """ @@ -97,18 +71,6 @@ - name: id tests: - not_null - - name: 名前 - tests: - - not_null - - name: ふりがな - tests: - - not_null - - name: 部署コード - tests: - - not_null - - name: イニシャル - tests: - - not_null """ generic_test_table_yml = """ @@ -119,18 +81,6 @@ - name: id tests: - not_null - - name: 名前 - tests: - - not_null - - name: ふりがな - tests: - - not_null - - name: 部署コード - tests: - - not_null - - name: イニシャル - tests: - - not_null """ test_passing_sql = """ diff --git a/tests/adapter/dbt/tests/adapter/basic/test_generic_tests.py b/tests/adapter/dbt/tests/adapter/basic/test_generic_tests.py index df844fe4b5e..8f1a3e5f0e2 100644 --- a/tests/adapter/dbt/tests/adapter/basic/test_generic_tests.py +++ b/tests/adapter/dbt/tests/adapter/basic/test_generic_tests.py @@ -1,7 +1,7 @@ import pytest from dbt.tests.util import run_dbt from dbt.tests.adapter.basic.files import ( - seeds_jp_base_csv, + seeds_base_csv, generic_test_seed_yml, base_view_sql, base_table_sql, @@ -19,7 +19,7 @@ def project_config_update(self): @pytest.fixture(scope="class") def seeds(self): return { - "base.csv": seeds_jp_base_csv, + "base.csv": seeds_base_csv, "schema.yml": generic_test_seed_yml, } @@ -39,7 +39,7 @@ def test_generic_tests(self, project): # test command selecting base model results = run_dbt(["test", "-m", "base"]) - assert len(results) == 5 + assert len(results) == 1 # run command results = run_dbt(["run"]) @@ -47,7 +47,7 @@ def test_generic_tests(self, project): # test command, all tests results = run_dbt(["test"]) - assert len(results) == 15 + assert len(results) == 3 class TestGenericTests(BaseGenericTests):