Lines Matching refs:assertAlmostEqual
20 def assertAlmostEqual(self, a, b): member in ComplexTest
23 unittest.TestCase.assertAlmostEqual(self, a.real, b.real)
24 unittest.TestCase.assertAlmostEqual(self, a.imag, b.imag)
26 unittest.TestCase.assertAlmostEqual(self, a.real, b)
27 unittest.TestCase.assertAlmostEqual(self, a.imag, 0.)
30 unittest.TestCase.assertAlmostEqual(self, a, b.real)
31 unittest.TestCase.assertAlmostEqual(self, 0., b.imag)
33 unittest.TestCase.assertAlmostEqual(self, a, b)
115 self.assertAlmostEqual(complex.__truediv__(2+0j, 1+1j), 1-1j)
124 self.assertAlmostEqual(complex.__floordiv__(3+0j, 1.5+0j), 2)
187 self.assertAlmostEqual(pow(1+1j, 0+0j), 1.0)
188 self.assertAlmostEqual(pow(0+0j, 2+0j), 0.0)
190 self.assertAlmostEqual(pow(1j, -1), 1/1j)
191 self.assertAlmostEqual(pow(1j, 200), 1)
245 self.assertAlmostEqual(complex("1+10j"), 1+10j)
246 self.assertAlmostEqual(complex(10), 10+0j)
247 self.assertAlmostEqual(complex(10.0), 10+0j)
248 self.assertAlmostEqual(complex(10L), 10+0j)
249 self.assertAlmostEqual(complex(10+0j), 10+0j)
250 self.assertAlmostEqual(complex(1,10), 1+10j)
251 self.assertAlmostEqual(complex(1,10L), 1+10j)
252 self.assertAlmostEqual(complex(1,10.0), 1+10j)
253 self.assertAlmostEqual(complex(1L,10), 1+10j)
254 self.assertAlmostEqual(complex(1L,10L), 1+10j)
255 self.assertAlmostEqual(complex(1L,10.0), 1+10j)
256 self.assertAlmostEqual(complex(1.0,10), 1+10j)
257 self.assertAlmostEqual(complex(1.0,10L), 1+10j)
258 self.assertAlmostEqual(complex(1.0,10.0), 1+10j)
259 self.assertAlmostEqual(complex(3.14+0j), 3.14+0j)
260 self.assertAlmostEqual(complex(3.14), 3.14+0j)
261 self.assertAlmostEqual(complex(314), 314.0+0j)
262 self.assertAlmostEqual(complex(314L), 314.0+0j)
263 self.assertAlmostEqual(complex(3.14+0j, 0j), 3.14+0j)
264 self.assertAlmostEqual(complex(3.14, 0.0), 3.14+0j)
265 self.assertAlmostEqual(complex(314, 0), 314.0+0j)
266 self.assertAlmostEqual(complex(314L, 0L), 314.0+0j)
267 self.assertAlmostEqual(complex(0j, 3.14j), -3.14+0j)
268 self.assertAlmostEqual(complex(0.0, 3.14j), -3.14+0j)
269 self.assertAlmostEqual(complex(0j, 3.14), 3.14j)
270 self.assertAlmostEqual(complex(0.0, 3.14), 3.14j)
271 self.assertAlmostEqual(complex("1"), 1+0j)
272 self.assertAlmostEqual(complex("1j"), 1j)
273 self.assertAlmostEqual(complex(), 0)
274 self.assertAlmostEqual(complex("-1"), -1)
275 self.assertAlmostEqual(complex("+1"), +1)
276 self.assertAlmostEqual(complex("(1+2j)"), 1+2j)
277 self.assertAlmostEqual(complex("(1.3+2.2j)"), 1.3+2.2j)
278 self.assertAlmostEqual(complex("3.14+1J"), 3.14+1j)
279 self.assertAlmostEqual(complex(" ( +3.14-6J )"), 3.14-6j)
280 self.assertAlmostEqual(complex(" ( +3.14-J )"), 3.14-1j)
281 self.assertAlmostEqual(complex(" ( +3.14+j )"), 3.14+1j)
282 self.assertAlmostEqual(complex("J"), 1j)
283 self.assertAlmostEqual(complex("( j )"), 1j)
284 self.assertAlmostEqual(complex("+J"), 1j)
285 self.assertAlmostEqual(complex("( -j)"), -1j)
286 self.assertAlmostEqual(complex('1e-500'), 0.0 + 0.0j)
287 self.assertAlmostEqual(complex('-1e-500j'), 0.0 - 0.0j)
288 self.assertAlmostEqual(complex('-1e-500+1e-500j'), -0.0 + 0.0j)
291 self.assertAlmostEqual(complex(complex2(1+1j)), 1+1j)
292 self.assertAlmostEqual(complex(real=17, imag=23), 17+23j)
293 self.assertAlmostEqual(complex(real=17+23j), 17+23j)
294 self.assertAlmostEqual(complex(real=17+23j, imag=23), 17+46j)
295 self.assertAlmostEqual(complex(real=1+2j, imag=3+4j), -3+5j)
370 self.assertAlmostEqual(complex(float2(42.)), 42)
371 self.assertAlmostEqual(complex(real=float2(17.), imag=float2(23.)), 17+23j)
392 self.assertAlmostEqual(complex(complex0(1j)), 42j)
393 self.assertAlmostEqual(complex(complex1(1j)), 2j)
482 self.assertAlmostEqual((num.real**2 + num.imag**2) ** 0.5, abs(num))