Skip to content

Commit d0d96fa

Browse files
committed
Updates comments and addes a to_api_repr test
1 parent b0a7fb1 commit d0d96fa

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

tests/unit/test_dataset.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,13 +1052,23 @@ def test_external_catalog_dataset_options_getter(self):
10521052
assert result == expected
10531053

10541054
def test_external_catalog_dataset_options_from_api_repr(self):
1055+
resource = self.API_REPR
1056+
klass = self._get_target_class()
1057+
dataset = klass.from_api_repr(resource)
1058+
result = dataset.external_catalog_dataset_options.to_api_repr()
1059+
expected = resource["externalCatalogDatasetOptions"]
1060+
assert result == expected
1061+
1062+
def test_external_catalog_dataset_options_to_api_repr(self):
10551063
resource = self.API_REPR
10561064
klass = self._get_target_class()
10571065
dataset = klass.from_api_repr(resource)
10581066
result = dataset.external_catalog_dataset_options._properties
10591067
expected = resource["externalCatalogDatasetOptions"]
10601068
assert result == expected
10611069

1070+
1071+
10621072
def test__build_resource_w_custom_field(self):
10631073
dataset = self._make_one(self.DS_REF)
10641074
dataset._properties["newAlphaProperty"] = "unreleased property"

tests/unit/test_external_config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,10 +939,13 @@ def test_ctor_invalid_input(self):
939939
"""Test ExternalCatalogDatasetOptions constructor with invalid input."""
940940
with pytest.raises(TypeError) as e:
941941
self._make_one(default_storage_location_uri=123)
942+
943+
# Looking for the first word from the string "Pass <variable> as..."
942944
assert "Pass " in str(e.value)
943945

944946
with pytest.raises(TypeError) as e:
945947
self._make_one(parameters=123)
948+
# Looking for the first word from the string "Pass <variable> as..."
946949
assert "Pass " in str(e.value)
947950

948951
def test_to_api_repr(self):
@@ -1071,6 +1074,7 @@ def test_ctor_invalid_input(
10711074
storage_descriptor=storage_descriptor,
10721075
)
10731076

1077+
# Looking for the first word from the string "Pass <variable> as..."
10741078
assert "Pass " in str(e.value)
10751079

10761080
def test_to_api_repr(self, _make_storage_descriptor):

tests/unit/test_schema.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,9 @@ def test_ctor_valid_input(self, type_system, expected):
11441144
def test_ctor_invalid_input(self):
11451145
with pytest.raises(TypeError) as e:
11461146
self._make_one(type_system=123)
1147-
assert "Pass" in str(e.value)
1147+
1148+
# Looking for the first word from the string "Pass <variable> as..."
1149+
assert "Pass " in str(e.value)
11481150

11491151
@pytest.mark.parametrize(
11501152
"type_system,expected",
@@ -1229,7 +1231,9 @@ def test_ctor_invalid_input(
12291231
output_format=output_format,
12301232
serde_info=serde_info,
12311233
)
1232-
assert "Pass" in str(e.value)
1234+
1235+
# Looking for the first word from the string "Pass <variable> as..."
1236+
assert "Pass " in str(e.value)
12331237

12341238
def test_to_api_repr(self):
12351239
storage_descriptor = self._make_one(
@@ -1246,6 +1250,7 @@ def test_to_api_repr(self):
12461250
}
12471251

12481252
assert storage_descriptor.to_api_repr() == expected_repr
1253+
# TODO: needs a from_api_repr() test.
12491254

12501255

12511256
class TestSerDeInfo:
@@ -1293,8 +1298,8 @@ def test_ctor_invalid_input(self, serialization_library, name, parameters):
12931298
name=name,
12941299
parameters=parameters,
12951300
)
1296-
1297-
assert "Pass" in str(e.value)
1301+
# Looking for the first word from the string "Pass <variable> as..."
1302+
assert "Pass " in str(e.value)
12981303

12991304
def test_to_api_repr(self):
13001305
serde_info = self._make_one(
@@ -1308,3 +1313,5 @@ def test_to_api_repr(self):
13081313
"parameters": {"key": "value"},
13091314
}
13101315
assert serde_info.to_api_repr() == expected_repr
1316+
1317+
# TODO: needs a from_api_repr() test.

0 commit comments

Comments
 (0)