MCPcopy Index your code
hub / github.com/RustPython/RustPython / testBinaryOps

Method testBinaryOps

Lib/test/test_class.py:154–271  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

152 self.assertCallStack([("__init__", (foo,))])
153
154 def testBinaryOps(self):
155 testme = AllTests()
156 # Binary operations
157
158 callLst[:] = []
159 testme + 1
160 self.assertCallStack([("__add__", (testme, 1))])
161
162 callLst[:] = []
163 1 + testme
164 self.assertCallStack([("__radd__", (testme, 1))])
165
166 callLst[:] = []
167 testme - 1
168 self.assertCallStack([("__sub__", (testme, 1))])
169
170 callLst[:] = []
171 1 - testme
172 self.assertCallStack([("__rsub__", (testme, 1))])
173
174 callLst[:] = []
175 testme * 1
176 self.assertCallStack([("__mul__", (testme, 1))])
177
178 callLst[:] = []
179 1 * testme
180 self.assertCallStack([("__rmul__", (testme, 1))])
181
182 callLst[:] = []
183 testme @ 1
184 self.assertCallStack([("__matmul__", (testme, 1))])
185
186 callLst[:] = []
187 1 @ testme
188 self.assertCallStack([("__rmatmul__", (testme, 1))])
189
190 callLst[:] = []
191 testme / 1
192 self.assertCallStack([("__truediv__", (testme, 1))])
193
194
195 callLst[:] = []
196 1 / testme
197 self.assertCallStack([("__rtruediv__", (testme, 1))])
198
199 callLst[:] = []
200 testme // 1
201 self.assertCallStack([("__floordiv__", (testme, 1))])
202
203
204 callLst[:] = []
205 1 // testme
206 self.assertCallStack([("__rfloordiv__", (testme, 1))])
207
208 callLst[:] = []
209 testme % 1
210 self.assertCallStack([("__mod__", (testme, 1))])
211

Callers

nothing calls this directly

Calls 3

assertCallStackMethod · 0.95
AllTestsClass · 0.85
divmodFunction · 0.50

Tested by

no test coverage detected