Skip to content

Commit

Permalink
Fix pydantic test and remove unnecessary pre-commits
Browse files Browse the repository at this point in the history
  • Loading branch information
lcard committed Oct 12, 2023
1 parent a5df376 commit be3eff8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 49 deletions.
21 changes: 0 additions & 21 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ repos:
- id: flake8
args: ['--config', 'api/.flake8']
exclude: (docs/|get_latest_release_changelog.py)
# - repo: https://github.com/PyCQA/pylint
# rev: v2.15.5
# hooks:
# - id: pylint
# exclude: (docs/|get_latest_release_changelog.py)
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.83.2
hooks:
Expand All @@ -54,24 +49,8 @@ repos:
- id: checkov
args: [--quiet, --compact, --skip-check, 'CKV2_GHA_1']
exclude: '^(?!infrastructure/).*'
- repo: local
hooks:
- id: sdk_test
name: sdk_test
language: system
entry: bash -c 'make sdk-test'
files: 'sdk/.*'
pass_filenames: false
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
hooks:
- id: prettier
args: ['--config', 'ui/.prettierrc.json', './ui']
- repo: local
hooks:
- id: ui_test
name: ui_test
language: system
files: 'ui/.*'
entry: bash -c 'cd ./ui; npm install; npm run test:all'
pass_filenames: false
62 changes: 34 additions & 28 deletions sdk/tests/test_items/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,23 @@ def test_create_columns_fails_name_none(self):
with pytest.raises(ValidationError) as exc_info:
Column(**_column)

assert exc_info.value.errors() == [
{
"input": {
"partition_index": None,
"data_type": "object",
"allow_null": True,
"format": None,
},
"loc": ("name",),
"msg": "Field required",
"type": "missing",
"url": "https://errors.pydantic.dev/2.3/v/missing",
}
]
expected_error = {
"input": {
"partition_index": None,
"data_type": "object",
"allow_null": True,
"format": None,
},
"loc": ("name",),
"msg": "Field required",
"type": "missing",
}

assert len(exc_info.value.errors()) == 1

actual_error = exc_info.value.errors()[0]
for key, value in expected_error.items():
assert actual_error[key] == value

def test_create_columns_fails_data_type_none(self):
_column = {
Expand All @@ -125,20 +128,23 @@ def test_create_columns_fails_data_type_none(self):
with pytest.raises(ValidationError) as exc_info:
Column(**_column)

assert exc_info.value.errors() == [
{
"input": {
"name": "column_a",
"partition_index": None,
"allow_null": True,
"format": None,
},
"loc": ("data_type",),
"msg": "Field required",
"type": "missing",
"url": "https://errors.pydantic.dev/2.3/v/missing",
}
]
expected_error = {
"input": {
"name": "column_a",
"partition_index": None,
"allow_null": True,
"format": None,
},
"loc": ("data_type",),
"msg": "Field required",
"type": "missing",
}

assert len(exc_info.value.errors()) == 1

actual_error = exc_info.value.errors()[0]
for key, value in expected_error.items():
assert actual_error[key] == value

def test_returns_dictionary_of_model(self):
_column = {
Expand Down

0 comments on commit be3eff8

Please sign in to comment.