Skip to content

Commit e46e5b5

Browse files
committed
file import corrections
1 parent a6c1e21 commit e46e5b5

10 files changed

+29
-10
lines changed

python-isinstance/ball_instance_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from balls import Ball, FootBall, PoolBall
2+
13
eight_ball = PoolBall("black", 8)
24
football = FootBall("brown")
35
ball = Ball("green", "sphere")

python-isinstance/bool_int_test.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
for element in test_data:
1515
"bool" if isinstance(element, bool) else "int"
1616

17-
for element in test_data:
18-
"bool" if type(element) is bool else "int"
17+
# Try and avoid this.
18+
# for element in test_data:
19+
# "bool" if type(element) is bool else "int"

python-isinstance/consolidation1_solution.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
from balls import Ball, FootBall, PoolBall
2+
3+
football = FootBall("brown")
4+
ball = Ball("green", "sphere")
5+
6+
17
isinstance(football, FootBall)
28

39
isinstance(football, PoolBall)
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
from abc import ABC
2+
from collections.abc import Callable
3+
from balls_v2 import AmericanFootBall, PoolBall
4+
5+
eight_ball = PoolBall("black", 8)
6+
football = AmericanFootBall("brown")
27

38
isinstance(eight_ball, ABC)
49

510
isinstance(football, ABC)
611

7-
from collections.abc import Callable
8-
912
isinstance(isinstance, Callable)
1013

11-
from balls import PoolBall
12-
13-
eight_ball = PoolBall("black", 8)
14-
1514
isinstance(eight_ball.get_shape, Callable)
1615

1716
isinstance(PoolBall, Callable)
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
from customiterables import CustomIterableOne
2+
from collections.abc import Iterable
3+
24

35
for number in CustomIterableOne(4):
46
print(number)
57

6-
from collections.abc import Iterable
78

89
isinstance(CustomIterableOne(4), Iterable)

python-isinstance/customiterable_three_tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from collections.abc import Iterable
12
from customiterables import CustomIterableThree
23

34
for number in CustomIterableThree(4):

python-isinstance/customiterable_two_tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from collections.abc import Iterable
12
from customiterables import CustomIterableTwo
23

34
for number in CustomIterableTwo(4):

python-isinstance/isinstance_abc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
from balls_v2 import PoolBall, AmericanFootBall
1+
from balls_v2 import AmericanFootBall, Ball, PoolBall
22

33
eight_ball = PoolBall("black", 8)
4+
45
football = AmericanFootBall("brown")
56

67
isinstance(eight_ball, Ball)

python-isinstance/iter_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
from customiterables import CustomIterableOne, CustomIterableTwo, CustomIterableThree
2+
3+
14
iter(CustomIterableOne(4))
25

36
iter(CustomIterableTwo(4))

python-isinstance/type_tests.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
from balls import Ball, FootBall, PoolBall
2+
3+
eight_ball = PoolBall("black", 8)
4+
15
type(eight_ball)
26

37
type(eight_ball) is PoolBall

0 commit comments

Comments
 (0)