Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1656864: Python: Fix kebab-case to snake_case in loader #1122

Merged
merged 1 commit into from
Aug 4, 2020

Conversation

mdboom
Copy link
Contributor

@mdboom mdboom commented Aug 3, 2020

No description provided.

@auto-assign auto-assign bot requested a review from badboy August 3, 2020 22:14


def test_kebab_case_pings():
pings = load_pings(ROOT / "data" / "pings.yaml")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the pings.yaml is not yet committed, so you probably want to include it in this commit.

@@ -14,7 +17,9 @@


def test_builtin_pings():
assert set(dir(_builtins.pings)).issuperset(set(["metrics", "baseline", "events"]))
assert set(dir(_builtins.pings)).issuperset(
set(["metrics", "baseline", "events", "deletion_request"])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, good to see this fix. Why do we test for superset and not just equality?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... I'm not sure. Let me just make it equality which will help us catch unexpected changes better in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

superset is needed because the object also contains a bunch of members that exist on every Python object, as well as the reason_code members:

['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'baseline', 'baseline_reason_codes', 'deletion_request', 'deletion_request_reason_codes', 'events', 'events_reason_codes', 'metrics', 'metrics_reason_codes']

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ugh, in that case it's just a bad test really, as it already missed the deletion_request part.
Maybe we need to iterate over that, filter by instances of ping and check that against our exact list?
Let's break that out though.

@mdboom mdboom merged commit 5bbb55d into mozilla:main Aug 4, 2020
@mdboom mdboom deleted the fix-kebab-case-pings branch August 4, 2020 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants