Skip to content

Commit

Permalink
Test more cases
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Oct 25, 2024
1 parent e22b386 commit 7e3ec8d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tests/core/test_connector_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ def my_type_to_jsonschema(self, column_type) -> dict: # noqa: ARG002
assert m.to_jsonschema(sa.types.BOOLEAN()) == {"type": ["boolean"]}


class TestJSONSchemaToSQL:
class TestJSONSchemaToSQL: # noqa: PLR0904
@pytest.fixture
def json_schema_to_sql(self) -> JSONSchemaToSQL:
return JSONSchemaToSQL()
Expand Down Expand Up @@ -580,13 +580,23 @@ def test_anyof_datetime(self, json_schema_to_sql: JSONSchemaToSQL):
def test_anyof_integer(self, json_schema_to_sql: JSONSchemaToSQL):
jsonschema_type = {
"anyOf": [
{"type": "integer"},
{"type": "null"},
{"type": "integer"},
],
}
result = json_schema_to_sql.to_sql_type(jsonschema_type)
assert isinstance(result, sa.types.INTEGER)

def test_anyof_unknown(self, json_schema_to_sql: JSONSchemaToSQL):
jsonschema_type = {
"anyOf": [
{"type": "null"},
{"type": "unknown"},
],
}
result = json_schema_to_sql.to_sql_type(jsonschema_type)
assert isinstance(result, sa.types.VARCHAR)

@pytest.mark.parametrize(
"jsonschema_type,expected_type",
[
Expand Down

0 comments on commit 7e3ec8d

Please sign in to comment.