Skip to content

BUG: off-by-one when doing network test repeats #4485

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pandas/io/tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,13 @@ def test_fred(self):
Throws an exception when DataReader can't get a 200 response from
FRED.
"""

raise nose.SkipTest('Skip as this is unstable #4427 ')
start = datetime(2010, 1, 1)
end = datetime(2013, 1, 27)

self.assertEquals(
web.DataReader("GDP", "fred", start, end)['GDP'].tail(1),
15984.1)
received = web.DataReader("GDP", "fred", start, end)['GDP'].tail(1)[0]
self.assertEquals(int(received), 16535)

self.assertRaises(Exception, web.DataReader, "NON EXISTENT SERIES",
'fred', start, end)
Expand Down
2 changes: 1 addition & 1 deletion pandas/util/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ def network_wrapper(*args, **kwargs):
except SkipTest:
raise
except Exception as e:
if runs < num_runs:
if runs < num_runs - 1:
Copy link
Member

Choose a reason for hiding this comment

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

i think if runs <= num_runs: is clearer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure how that would help, or did I miss something?

In [6]: 0 < 2
Out[6]: True

In [7]: 1 < 2
Out[7]: True

In [8]: 0 <= 2
Out[8]: True

In [9]: 1 <= 2
Out[9]: True

In [10]: 0 < 2 -1
Out[10]: True

In [11]: 1 < 2 -1
Out[11]: False

Copy link
Member

Choose a reason for hiding this comment

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

whoops, sorry, you're right...don't know what i was thinking

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No worries, two hard problems in computer science, cache invalidation and naming things and off-by-one errors.

Copy link
Contributor

Choose a reason for hiding this comment

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

@esc haha - very clever :)

print("Failed: %r" % e)
else:
raise
Expand Down