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

add parentheses to method area_code #1781

Closed
wants to merge 1 commit into from
Closed

add parentheses to method area_code #1781

wants to merge 1 commit into from

Conversation

YuriyCherniy
Copy link
Contributor

Without parentheses the test_area_code is trying compare this: <bound method Phone.area_code of <phone_number.Phone object at 0x7f0426e266d8>> != '223' instead of this: '223' == '223' so the test cannot be passed.

@YuriyCherniy YuriyCherniy requested a review from a team as a code owner May 21, 2019 19:12
@cmccandless
Copy link
Contributor

This is not a bug. Phone.area_code should be a property, not a method.

@YuriyCherniy
Copy link
Contributor Author

This is not a bug. Phone.area_code should be a property, not a method.

But why without parentheses test returns FAILED (failures=1)? and with parentheses OK?

@cmccandless
Copy link
Contributor

Because you've implemented Phone.area_code as a method in your solution. This is incorrect. Correct example:

class Phone(object):
    def __init__(self, number):
        self.area_code = <value of area code>

@YuriyCherniy
Copy link
Contributor Author

Because you've implemented Phone.area_code as a method in your solution. This is incorrect. Correct example:

class Phone(object):
    def __init__(self, number):
        self.area_code = <value of area code>

Ok. I got it. Thank you.

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.

None yet

2 participants