Created
November 8, 2022 15:10
-
-
Save braingram/67844db5adde45454d7312269c58532a to your computer and use it in GitHub Desktop.
Comparing dither enum values in core.schema between current HEAD and PR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import yaml | |
old_schema_url = "https://raw.githubusercontent.com/spacetelescope/jwst/e154d67fa415ce526cfd9359ae4330bd56c112a6/jwst/datamodels/schemas/core.schema.yaml" | |
new_schema_url = "https://raw.githubusercontent.com/braingram/jwst/bug/schema_nonunique_enum/jwst/datamodels/schemas/core.schema.yaml" | |
enum_values = [] | |
for url in (old_schema_url, new_schema_url): | |
with requests.get(url) as r: | |
d = yaml.safe_load(r.text) | |
vs = d['properties']['meta']['properties']['dither']['properties']['primary_type']['enum'] | |
enum_values.append(vs) | |
# compare values | |
ref = set(enum_values[0]) | |
print(f"Using reference values (n={len(ref)})") | |
for vs in enum_values[1:]: | |
comparison = set(vs) | |
if ref != comparison: | |
raise Exception("Enum values do not match!") | |
print(f"enum values (n={len(comparison)}) matches reference") | |
print("All enums matched reference:") | |
print(sorted(list(ref))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example output: