You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to update packages of python-radon for openSUSE/Tumbleweed, the test suite fails with these errors (comparing two floating point variables with ==? Really?):
[ 10s] =================================== FAILURES ===================================
[ 10s] ____ test_visitor[\n a += 3\n b += 4\n c *= 3\n -expected7] ____
[ 10s]
[ 10s] code = '\n a += 3\n b += 4\n c *= 3\n ', expected = (3, 6, 2, 5)
[ 10s]
[ 10s] @pytest.mark.parametrize('code,expected', SIMPLE_BLOCKS)
[ 10s] def test_visitor(code, expected):
[ 10s] visitor = HalsteadVisitor.from_code(dedent(code))
[ 10s] > assert expected == (visitor.operators, visitor.operands,
[ 10s] visitor.distinct_operators, visitor.distinct_operands)
[ 10s] E assert (3, 6, 2, 5) == (3, 6, 2, 6)
[ 10s] E At index 3 diff: 5 != 6
[ 10s] E Full diff:
[ 10s] E - (3, 6, 2, 5)
[ 10s] E ? ^
[ 10s] E + (3, 6, 2, 6)
[ 10s] E ? ^
[ 10s]
[ 10s] radon/tests/test_halstead.py:71: AssertionError
[ 10s] _ test_visitor[\n a = b < 4\n c = i <= 45 >= d\n k = 4 < 2\n -expected9] _
[ 10s]
[ 10s] code = '\n a = b < 4\n c = i <= 45 >= d\n k = 4 < 2\n '
[ 10s] expected = (4, 7, 3, 6)
[ 10s]
[ 10s] @pytest.mark.parametrize('code,expected', SIMPLE_BLOCKS)
[ 10s] def test_visitor(code, expected):
[ 10s] visitor = HalsteadVisitor.from_code(dedent(code))
[ 10s] > assert expected == (visitor.operators, visitor.operands,
[ 10s] visitor.distinct_operators, visitor.distinct_operands)
[ 10s] E assert (4, 7, 3, 6) == (4, 7, 3, 7)
[ 10s] E At index 3 diff: 6 != 7
[ 10s] E Full diff:
[ 10s] E - (4, 7, 3, 6)
[ 10s] E ? ^
[ 10s] E + (4, 7, 3, 7)
[ 10s] E ? ^
[ 10s]
[ 10s] radon/tests/test_halstead.py:71: AssertionError
[ 10s] _ test_mi_visit[\n class A(object):\n\n def __init__(self, n):\n # this is awesome\n self.n = sum(i for i in range(n) if i&1)\n\n def m(self, j):\n """Just compute it.\n Example.\n """\n if j > 421:\n return (self.n + 2) ** j\n return (self.n - 2) ** j\n\n a = A(4)\n a.m(42) # i don't know why, but it works\n-93.84027450359395-True] _
[ 10s]
[ 10s] code = "class A(object):\n\n def __init__(self, n):\n # this is awesome\n self.n = sum(i for i in range(n) i... return (self.n + 2) ** j\n return (self.n - 2) ** j\n\na = A(4)\na.m(42) # i don't know why, but it works"
[ 10s] expected = 93.84027450359395, count_multi = True
[ 10s]
[ 10s] @pytest.mark.parametrize('code,expected,count_multi', MI_VISIT_CASES)
[ 10s] def test_mi_visit(code, expected, count_multi):
[ 10s] code = dedent(code)
[ 10s] expected = expected
[ 10s] count_multi = count_multi
[ 10s] > assert mi_visit(code, count_multi) == expected
[ 10s] E assert 93.75365939134126 == 93.84027450359395
[ 10s] E -93.75365939134126
[ 10s] E +93.84027450359395
[ 10s]
[ 10s] radon/tests/test_other_metrics.py:130: AssertionError
[ 10s] _ test_mi_visit[\n class A(object):\n\n def __init__(self, n):\n # this is awesome\n self.n = sum(i for i in range(n) if i&1)\n\n def m(self, j):\n """Just compute it.\n Example.\n """\n if j > 421:\n return (self.n + 2) ** j\n return (self.n - 2) ** j\n\n a = A(4)\n a.m(42) # i don't know why, but it works\n-88.84176333569131-False] _
[ 10s]
[ 10s] code = "class A(object):\n\n def __init__(self, n):\n # this is awesome\n self.n = sum(i for i in range(n) i... return (self.n + 2) ** j\n return (self.n - 2) ** j\n\na = A(4)\na.m(42) # i don't know why, but it works"
[ 10s] expected = 88.84176333569131, count_multi = False
[ 10s]
[ 10s] @pytest.mark.parametrize('code,expected,count_multi', MI_VISIT_CASES)
[ 10s] def test_mi_visit(code, expected, count_multi):
[ 10s] code = dedent(code)
[ 10s] expected = expected
[ 10s] count_multi = count_multi
[ 10s] > assert mi_visit(code, count_multi) == expected
[ 10s] E assert 88.75514822343865 == 88.84176333569131
[ 10s] E -88.75514822343865
[ 10s] E +88.84176333569131
[ 10s]
[ 10s] radon/tests/test_other_metrics.py:130: AssertionError
[ 10s] =================== 4 failed, 383 passed, 5 skipped in 1.17s ===================
* fix(visitor): count Constant as halstead operand
As of Python 3.8 `ast.Num` is deprecated and not counted as operand
Fixes#183
* test(tox): add py37,py38
* chore(travis-ci): add Python 3.8
Also remove the workaround for Python 3.7 as is is supported by now
* chore(setup): pin colorama to 0.4.1
Python 3.4 breaks due to tartley/colorama#244
* pin colorama to 0.4.1
When trying to update packages of python-radon for openSUSE/Tumbleweed, the test suite fails with these errors (comparing two floating point variables with
==
? Really?):Complete build logs with all details
The text was updated successfully, but these errors were encountered: