Skip to content

case error in test_unary.py #99688

@Isaac-Lee

Description

@Isaac-Lee

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.

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.

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)

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.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy