MCPcopy Index your code
hub / github.com/python/cpython / StrWithStr

Class StrWithStr

Lib/test/test_str.py:2439–2445  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2437 def test_conversion(self):
2438 # Make sure __str__() works properly
2439 class StrWithStr(str):
2440 def __new__(cls, value):
2441 self = str.__new__(cls, "")
2442 self.value = value
2443 return self
2444 def __str__(self):
2445 return self.value
2446
2447 self.assertTypedEqual(str(WithStr('abc')), 'abc')
2448 self.assertTypedEqual(str(WithStr(StrSubclass('abc'))), StrSubclass('abc'))

Callers 1

test_conversionMethod · 0.85

Calls

no outgoing calls

Tested by 1

test_conversionMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…