Skip to content

Commit 1a8db46

Browse files
committed
[Chore]: Test Annoatatation basics
1 parent 0b91a27 commit 1a8db46

File tree

7 files changed

+52
-0
lines changed

7 files changed

+52
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env python3
2+
3+
safe_first_element = __import__('100-safe_first_element').safe_first_element
4+
5+
print(safe_first_element.__annotations__)
6+
print(safe_first_element({}, "sherlock", "holmes"))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env python3
2+
3+
safely_get_value = __import__('101-safely_get_value').safely_get_value
4+
annotations = safely_get_value.__annotations__
5+
6+
print("Here's what the mappings should look like")
7+
for k, v in annotations.items():
8+
print( ("{}: {}".format(k, v)))
9+
10+
print(safely_get_value({}, "sherlock", "holmes"))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env python3
2+
3+
sum_list = __import__('5-sum_list').sum_list
4+
5+
floats = [3.14, 1.11, 2.22]
6+
floats_sum = sum_list(floats)
7+
print(floats_sum == sum(floats))
8+
print(sum_list.__annotations__)
9+
print("sum_list(floats) returns {} which is a {}".format(floats_sum, type(floats_sum)))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env python3
2+
3+
sum_mixed_list = __import__('6-sum_mixed_list').sum_mixed_list
4+
5+
print(sum_mixed_list.__annotations__)
6+
mixed = [5, 4, 3.14, 666, 0.99]
7+
ans = sum_mixed_list(mixed)
8+
print(ans == sum(mixed))
9+
print("sum_mixed_list(mixed) returns {} which is a {}".format(ans, type(ans)))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env python3
2+
3+
to_kv = __import__('7-to_kv').to_kv
4+
5+
print(to_kv.__annotations__)
6+
print(to_kv("eggs", 3))
7+
print(to_kv("school", 0.02))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env python3
2+
3+
make_multiplier = __import__('8-make_multiplier').make_multiplier
4+
print(make_multiplier.__annotations__)
5+
fun = make_multiplier(2.22)
6+
print("{}".format(fun(2.22)))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env python3
2+
3+
element_length = __import__('9-element_length').element_length
4+
5+
print(element_length.__annotations__)

0 commit comments

Comments
 (0)