Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 90029cf

Browse files
Rename Mock to With.
1 parent 14598f0 commit 90029cf

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

Lib/test/test_complex.py

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
(1, 0+0j),
2222
)
2323

24-
class MockIndex:
24+
class WithIndex:
2525
def __init__(self, value):
2626
self.value = value
2727
def __index__(self):
2828
return self.value
2929

30-
class MockFloat:
30+
class WithFloat:
3131
def __init__(self, value):
3232
self.value = value
3333
def __float__(self):
@@ -36,7 +36,7 @@ def __float__(self):
3636
class ComplexSubclass(complex):
3737
pass
3838

39-
class MockComplex:
39+
class WithComplex:
4040
def __init__(self, value):
4141
self.value = value
4242
def __complex__(self):
@@ -372,7 +372,7 @@ def check(z, x, y):
372372
check(complex(4.25+0j), 4.25, 0.0)
373373
check(complex(4.25+0.5j), 4.25, 0.5)
374374
check(complex(ComplexSubclass(4.25+0.5j)), 4.25, 0.5)
375-
check(complex(MockComplex(4.25+0.5j)), 4.25, 0.5)
375+
check(complex(WithComplex(4.25+0.5j)), 4.25, 0.5)
376376

377377
check(complex(1, 10), 1.0, 10.0)
378378
check(complex(1, 10.0), 1.0, 10.0)
@@ -389,8 +389,8 @@ def check(z, x, y):
389389
"argument 'real' must be a real number, not .*ComplexSubclass"):
390390
check(complex(ComplexSubclass(4.25+0j), 0), 4.25, 0.0)
391391
with self.assertWarnsRegex(DeprecationWarning,
392-
"argument 'real' must be a real number, not .*MockComplex"):
393-
check(complex(MockComplex(4.25+0j), 0), 4.25, 0.0)
392+
"argument 'real' must be a real number, not .*WithComplex"):
393+
check(complex(WithComplex(4.25+0j), 0), 4.25, 0.0)
394394
with self.assertWarnsRegex(DeprecationWarning,
395395
"argument 'real' must be a real number, not complex"):
396396
check(complex(4.25j, 0), 0.0, 4.25)
@@ -404,8 +404,8 @@ def check(z, x, y):
404404
"argument 'imag' must be a real number, not .*ComplexSubclass"):
405405
check(complex(0, ComplexSubclass(4.25+0j)), 0.0, 4.25)
406406
with self.assertRaisesRegex(TypeError,
407-
"argument 'imag' must be a real number, not .*MockComplex"):
408-
complex(0, MockComplex(4.25+0j))
407+
"argument 'imag' must be a real number, not .*WithComplex"):
408+
complex(0, WithComplex(4.25+0j))
409409
with self.assertWarnsRegex(DeprecationWarning,
410410
"argument 'imag' must be a real number, not complex"):
411411
check(complex(0.0, 4.25j), -4.25, 0.0)
@@ -467,13 +467,13 @@ def check(z, x, y):
467467
"argument 'imag' must be a real number, not str",
468468
complex, 0, '1')
469469

470-
self.assertRaises(TypeError, complex, MockComplex(1.5))
471-
self.assertRaises(TypeError, complex, MockComplex(1))
472-
self.assertRaises(TypeError, complex, MockComplex(None))
473-
self.assertRaises(TypeError, complex, MockComplex(4.25+0j), object())
474-
self.assertRaises(TypeError, complex, MockComplex(1.5), object())
475-
self.assertRaises(TypeError, complex, MockComplex(1), object())
476-
self.assertRaises(TypeError, complex, MockComplex(None), object())
470+
self.assertRaises(TypeError, complex, WithComplex(1.5))
471+
self.assertRaises(TypeError, complex, WithComplex(1))
472+
self.assertRaises(TypeError, complex, WithComplex(None))
473+
self.assertRaises(TypeError, complex, WithComplex(4.25+0j), object())
474+
self.assertRaises(TypeError, complex, WithComplex(1.5), object())
475+
self.assertRaises(TypeError, complex, WithComplex(1), object())
476+
self.assertRaises(TypeError, complex, WithComplex(None), object())
477477

478478
class EvilExc(Exception):
479479
pass
@@ -484,25 +484,25 @@ def __complex__(self):
484484

485485
self.assertRaises(EvilExc, complex, evilcomplex())
486486

487-
check(complex(MockFloat(4.25)), 4.25, 0.0)
488-
check(complex(MockFloat(4.25), 1.5), 4.25, 1.5)
489-
check(complex(1.5, MockFloat(4.25)), 1.5, 4.25)
490-
self.assertRaises(TypeError, complex, MockFloat(42))
491-
self.assertRaises(TypeError, complex, MockFloat(42), 1.5)
492-
self.assertRaises(TypeError, complex, 1.5, MockFloat(42))
493-
self.assertRaises(TypeError, complex, MockFloat(None))
494-
self.assertRaises(TypeError, complex, MockFloat(None), 1.5)
495-
self.assertRaises(TypeError, complex, 1.5, MockFloat(None))
496-
497-
check(complex(MockIndex(42)), 42.0, 0.0)
498-
check(complex(MockIndex(42), 1.5), 42.0, 1.5)
499-
check(complex(1.5, MockIndex(42)), 1.5, 42.0)
500-
self.assertRaises(OverflowError, complex, MockIndex(2**2000))
501-
self.assertRaises(OverflowError, complex, MockIndex(2**2000), 1.5)
502-
self.assertRaises(OverflowError, complex, 1.5, MockIndex(2**2000))
503-
self.assertRaises(TypeError, complex, MockIndex(None))
504-
self.assertRaises(TypeError, complex, MockIndex(None), 1.5)
505-
self.assertRaises(TypeError, complex, 1.5, MockIndex(None))
487+
check(complex(WithFloat(4.25)), 4.25, 0.0)
488+
check(complex(WithFloat(4.25), 1.5), 4.25, 1.5)
489+
check(complex(1.5, WithFloat(4.25)), 1.5, 4.25)
490+
self.assertRaises(TypeError, complex, WithFloat(42))
491+
self.assertRaises(TypeError, complex, WithFloat(42), 1.5)
492+
self.assertRaises(TypeError, complex, 1.5, WithFloat(42))
493+
self.assertRaises(TypeError, complex, WithFloat(None))
494+
self.assertRaises(TypeError, complex, WithFloat(None), 1.5)
495+
self.assertRaises(TypeError, complex, 1.5, WithFloat(None))
496+
497+
check(complex(WithIndex(42)), 42.0, 0.0)
498+
check(complex(WithIndex(42), 1.5), 42.0, 1.5)
499+
check(complex(1.5, WithIndex(42)), 1.5, 42.0)
500+
self.assertRaises(OverflowError, complex, WithIndex(2**2000))
501+
self.assertRaises(OverflowError, complex, WithIndex(2**2000), 1.5)
502+
self.assertRaises(OverflowError, complex, 1.5, WithIndex(2**2000))
503+
self.assertRaises(TypeError, complex, WithIndex(None))
504+
self.assertRaises(TypeError, complex, WithIndex(None), 1.5)
505+
self.assertRaises(TypeError, complex, 1.5, WithIndex(None))
506506

507507
class MyInt:
508508
def __int__(self):

0 commit comments

Comments
 (0)