Skip to content

Commit 082d1e7

Browse files
committed
Patch lsst schema init test
1 parent 157d512 commit 082d1e7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Diff for: tests/test_registry.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,14 @@ def test_serialize_without_definition(self):
5252
schema.serialize({})
5353

5454
def test_unsupported_version_lsst(self):
55+
# LSST schema versions are retrieved from the avro header.
56+
# Write an avro header with an unsupported version_id.
5557
unsuported_version_id = 601
56-
# LSST schemas get the version from the alert bytes.
57-
# Write an avro header with the unsupported version_id.
5858
fout = io.BytesIO()
5959
fout.write(b"\x00")
6060
fout.write(struct.pack(">i", unsuported_version_id))
6161
# Try to load the schema definition and show that it raises an error.
62-
schema = pittgoogle.Alert.from_dict({"key": "value"}, schema_name="lsst").schema
6362
with pytest.raises(pittgoogle.exceptions.SchemaError, match="Schema definition not found"):
64-
schema._init_from_bytes(schema=schema, alert_bytes=fout.getvalue())
63+
pittgoogle.Alert.from_msg(
64+
pittgoogle.types_.PubsubMessageLike(data=fout.getvalue()), schema_name="lsst"
65+
)

0 commit comments

Comments
 (0)