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

Update `test_tuple.py` from 3.13.5 by ShaharNaveh · Pull Request #5966 · RustPython/RustPython · GitHub

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
29 changes: 29 additions & 0 deletions Lib/test/test_tuple.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 @@ -42,6 +42,35 @@ def test_keyword_args(self):
with self.assertRaisesRegex(TypeError, 'keyword argument'):
tuple(sequence=())

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_keywords_in_subclass(self):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

if you are interested in, Constructor for PyTuple probably is a point to start fix this issue

class subclass(tuple):
pass
u = subclass([1, 2])
self.assertIs(type(u), subclass)
self.assertEqual(list(u), [1, 2])
with self.assertRaises(TypeError):
subclass(sequence=())

class subclass_with_init(tuple):
def __init__(self, arg, newarg=None):
self.newarg = newarg
u = subclass_with_init([1, 2], newarg=3)
self.assertIs(type(u), subclass_with_init)
self.assertEqual(list(u), [1, 2])
self.assertEqual(u.newarg, 3)

class subclass_with_new(tuple):
def __new__(cls, arg, newarg=None):
self = super().__new__(cls, arg)
self.newarg = newarg
return self
u = subclass_with_new([1, 2], newarg=3)
self.assertIs(type(u), subclass_with_new)
self.assertEqual(list(u), [1, 2])
self.assertEqual(u.newarg, 3)

def test_truth(self):
super().test_truth()
self.assertTrue(not ())
Expand Down
Loading

Back | FazBrowse Home | New Git URL