Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

test: switch to regex rather than asserting against whole object#497

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
bcoe merged 8 commits intomainfromtweak-test-slightly
Apr 20, 2023

Conversation

@bcoe
Copy link

@bcoebcoe commentedApr 18, 2023
edited
Loading

The goal of this test is to assert against the helper:

def__repr__(self):return"ClientOptions: "+repr(self.__dict__)

Rather than asserting against the whole object which is fragile, this just uses a regex to make sure that we've populated the prefix and the keys.

Fixes#449,#492


FYI: here's the commit for the original test, which I believe a simple regex that asserts the basic structure of the serialized object is closer to the spirit ofb6cea3c

@bcoebcoe requested review froma team ascode ownersApril 18, 2023 17:35
@product-auto-labelproduct-auto-labelbot added the size: sPull request size is small. labelApr 18, 2023
@bcoebcoe requested a review fromvchudnov-gApril 18, 2023 18:54
@bcoebcoe changed the titletest: switch to asserting against set of keystest: switch to regex rather than asserting against whole objectApr 19, 2023
@bcoebcoe requested a review fromvchudnov-gApril 19, 2023 14:20
@bcoebcoe mentioned this pull requestApr 19, 2023
Copy link
Contributor

@vchudnov-gvchudnov-g left a comment

Choose a reason for hiding this comment

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

Yeah, I'm guessing the new structure probably captures the original intent of the test. But that's not to say that the key check you introduced earlier is bad; maybe it's worth keeping as an additional test?

Co-authored-by: Victor Chudnovsky <vchudnov@google.com>
@bcoe
Copy link
Author

But that's not to say that the key check you introduced earlier is bad; maybe it's worth keeping as an additional test?

One argument I'd make for not keeping it, is it does mean the test will need to be updated as we update the options bag over time. I was wondering if this is needed, given what we're really testing is the serialization.

@vchudnov-g
Copy link
Contributor

test_repr tests the serialization, so we can leave that as it now stands after your changes.

The set comparison you introduced earlier and then removed would be an additional test on the options object. I generally agree we don't want to have to make a lot of dependent manual changes when something fundamental changes. However, if we don't check anywhere else for the keys that are in this bag, this would be a good signal in case something accidentally gets deleted. I don't know whether we test these keys elsewhere. I assume new options don't get added all that frequently? (real question; I don't know)

So I could go either way, as I'm not super familiar with how these options are used or tested. But my inclination is to add back (in a separate test) the set-based key check you had earlier, precisely as a safequard against accidental deletion. But I'm certainly not fixated on this, and am happy to hear reasons not to.@parthea , WDYT?

@bcoe
Copy link
Author

The set comparison you introduced earlier and then removed would be an additional test on the options object.

Okay, I've added it back.

@bcoebcoe merged commit6acb3a9 intomainApr 20, 2023
@bcoebcoe deleted the tweak-test-slightly branchApril 20, 2023 15:34
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@vchudnov-gvchudnov-gvchudnov-g left review comments

@partheapartheaparthea approved these changes

Assignees

No one assigned

Labels

size: sPull request size is small.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

assert in test_repr is always true

3 participants

@bcoe@vchudnov-g@parthea

[8]ページ先頭

©2009-2025 Movatter.jp