@@ -1786,9 +1786,21 @@ def test_get_list_column_type_from_js_property_fallback(self):
17861786def test_create_columns_from_json_schema (
17871787 schema : dict [str , Any ], expected : list [Column ]
17881788):
1789+ """Test successful column creation from JSON schema."""
17891790 assert _create_columns_from_json_schema (schema ) == expected
17901791
17911792
1793+ @pytest .mark .parametrize (
1794+ "schema" ,
1795+ [{}, {"properties" : []}],
1796+ ids = ["empty schema" , "properties is not a dict" ],
1797+ )
1798+ def test_create_columns_from_json_schema_exceptions (schema : dict [str , Any ]):
1799+ """Test exceptions when creating columns from invalid JSON schema."""
1800+ with pytest .raises (ValueError ):
1801+ _create_columns_from_json_schema (schema )
1802+
1803+
17921804@pytest .mark .parametrize (
17931805 "prop, name, expected_type" ,
17941806 [
@@ -1818,22 +1830,13 @@ def test_create_columns_from_json_schema(
18181830def test_create_synapse_column_from_js_property (
18191831 prop : dict [str , Any ], name : str , expected_type : ColumnType
18201832):
1833+ """Test successful column creation from JSON schema property."""
18211834 result = _create_synapse_column_from_js_property (prop , name )
18221835 assert isinstance (result , Column )
18231836 assert result .name == name
18241837 assert result .column_type == expected_type
18251838
18261839
1827- @pytest .mark .parametrize (
1828- "schema" ,
1829- [{}, {"properties" : []}],
1830- ids = ["empty schema" , "properties is not a d ict" ],
1831- )
1832- def test_create_columns_from_json_schema_exceptions (schema : dict [str , Any ]):
1833- with pytest .raises (ValueError ):
1834- _create_columns_from_json_schema (schema )
1835-
1836-
18371840@pytest .mark .parametrize (
18381841 "prop, expected" ,
18391842 [
@@ -1864,6 +1867,7 @@ def test_create_columns_from_json_schema_exceptions(schema: dict[str, Any]):
18641867 ],
18651868)
18661869def test_get_column_type_from_js_property (prop : dict [str , Any ], expected : ColumnType ):
1870+ """Test getting column type from JSON schema property."""
18671871 assert _get_column_type_from_js_property (prop ) == expected
18681872
18691873
0 commit comments