@@ -38,13 +38,13 @@ def safe_division(number, divisor, ignore_overflow,
3838
3939
4040# Example 2
41- result = safe_division (1 , 10 ** 500 , True , False )
41+ result = safe_division (1.0 , 10 ** 500 , True , False )
4242print (result )
43- assert result == 0
43+ assert result is 0
4444
4545
4646# Example 3
47- result = safe_division (1 , 0 , False , True )
47+ result = safe_division (1.0 , 0 , False , True )
4848print (result )
4949assert result == float ('inf' )
5050
@@ -68,12 +68,12 @@ def safe_division_b(number, divisor,
6868
6969
7070# Example 5
71- assert safe_division_b (1 , 10 ** 500 , ignore_overflow = True ) == 0
72- assert safe_division_b (1 , 0 , ignore_zero_division = True ) == float ('inf' )
71+ assert safe_division_b (1.0 , 10 ** 500 , ignore_overflow = True ) is 0
72+ assert safe_division_b (1.0 , 0 , ignore_zero_division = True ) == float ('inf' )
7373
7474
7575# Example 6
76- assert safe_division_b (1 , 10 ** 500 , True , False ) == 0
76+ assert safe_division_b (1.0 , 10 ** 500 , True , False ) is 0
7777
7878
7979# Example 7
@@ -96,17 +96,17 @@ def safe_division_c(number, divisor, *,
9696
9797# Example 8
9898try :
99- safe_division_c (1 , 10 ** 500 , True , False )
99+ safe_division_c (1.0 , 10 ** 500 , True , False )
100100except :
101101 logging .exception ('Expected' )
102102else :
103103 assert False
104104
105105
106106# Example 9
107- safe_division_c (1 , 0 , ignore_zero_division = True ) # No exception
107+ safe_division_c (1.0 , 0 , ignore_zero_division = True ) # No exception
108108try :
109- safe_division_c (1 , 0 )
109+ safe_division_c (1.0 , 0 )
110110 assert False
111111except ZeroDivisionError :
112112 pass # Expected
0 commit comments