-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Description
Hello all,
I was looking throw the test code in cpython to use a test cases for my own python interpreter.
While looking at the code, I got curious.
First is this function.
cpython/Lib/test/test_unary.py
Lines 23 to 27 in 7e3f09c
def test_invert(self): self.assertTrue(-2 == 0 - 2) self.assertEqual(-0, 0) self.assertEqual(--2, 2) self.assertTrue(-2 == 0 - 2)
I think this function is not testing invert operator.
Instead it is just copying test cases of negative operator.
Next is these functions.
cpython/Lib/test/test_unary.py
Lines 7 to 13 in 7e3f09c
def test_negative(self): self.assertTrue(-2 == 0 - 2) self.assertEqual(-0, 0) self.assertEqual(--2, 2) self.assertTrue(-2 == 0 - 2) self.assertTrue(-2.0 == 0 - 2.0) self.assertTrue(-2j == 0 - 2j)
cpython/Lib/test/test_unary.py
Lines 15 to 21 in 7e3f09c
def test_positive(self): self.assertEqual(+2, 2) self.assertEqual(+0, 0) self.assertEqual(++2, 2) self.assertEqual(+2, 2) self.assertEqual(+2.0, 2.0) self.assertEqual(+2j, 2j)
I think these functions have duplicated test cases.
self.assertTrue(-2 == 0 - 2)
tested twice in test_negative,
self.assertEqual(+2, 2)
tested twice as well in test_positive.
I want to know if there is an intention that I don't know.
Or if there is a problem, I think we need to fix the test code.