Skip to content

Commit

Permalink
Add failing test for complex type case
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Oct 25, 2024
1 parent 90e9b3d commit c4bba9d
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions tests/core/test_connector_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,17 +587,29 @@ def test_anyof_integer(self, json_schema_to_sql: JSONSchemaToSQL):
result = json_schema_to_sql.to_sql_type(jsonschema_type)
assert isinstance(result, sa.types.INTEGER)

def test_complex(self, json_schema_to_sql: JSONSchemaToSQL):
jsonschema_type = {
"type": [
"array",
"object",
"boolean",
"null",
]
}
@pytest.mark.parametrize(
"jsonschema_type,expected_type",
[
pytest.param(
{"type": ["array", "object", "boolean", "null"]},
sa.types.VARCHAR,
id="array-first",
),
pytest.param(
{"type": ["boolean", "array", "object", "null"]},
sa.types.VARCHAR,
id="boolean-first",
),
],
)
def test_complex(
self,
json_schema_to_sql: JSONSchemaToSQL,
jsonschema_type: dict,
expected_type: type[sa.types.TypeEngine],
):
result = json_schema_to_sql.to_sql_type(jsonschema_type)
assert isinstance(result, sa.types.VARCHAR)
assert isinstance(result, expected_type)

def test_unknown_type(self, json_schema_to_sql: JSONSchemaToSQL):
jsonschema_type = {"cannot": "compute"}
Expand Down

0 comments on commit c4bba9d

Please sign in to comment.