-
Notifications
You must be signed in to change notification settings - Fork 40
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 comparison operators to Location object #72
Add comparison operators to Location object #72
Conversation
Thanks for the contribution! Good to hear you found DNA Chisel useful. What is the purpose of your tool / is it public by any chance? The mentioned extra dependencies are not required for the package, we use it only for testing & development. They're installed during CI: Line 7 in 58321ce
If you wish to include them, please create a I'll try and have a look at the rest sometime but could you please provide context for your feature requirement; also just to confirm |
My bad for |
I went ahead and made a |
@Zulko - just wanted to check back-in about this PR - anything else I can provide or changes you'd like to see? |
I'm merging this today or tomorrow together with the other 2 PRs |
Unfortunately the tests fail for
Suggestions are welcome. Perhaps a solution is to implement a simple counter, for example https://stackoverflow.com/questions/45955740/counting-occurrences-without-using-collections-counter https://github.com/Edinburgh-Genome-Foundry/DnaChisel/actions/runs/5164168843/jobs/9302899033 |
I just updated the PR with a commit which adds in a I think this should address the issue with the Can you take a look? |
Thank you, that was helpful. Tests pass, so I'll make a release by tomorrow after merging the other PR. |
I was writing some unit tests for a tool I wrote which uses DnaChisel. I wanted to assert equality between some Location objects, but found that currently Location only supports
<
and it looks like it tries to support>=
.This PR does the following:
__eq__
method to theLocation
class so that we can test for equality now.__geq__
method - I believe the correct syntax would have been__ge__
. However we don't need this method now because I also:total_ordering
decorator to the definition of theLocation
class. This decorator will automatically create all comparison operators as long as the class has a definition of__eq__
and one other comparison - in this case we also have__lt__
==
,>=
and<
comparisons all work.