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 support for subtracting milliseconds from a date #581

Merged
merged 3 commits into from
Dec 18, 2019

Conversation

danielcrisp
Copy link
Contributor

Fixes #580

@codecov
Copy link

codecov bot commented Dec 17, 2019

Codecov Report

Merging #581 into develop will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #581      +/-   ##
===========================================
+ Coverage    94.72%   94.73%   +<.01%     
===========================================
  Files           16       16              
  Lines         3111     3115       +4     
===========================================
+ Hits          2947     2951       +4     
  Misses         164      164
Impacted Files Coverage Δ
mongomock/aggregate.py 97.01% <100%> (+0.01%) ⬆️

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 9b92a7e...b84cae0. Read the comment docs.

Copy link
Member

@pcorpet pcorpet left a comment

Choose a reason for hiding this comment

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

Very cool, thanks.

Please remove the subtract line from the Missing_features file as it seems pretty much implemented now.

res = self.parse(values[0]) - self.parse(values[1])
value_0 = self.parse(values[0])
value_1 = self.parse(values[1])
if isinstance(value_0, datetime.datetime) and isinstance(value_1, (int, float)):
Copy link
Member

Choose a reason for hiding this comment

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

Let's not forget about long in Python 2. I suggest you use integer_types https://six.readthedocs.io/#six.integer_types

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Awesome. Done.

@pcorpet pcorpet merged commit 277acda into mongomock:develop Dec 18, 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.

$subtract doesn't support subtracting milliseconds from a date
2 participants