Skip to content

Commit d56a55c

Browse files
committed
+1
1 parent ed6d703 commit d56a55c

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

Doc/library/functions.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -973,8 +973,9 @@ are always available. They are listed here in alphabetical order.
973973

974974
.. class:: imaginary(x=0.0)
975975

976-
Return an imaginary number with the value ``float(x)*1j``. If argument
977-
is omitted, returns ``0j``.
976+
Return an imaginary number with the value ``float(x)*1j``. If argument is
977+
omitted, returns ``0j``.
978+
978979

979980
.. function:: input()
980981
input(prompt)

Lib/test/test_complex.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ def test_add(self):
312312
self.assertComplexesAreIdentical((1-0j) + float(1.0), complex(2, -0.0))
313313
self.assertComplexesAreIdentical(float(1.0) + (1-0j), complex(2, -0.0))
314314

315-
316315
def test_sub(self):
317316
self.assertEqual(1j - int(+1), complex(-1, 1))
318317
self.assertEqual(1j - int(-1), complex(1, 1))

Lib/test/test_marshal.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ def test_exact_type_match(self):
318318
# >>> class Int(int): pass
319319
# >>> type(loads(dumps(Int())))
320320
# <type 'int'>
321-
for typ in (int, float, complex, tuple, list, dict, set, frozenset):
321+
for typ in (int, float, complex, tuple, list, dict, set, frozenset,
322+
imaginary):
322323
# Note: str subclasses are not tested because they get handled
323324
# by marshal's routines for objects supporting the buffer API.
324325
subtyp = type('subtyp', (typ,), {})
@@ -372,7 +373,7 @@ def readinto(self, buf):
372373
if n is not None and n > 4:
373374
n += 10**6
374375
return n
375-
for value in (1.0, 1j, b'0123456789', '0123456789'):
376+
for value in (1.0, 1j, 1+1j, b'0123456789', '0123456789'):
376377
self.assertRaises(ValueError, marshal.load,
377378
BadReader(marshal.dumps(value)))
378379

@@ -628,7 +629,7 @@ def test_write_long_to_file(self):
628629
self.assertEqual(data, b'\x78\x56\x34\x12')
629630

630631
def test_write_object_to_file(self):
631-
obj = ('\u20ac', b'abc', 123, 45.6, 7+8j, 'long line '*1000)
632+
obj = ('\u20ac', b'abc', 123, 45.6, 7+8j, 122j, 'long line '*1000)
632633
for v in range(marshal.version + 1):
633634
_testcapi.pymarshal_write_object_to_file(obj, os_helper.TESTFN, v)
634635
with open(os_helper.TESTFN, 'rb') as f:
@@ -665,7 +666,7 @@ def test_read_long_from_file(self):
665666
os_helper.unlink(os_helper.TESTFN)
666667

667668
def test_read_last_object_from_file(self):
668-
obj = ('\u20ac', b'abc', 123, 45.6, 7+8j)
669+
obj = ('\u20ac', b'abc', 123, 45.6, 7+8j, 666j)
669670
for v in range(marshal.version + 1):
670671
data = marshal.dumps(obj, v)
671672
with open(os_helper.TESTFN, 'wb') as f:
@@ -681,7 +682,7 @@ def test_read_last_object_from_file(self):
681682
os_helper.unlink(os_helper.TESTFN)
682683

683684
def test_read_object_from_file(self):
684-
obj = ('\u20ac', b'abc', 123, 45.6, 7+8j)
685+
obj = ('\u20ac', b'abc', 123, 45.6, 7+8j, 1j)
685686
for v in range(marshal.version + 1):
686687
data = marshal.dumps(obj, v)
687688
with open(os_helper.TESTFN, 'wb') as f:

0 commit comments

Comments
 (0)