Skip to content

Conversation

@pierceroberts
Copy link

@pierceroberts pierceroberts commented Mar 8, 2025

related to this issue: #460

@github-actions
Copy link

github-actions bot commented Mar 8, 2025

CLA Assistant Lite bot:
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request

Copy link
Contributor

@bh2smith bh2smith left a comment

Choose a reason for hiding this comment

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

There are a few things here that, I think could be improved.

import datetime
from src.data_sync.common import partition_time_range

def test_partition_time_range(mocker: MockerFixture):
Copy link
Contributor

Choose a reason for hiding this comment

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

This mocker does not appear to be used for anything and can probably be removed.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the comments @bh2smith as this is still in draft I still have quite a few tests to add, so when I am done I'll clean up everything and mark it as ready. I also wanted to open up the draft PR so that you all could see I was working on it.
Does cowprotocol use draft PR's?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ya drafts are cool. 😎 just wanted to share some feedback on your draft before you had to go and change way more of the same stuff.

Copy link
Author

Choose a reason for hiding this comment

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

Okay cool. Also I think we should add an additional check in the partition_time_range function as it assumes start and end times are in utc but doesn't enforce it.
When using relativedelta you can get this error:

TypeError: can't compare offset-naive and offset-aware datetimes

I can add it and you can see.


# test that if they are equal or negative the function raises an error
with pytest.raises(AssertionError):
partition_time_range(start_time=start_time, end_time=start_time)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Given that the parameters have the same name as the expected input, I don't think this needs to be repeated.

Copy link
Author

Choose a reason for hiding this comment

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

Not sure what you mean. This is testing the assert in the function and it's clear that the inputs are the same so it should fail.

service_fee: Fraction,
reward_token_address: Address,
):

Copy link
Author

Choose a reason for hiding this comment

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

this was from running black ./

Otherwise, the range is split into n pieces of the form [(start_time, start_of_month_2),
(start_of_month_2, start_of_month_3),..., (start_of_month_n, end_time)].
"""
assert (
Copy link
Author

Choose a reason for hiding this comment

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

@bh2smith I added this to one function. What do you think?

Are you cool with me adding them to the others or would you prefer I create a utility function for this check?
Thanks for the input.

@pierceroberts
Copy link
Author

@bh2smith Can you please re-look at this as it's been awhile and I haven't gotten a response thanks.

@pierceroberts pierceroberts marked this pull request as ready for review July 9, 2025 04:44
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.

2 participants