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

Added mocking for test_eve.py #2961

Closed
wants to merge 6 commits into from

Conversation

yashrsharma44
Copy link
Member

@yashrsharma44 yashrsharma44 commented Mar 6, 2019

  1. Used mocking to simulate online test
  2. Online test function to cross-check the mocking function
  3. Used parametrization wherever possible

Partial work for #2874

1. Used mocking to simulate online test
2. Online test function to cross-check the mocking function
3. Used parametrization wherever possible
@pep8speaks
Copy link

pep8speaks commented Mar 6, 2019

Hello @yashrsharma44! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 58:9: E128 continuation line under-indented for visual indent
Line 59:9: E128 continuation line under-indented for visual indent
Line 103:17: E128 continuation line under-indented for visual indent
Line 109:17: E128 continuation line under-indented for visual indent
Line 114:41: E231 missing whitespace after ','
Line 178:13: E128 continuation line under-indented for visual indent
Line 179:13: E128 continuation line under-indented for visual indent
Line 180:1: E124 closing bracket does not match visual indentation
Line 202:18: E127 continuation line over-indented for visual indent

Comment last updated at 2019-03-31 19:06:58 UTC

@ghost
Copy link

ghost commented Mar 6, 2019

Thanks for the pull request @yashrsharma44! Everything looks great!

@nabobalis nabobalis added this to the 1.0 milestone Mar 7, 2019
@nabobalis nabobalis added Tests Affects tests in some measure Refactoring Code changes without affecting API (generally) net Affects the net submodule labels Mar 7, 2019
Copy link
Member

@vn-ki vn-ki left a comment

Choose a reason for hiding this comment

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

I'm so sorry for the style nits. 😅

sunpy/net/dataretriever/tests/test_eve.py Outdated Show resolved Hide resolved
'physobs': 'irradiance',
'provider': 'LASP'
}
st_datetime = datetime.strptime(start_date, '%Y/%m/%d')
Copy link
Member

Choose a reason for hiding this comment

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

IMO, you shouldn't use datetime in the codebase XD (Because we have switched to astropy.time for our time related stuff and it can do everything datetime can).

But maybe @Cadair and @nabobalis might have a different opinion.

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried parsing the date in the %Y/%m/%d format in astropy.time if I remember it correctly. But it wasn't working in the way as expected. So I switched to datetime.

Copy link
Contributor

Choose a reason for hiding this comment

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

If it fails with astropy.time.Time it would be good to know, it might be a bug upstream. I would have thought that that would have worked with astropy.time.Time. But I have no real issue with using datetime in the tests.

Copy link
Member Author

Choose a reason for hiding this comment

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

Let me try that, I would update you with the working.

Copy link
Member Author

Choose a reason for hiding this comment

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

I got this error while parsing -

>>> from astropy import time
>>> a = time.Time('2012/10/4')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/yash/sunpydev/vnv37/lib/python3.7/site-packages/astropy/time/core.py", line 399, in __init__
    precision, in_subfmt, out_subfmt)
  File "/home/yash/sunpydev/vnv37/lib/python3.7/site-packages/astropy/time/core.py", line 454, in _init_from_vals
    precision, in_subfmt, out_subfmt)
  File "/home/yash/sunpydev/vnv37/lib/python3.7/site-packages/astropy/time/core.py", line 505, in _get_time_fmt
    raise ValueError('Input values did not match {0}'.format(err_msg))
ValueError: Input values did not match any of the formats where the format keyword is optional ['datetime', 'iso', 'isot', 'yday', 'datetime64', 'fits', 'byear_str', 'jyear_str']

sunpy/net/dataretriever/tests/test_eve.py Outdated Show resolved Hide resolved
if level is 0:
resp.client = LCClient
else:
resp.client = VSOClient()
Copy link
Member

Choose a reason for hiding this comment

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

Is it VSOClient or VSOClient()?

Copy link
Member Author

Choose a reason for hiding this comment

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

We are using an object of VSOClient()

sunpy/net/dataretriever/tests/test_eve.py Outdated Show resolved Hide resolved
sunpy/net/dataretriever/tests/test_eve.py Outdated Show resolved Hide resolved
sunpy/net/dataretriever/tests/test_eve.py Outdated Show resolved Hide resolved
sunpy/net/dataretriever/tests/test_eve.py Outdated Show resolved Hide resolved
sunpy/net/dataretriever/tests/test_eve.py Outdated Show resolved Hide resolved
sunpy/net/dataretriever/tests/test_eve.py Outdated Show resolved Hide resolved
@Cadair Cadair modified the milestones: 1.0, 1.1 May 22, 2019
@stale
Copy link

stale bot commented Oct 19, 2019

This pull request has been automatically marked as stale because it has not had any activity for the past five months. It will be closed if no further activity occurs. If the ideas in this pull request are still worth implementing, please make sure you open an issue to keep track of that idea!

@stale stale bot added the Stale The bot will close this PR after 6 months label Oct 19, 2019
@Cadair Cadair modified the milestones: 1.1, 2.0 Oct 24, 2019
@stale
Copy link

stale bot commented Nov 23, 2019

This pull request has been automatically closed since there was no activity for a month since it was marked as stale. If the ideas in this pull request are still worth implementing, please make sure you open an issue to keep track of that idea!

@stale stale bot closed this Nov 23, 2019
@nabobalis nabobalis added the Needs Adoption PRs that were abandoned but should be picked up again and merged in label Nov 23, 2019
@nabobalis nabobalis removed this from the 2.0 milestone Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Adoption PRs that were abandoned but should be picked up again and merged in net Affects the net submodule Refactoring Code changes without affecting API (generally) Stale The bot will close this PR after 6 months Tests Affects tests in some measure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants