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

status_code requires __ne__ to work in python 2.7.x #460

Closed
bharath23 opened this issue Jan 19, 2016 · 1 comment
Closed

status_code requires __ne__ to work in python 2.7.x #460

bharath23 opened this issue Jan 19, 2016 · 1 comment

Comments

@bharath23
Copy link

Quoting to the 2.7.x data model [1]

"There are no implied relationships among the comparison operators. The truth of x==y does not imply that x!=y is false. Accordingly, when defining eq(), one should also define ne() so that the operators will behave as expected."

So in python 2.7.x one cannot do the following

browser = Browser()
browser.visit("http://www.google.com")
if browser.status_code != 200:
print("ERROR")

This however will work in python 3.x because the data model says ne will automatically invert the return code of eq

[1] https://docs.python.org/2/reference/datamodel.html

bharath23 added a commit to bharath23/tchotchke that referenced this issue Jan 23, 2016
Splinter StatusCode didnt implement __ne()__ causing issues with Python
2.7.x. We will use a patched version of splinter for issue 460 [1] available
as pull request 461 [2].

[1] cobrateam/splinter#460
[2] cobrateam/splinter#461
@andrewsmedina
Copy link
Member

closed by #645

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants