FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.12] gh-118899: Add tests for `NotImplemented` attribute access (GH-118902) by miss-islington · Pull Request #118969 · python/cpython · GitHub

/ cpython Public
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
18 changes: 18 additions & 0 deletions Lib/test/test_builtin.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2091,6 +2091,24 @@ def test_warning_notimplemented(self):
with self.assertWarns(DeprecationWarning):
self.assertFalse(not NotImplemented)

def test_singleton_attribute_access(self):
for singleton in (NotImplemented, Ellipsis):
with self.subTest(singleton):
self.assertIs(type(singleton), singleton.__class__)
self.assertIs(type(singleton).__class__, type)

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

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


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

Back | FazBrowse Home | New Git URL