Thanks to visit codestin.com
Credit goes to github.com

Skip to content

implement more property features #5828

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Lib/test/test_descr.py
Original file line number Diff line number Diff line change
Expand Up @@ -2356,8 +2356,6 @@ class D(object):
else:
self.fail("expected ZeroDivisionError from bad property")

# TODO: RUSTPYTHON
@unittest.expectedFailure
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
def test_properties_doc_attrib(self):
Expand All @@ -2384,8 +2382,6 @@ def test_testcapi_no_segfault(self):
class X(object):
p = property(_testcapi.test_with_docstring)

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_properties_plus(self):
class C(object):
foo = property(doc="hello")
Expand Down
24 changes: 0 additions & 24 deletions Lib/test/test_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,32 +100,24 @@ def test_property_decorator_subclass(self):
self.assertRaises(PropertySet, setattr, sub, "spam", None)
self.assertRaises(PropertyDel, delattr, sub, "spam")

# TODO: RUSTPYTHON
@unittest.expectedFailure
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
def test_property_decorator_subclass_doc(self):
sub = SubClass()
self.assertEqual(sub.__class__.spam.__doc__, "SubClass.getter")

# TODO: RUSTPYTHON
@unittest.expectedFailure
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
def test_property_decorator_baseclass_doc(self):
base = BaseClass()
self.assertEqual(base.__class__.spam.__doc__, "BaseClass.getter")

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_property_decorator_doc(self):
base = PropertyDocBase()
sub = PropertyDocSub()
self.assertEqual(base.__class__.spam.__doc__, "spam spam spam")
self.assertEqual(sub.__class__.spam.__doc__, "spam spam spam")

# TODO: RUSTPYTHON
@unittest.expectedFailure
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
def test_property_getter_doc_override(self):
Expand All @@ -136,8 +128,6 @@ def test_property_getter_doc_override(self):
self.assertEqual(newgetter.spam, 8)
self.assertEqual(newgetter.__class__.spam.__doc__, "new docstring")

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_property___isabstractmethod__descriptor(self):
for val in (True, False, [], [1], '', '1'):
class C(object):
Expand Down Expand Up @@ -169,8 +159,6 @@ def test_property_builtin_doc_writable(self):
p.__doc__ = 'extended'
self.assertEqual(p.__doc__, 'extended')

# TODO: RUSTPYTHON
@unittest.expectedFailure
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
def test_property_decorator_doc_writable(self):
Expand Down Expand Up @@ -268,8 +256,6 @@ def spam(self):
else:
raise Exception("AttributeError not raised")

# TODO: RUSTPYTHON
@unittest.expectedFailure
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
def test_docstring_copy(self):
Expand All @@ -282,8 +268,6 @@ def spam(self):
Foo.spam.__doc__,
"spam wrapped in property subclass")

# TODO: RUSTPYTHON
@unittest.expectedFailure
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
def test_property_setter_copies_getter_docstring(self):
Expand Down Expand Up @@ -317,8 +301,6 @@ def spam(self, value):
FooSub.spam.__doc__,
"spam wrapped in property subclass")

# TODO: RUSTPYTHON
@unittest.expectedFailure
@unittest.skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
def test_property_new_getter_new_docstring(self):
Expand Down Expand Up @@ -358,20 +340,14 @@ def _format_exc_msg(self, msg):
def setUpClass(cls):
cls.obj = cls.cls()

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_get_property(self):
with self.assertRaisesRegex(AttributeError, self._format_exc_msg("has no getter")):
self.obj.foo

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_set_property(self):
with self.assertRaisesRegex(AttributeError, self._format_exc_msg("has no setter")):
self.obj.foo = None

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_del_property(self):
with self.assertRaisesRegex(AttributeError, self._format_exc_msg("has no deleter")):
del self.obj.foo
Expand Down
Loading
Loading