... >>> for x in range(10):
... ... print x,
... 0 1 2 3 4 5 6 7 8 9
- ... >>> x/2
+ ... >>> x//2
... 6
... '''
>>> test = doctest.DocTestFinder().find(f)[0]
... >>> x = 12
... >>> print x
... 12
- ... >>> x/2
+ ... >>> x//2
... 6
... '''
>>> test = doctest.DocTestFinder().find(f)[0]
... >>> x = 12
... >>> print x
... 14
- ... >>> x/2
+ ... >>> x//2
... 6
... '''
>>> test = doctest.DocTestFinder().find(f)[0]
Got:
12
Trying:
- x/2
+ x//2
Expecting:
6
ok
... >>> x = 12
... >>> print x
... 12
- ... >>> x/2
+ ... >>> x//2
... 6
... '''
>>> test = doctest.DocTestFinder().find(f)[0]
12
ok
Trying:
- x/2
+ x//2
Expecting:
6
ok
12
ok
Trying:
- x/2
+ x//2
Expecting:
6
ok
>>> def f(x):
... '''
... >>> x = 12
- ... >>> print x/0
+ ... >>> print x//0
... Traceback (most recent call last):
... ZeroDivisionError: integer division or modulo by zero
... '''
>>> def f(x):
... '''
... >>> x = 12
- ... >>> print 'pre-exception output', x/0
+ ... >>> print 'pre-exception output', x//0
... pre-exception output
... Traceback (most recent call last):
... ZeroDivisionError: integer division or modulo by zero
**********************************************************************
File ..., line 4, in f
Failed example:
- print 'pre-exception output', x/0
+ print 'pre-exception output', x//0
Exception raised:
...
ZeroDivisionError: integer division or modulo by zero
>>> def f(x):
... r'''
- ... >>> 1/0
+ ... >>> 1//0
... 0
... '''
>>> test = doctest.DocTestFinder().find(f)[0]
**********************************************************************
File ..., line 3, in f
Failed example:
- 1/0
+ 1//0
Exception raised:
Traceback (most recent call last):
...