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

Method test_mixed_iadd

Lib/test/test_userlist.py:82–112  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

80 self.assertIs(type(u), UserListSubclass)
81
82 def test_mixed_iadd(self):
83 for t in UserList, list, str, tuple, iter:
84 with self.subTest(t.__name__):
85 u = u2 = UserList("spam")
86 u += t("eggs")
87 self.assertEqual(u, list("spameggs"))
88 self.assertIs(type(u), UserList)
89 self.assertIs(u, u2)
90
91 u = t("spam")
92 u += UserList("eggs")
93 self.assertEqual(u, list("spameggs"))
94 self.assertIs(type(u), UserList)
95
96 u = u2 = UserList("spam")
97 u += UserListSubclass("eggs")
98 self.assertEqual(u, list("spameggs"))
99 self.assertIs(type(u), UserList)
100 self.assertIs(u, u2)
101
102 u = u2 = UserListSubclass("spam")
103 u += UserList("eggs")
104 self.assertEqual(u, list("spameggs"))
105 self.assertIs(type(u), UserListSubclass)
106 self.assertIs(u, u2)
107
108 u = u2 = UserListSubclass("spam")
109 u += UserListSubclass2("eggs")
110 self.assertEqual(u, list("spameggs"))
111 self.assertIs(type(u), UserListSubclass)
112 self.assertIs(u, u2)
113
114 def test_mixed_cmp(self):
115 u = self.type2test([0, 1])

Callers

nothing calls this directly

Calls 8

UserListClass · 0.90
tFunction · 0.85
listClass · 0.85
UserListSubclassClass · 0.85
UserListSubclass2Class · 0.85
subTestMethod · 0.45
assertEqualMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected