Fix minValue/maxValue in nonNegativeDerivative/perSecond in python 3
See https://github.com/graphite-project/graphite-web/pull/2375#issuecomment-437697499
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@deniszh This issue has not been fixed as of the 1.1.10 release (commit hash b52987ac97f). Here is a test that showcases the exception with the maxValue parameter when run in a Python 3 environment, e.g. py38-django111-pyparsing2.
def test_nonNegativeDerivative_max_none(self):
seriesList = self._gen_series_list_with_data(key='test',start=0,end=600,step=60,data=[None, 1, 2, 3, 4, 5, None, 3, 2, 1])
expected = [TimeSeries('nonNegativeDerivative(test)', 0, 600, 60, [None, None, 1, 1, 1, 1, None, None, None, None])]
result = functions.nonNegativeDerivative({}, seriesList,10)
print(list(result[0]))
self.assertEqual(expected, result, 'nonNegativeDerivative result incorrect')
Running tox -r -e py38-django111-pyparsing2 -- tests.test_functions.FunctionsTest.test_nonNegativeDerivative_max_none fails with
ERROR: test_nonNegativeDerivative_max_none (tests.test_functions.FunctionsTest)
Traceback (most recent call last): File "/home/sschmieta/tmp/graphite-web/webapp/tests/test_functions.py", line 1759, in test_nonNegativeDerivative_max_none result = functions.nonNegativeDerivative({}, seriesList,10) File "/home/sschmieta/tmp/graphite-web/webapp/graphite/render/functions.py", line 2409, in nonNegativeDerivative delta, prev = _nonNegativeDelta(val, prev, maxValue, minValue) File "/home/sschmieta/tmp/graphite-web/webapp/graphite/render/functions.py", line 2432, in _nonNegativeDelta if maxValue is not None and val > maxValue: TypeError: '>' not supported between instances of 'NoneType' and 'int' Can this issue be reopened?
Looks like it. Not sure why tests are working, though.
Looks like it. Not sure why tests are working, though.
There isn't currently a test with maxValue set but a None value in the series. The test I gave above is a new one I created to reproduce the error.