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

Method test_bug1001011

Lib/test/string_tests.py:1583–1598  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1581 # Additional tests that only work with str.
1582
1583 def test_bug1001011(self):
1584 # Make sure join returns a NEW object for single item sequences
1585 # involving a subclass.
1586 # Make sure that it is of the appropriate type.
1587 # Check the optimisation still occurs for standard objects.
1588 t = self.type2test
1589 class subclass(t):
1590 pass
1591 s1 = subclass("abcd")
1592 s2 = t().join([s1])
1593 self.assertIsNot(s1, s2)
1594 self.assertIs(type(s2), t)
1595
1596 s1 = t("abcd")
1597 s2 = t().join([s1])
1598 self.assertIs(s1, s2)

Callers

nothing calls this directly

Calls 5

tFunction · 0.85
assertIsNotMethod · 0.80
subclassClass · 0.70
joinMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected