Skip to content

Commit

Permalink
pythongh-118899: Add tests for NotImplemented attribute access
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn committed May 10, 2024
1 parent 7ac933e commit 49d3e6a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Lib/test/test_builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2138,6 +2138,22 @@ def test_bool_notimplemented(self):
with self.assertRaisesRegex(TypeError, msg):
not NotImplemented

def test_not_implemented(self):
self.assertIs(type(NotImplemented), NotImplemented.__class__)
self.assertIs(type(NotImplemented).__class__, type)

# Missing instance attributes:
with self.assertRaises(AttributeError):
NotImplemented.prop
with self.assertRaises(AttributeError):
NotImplemented.prop = 1

# Missing class attributes:
with self.assertRaises(AttributeError):
type(NotImplemented).prop
with self.assertRaises(TypeError):
type(NotImplemented).prop = 1


class TestBreakpoint(unittest.TestCase):
def setUp(self):
Expand Down

0 comments on commit 49d3e6a

Please sign in to comment.