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

Closes #49 duplicate-banning factories #54

Merged
merged 3 commits into from
Jun 10, 2019

Conversation

qpwo
Copy link
Contributor

@qpwo qpwo commented Jun 10, 2019

Added immutableset_from_unique_elements factory and forbid_duplicate_elements kwarg

@qpwo qpwo changed the title Close #49 duplicate-banning factories Closes #49 duplicate-banning factories Jun 10, 2019
@qpwo qpwo requested a review from gabbard June 10, 2019 19:10
@codecov
Copy link

codecov bot commented Jun 10, 2019

Codecov Report

Merging #54 into master will decrease coverage by 0.08%.
The diff coverage is 87.5%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #54      +/-   ##
==========================================
- Coverage   90.59%   90.51%   -0.09%     
==========================================
  Files           6        6              
  Lines         617      622       +5     
==========================================
+ Hits          559      563       +4     
- Misses         58       59       +1
Impacted Files Coverage Δ
immutablecollections/_immutableset.py 89.95% <87.5%> (-0.23%) ⬇️

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 6985a25...bf6455a. Read the comment docs.

immutablecollections/_immutableset.py Outdated Show resolved Hide resolved
immutablecollections/_immutableset.py Outdated Show resolved Hide resolved
immutablecollections/_immutableset.py Show resolved Hide resolved
@qpwo qpwo requested a review from gabbard June 10, 2019 19:41
@gabbard gabbard merged commit 17f722e into master Jun 10, 2019
@gabbard gabbard deleted the 49-duplicate-banning-factories branch June 10, 2019 19:44
@@ -92,6 +98,10 @@ def immutableset(
if value not in containment_set:
containment_set.add(value)
iteration_order.append(value)
elif forbid_duplicate_elements:
raise ValueError(
"Input collection has duplicate items and forbid_duplicate_elements=False"
Copy link
Contributor

Choose a reason for hiding this comment

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

This got merged before I could take a look, but could this be modified to give the repr of the duplicate element? This would make debugging much easier.

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.

3 participants