Skip to content

test_bad_new in test_descr is silently skipped #111128

Closed as not planned
Closed as not planned
@sobolevn

Description

@sobolevn

Code:

cpython/Lib/test/test_descr.py

Lines 1791 to 1802 in d8f32be

@unittest.expectedFailure
def test_bad_new(self):
self.assertRaises(TypeError, object.__new__)
self.assertRaises(TypeError, object.__new__, '')
self.assertRaises(TypeError, list.__new__, object)
self.assertRaises(TypeError, object.__new__, list)
class C(object):
__new__ = list.__new__
self.assertRaises(TypeError, C)
class C(list):
__new__ = object.__new__
self.assertRaises(TypeError, C)

Right now (if you remove @unittest.expectedFailure) it fails with:

======================================================================
FAIL: test_bad_new (test.test_descr.ClassPropertiesAndMethods.test_bad_new)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython/Lib/test/test_descr.py", line 1798, in test_bad_new
    self.assertRaises(TypeError, C)
AssertionError: TypeError not raised by C

----------------------------------------------------------------------
Ran 1 test in 0.002s

FAILED (failures=1)
test test_descr failed
test_descr failed (1 failure)

== Tests result: FAILURE ==

1 test failed:
    test_descr

Total duration: 100 ms
Total tests: run=1 (filtered) failures=1
Total test files: run=1/1 (filtered) failed=1
Result: FAILURE

I propose to rewrite this test to pass. Because it looks like there's no similar test.
Or we can remove it if this test is not needed.

Refs #111101

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions