mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Add a test on str.__getnewargs__()
It tests indirectly PyUnicode_Copy(): ensure that the string is a copy.
This commit is contained in:
parent
f01245067a
commit
c814a38f3f
1 changed files with 7 additions and 0 deletions
|
@ -1836,6 +1836,13 @@ class UnicodeTest(string_tests.CommonTest,
|
||||||
self.assertEqual(transform_decimal('123\u20ac'),
|
self.assertEqual(transform_decimal('123\u20ac'),
|
||||||
'123\u20ac')
|
'123\u20ac')
|
||||||
|
|
||||||
|
def test_getnewargs(self):
|
||||||
|
text = 'abc'
|
||||||
|
args = text.__getnewargs__()
|
||||||
|
self.assertIsNot(args[0], text)
|
||||||
|
self.assertEqual(args[0], text)
|
||||||
|
self.assertEqual(len(args), 1)
|
||||||
|
|
||||||
|
|
||||||
class StringModuleTest(unittest.TestCase):
|
class StringModuleTest(unittest.TestCase):
|
||||||
def test_formatter_parser(self):
|
def test_formatter_parser(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue