question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Test for statistics is failing under Python 2.7

See original GitHub issue
$ source activate py27
prepending //anaconda/envs/py27/bin to PATH
((py27)) pc:femto femto$ python qstrader/statistics/statistics_test.py
//anaconda/envs/py27/lib/python2.7/site-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
  warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')
//anaconda/envs/py27/lib/python2.7/site-packages/IPython/html.py:14: ShimWarning: The `IPython.html` package has been deprecated. You should import from `notebook` instead. `IPython.html.widgets` has moved to `ipywidgets`.
  "`IPython.html.widgets` has moved to `ipywidgets`.", ShimWarning)
F
======================================================================
FAIL: test_calculating_statistics (__main__.TestSimpleStatistics)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "qstrader/statistics/statistics_test.py", line 159, in test_calculating_statistics
    self.assertEqual(results["sharpe"], Decimal("1.8353"))
AssertionError: 1.8353 != Decimal('1.8353')

----------------------------------------------------------------------
Ran 1 test in 0.099s

FAILED (failures=1)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
femtotradercommented, Jun 25, 2016

This test can be run using

    self.assertAlmostEqual(float(results["sharpe"]), 1.8353)
1reaction
femtotradercommented, Jun 23, 2016

Hum… bad idea… because it’s failling now under Python 3 (and not under Python 2!)

Read more comments on GitHub >

github_iconTop Results From Across the Web

test_ssl.py and test_urllib2.py tests are failing in python2.7
tests failed due to missing python module libpython2.7-testsuite.
Read more >
1034712 – [python27] test failure in python test_urllib
Two tests in test_urllib fail. Output from the brew build log [1]: test_urllib failed -- Traceback (most recent call last): File ...
Read more >
Common migration problems — Supporting Python 3
In Python 3 the test would always fail, as you need to compare with a bytes object instead. If you don't need Python...
Read more >
Porting Python 2 Code to Python 3 — Python 3.11.1 ...
With Python 3 being the future of Python while Python 2 is still in active use, ... code knowing that any tests which...
Read more >
Getting Started With Testing in Python
In this in-depth tutorial, you'll see how to create Python unit tests, ... Is the car's computer failing? ... Ran 2 tests in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found