Skip to content

Add set.{__iter__,__ior__,__iand__,__isub__,__ixor__} #524

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

Merged
merged 2 commits into from
Feb 23, 2019

Conversation

palaviv
Copy link
Contributor

@palaviv palaviv commented Feb 22, 2019

No description provided.

@codecov-io
Copy link

Codecov Report

Merging #524 into master will increase coverage by 0.09%.
The diff coverage is 74.35%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #524      +/-   ##
==========================================
+ Coverage   50.34%   50.44%   +0.09%     
==========================================
  Files          68       68              
  Lines       13868    13893      +25     
  Branches     3436     3441       +5     
==========================================
+ Hits         6982     7008      +26     
+ Misses       5035     5029       -6     
- Partials     1851     1856       +5
Impacted Files Coverage Δ
vm/src/obj/objset.rs 56.23% <74.35%> (+2.57%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c22fb58...fc10560. Read the comment docs.

except TypeError:
pass
else:
assert False, "TypeError not raised"
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you use the assert_raises function for these checks? Just makes these a bit less verbose

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You cant do assignment inside lambda function so the best I can think about is something like this:

a = [set([1,2,3])]
def f():
    a[0] |= set([4,5])
assert_raises(TypeError, f)

I believe the current option is more clear. Any other suggestion?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I completely missed that it's an assignment! Hopefully in the future we'll have something like assertRaises from unittest:

with self.assertRaises(TypeError):
    a[0] |= set([4,5])

Copy link
Contributor

Choose a reason for hiding this comment

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

The with statement should work, so we could do the same now by implementing a contextmanager.

@windelbouwman windelbouwman merged commit 3f8f0e2 into RustPython:master Feb 23, 2019
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.

4 participants