Lines Matching refs:assertAlmostEqual
16 def assertAlmostEqual(self, a, b): member in ComplexTest
19 unittest.TestCase.assertAlmostEqual(self, a.real, b.real)
20 unittest.TestCase.assertAlmostEqual(self, a.imag, b.imag)
22 unittest.TestCase.assertAlmostEqual(self, a.real, b)
23 unittest.TestCase.assertAlmostEqual(self, a.imag, 0.)
26 unittest.TestCase.assertAlmostEqual(self, a, b.real)
27 unittest.TestCase.assertAlmostEqual(self, 0., b.imag)
29 unittest.TestCase.assertAlmostEqual(self, a, b)
105 self.assertAlmostEqual(complex.__truediv__(2+0j, 1+1j), 1-1j)
171 self.assertAlmostEqual(pow(1+1j, 0+0j), 1.0)
172 self.assertAlmostEqual(pow(0+0j, 2+0j), 0.0)
174 self.assertAlmostEqual(pow(1j, -1), 1/1j)
175 self.assertAlmostEqual(pow(1j, 200), 1)
232 self.assertAlmostEqual(complex("1+10j"), 1+10j)
233 self.assertAlmostEqual(complex(10), 10+0j)
234 self.assertAlmostEqual(complex(10.0), 10+0j)
235 self.assertAlmostEqual(complex(10), 10+0j)
236 self.assertAlmostEqual(complex(10+0j), 10+0j)
237 self.assertAlmostEqual(complex(1,10), 1+10j)
238 self.assertAlmostEqual(complex(1,10), 1+10j)
239 self.assertAlmostEqual(complex(1,10.0), 1+10j)
240 self.assertAlmostEqual(complex(1,10), 1+10j)
241 self.assertAlmostEqual(complex(1,10), 1+10j)
242 self.assertAlmostEqual(complex(1,10.0), 1+10j)
243 self.assertAlmostEqual(complex(1.0,10), 1+10j)
244 self.assertAlmostEqual(complex(1.0,10), 1+10j)
245 self.assertAlmostEqual(complex(1.0,10.0), 1+10j)
246 self.assertAlmostEqual(complex(3.14+0j), 3.14+0j)
247 self.assertAlmostEqual(complex(3.14), 3.14+0j)
248 self.assertAlmostEqual(complex(314), 314.0+0j)
249 self.assertAlmostEqual(complex(314), 314.0+0j)
250 self.assertAlmostEqual(complex(3.14+0j, 0j), 3.14+0j)
251 self.assertAlmostEqual(complex(3.14, 0.0), 3.14+0j)
252 self.assertAlmostEqual(complex(314, 0), 314.0+0j)
253 self.assertAlmostEqual(complex(314, 0), 314.0+0j)
254 self.assertAlmostEqual(complex(0j, 3.14j), -3.14+0j)
255 self.assertAlmostEqual(complex(0.0, 3.14j), -3.14+0j)
256 self.assertAlmostEqual(complex(0j, 3.14), 3.14j)
257 self.assertAlmostEqual(complex(0.0, 3.14), 3.14j)
258 self.assertAlmostEqual(complex("1"), 1+0j)
259 self.assertAlmostEqual(complex("1j"), 1j)
260 self.assertAlmostEqual(complex(), 0)
261 self.assertAlmostEqual(complex("-1"), -1)
262 self.assertAlmostEqual(complex("+1"), +1)
263 self.assertAlmostEqual(complex("(1+2j)"), 1+2j)
264 self.assertAlmostEqual(complex("(1.3+2.2j)"), 1.3+2.2j)
265 self.assertAlmostEqual(complex("3.14+1J"), 3.14+1j)
266 self.assertAlmostEqual(complex(" ( +3.14-6J )"), 3.14-6j)
267 self.assertAlmostEqual(complex(" ( +3.14-J )"), 3.14-1j)
268 self.assertAlmostEqual(complex(" ( +3.14+j )"), 3.14+1j)
269 self.assertAlmostEqual(complex("J"), 1j)
270 self.assertAlmostEqual(complex("( j )"), 1j)
271 self.assertAlmostEqual(complex("+J"), 1j)
272 self.assertAlmostEqual(complex("( -j)"), -1j)
273 self.assertAlmostEqual(complex('1e-500'), 0.0 + 0.0j)
274 self.assertAlmostEqual(complex('-1e-500j'), 0.0 - 0.0j)
275 self.assertAlmostEqual(complex('-1e-500+1e-500j'), -0.0 + 0.0j)
278 self.assertAlmostEqual(complex(complex2(1+1j)), 1+1j)
279 self.assertAlmostEqual(complex(real=17, imag=23), 17+23j)
280 self.assertAlmostEqual(complex(real=17+23j), 17+23j)
281 self.assertAlmostEqual(complex(real=17+23j, imag=23), 17+46j)
282 self.assertAlmostEqual(complex(real=1+2j, imag=3+4j), -3+5j)
366 self.assertAlmostEqual(complex(float2(42.)), 42)
367 self.assertAlmostEqual(complex(real=float2(17.), imag=float2(23.)), 17+23j)
376 self.assertAlmostEqual(complex(MyIndex(42)), 42.0+0.0j)
377 self.assertAlmostEqual(complex(123, MyIndex(42)), 123.0+42.0j)
455 self.assertAlmostEqual((num.real**2 + num.imag**2) ** 0.5, abs(num))