how to pass values: tests and solution

tests

the code from telephone/tests/test_telephone.py from how to pass values

 1import src.telephone
 2import unittest
 3
 4
 5class TestTelephone(unittest.TestCase):
 6
 7    def test_passing_a_string(self):
 8        reality = src.telephone.text('hello')
 9        my_expectation = 'I got: hello'
10        self.assertEqual(reality, my_expectation)
11
12        reality = src.telephone.text('yes')
13        my_expectation = 'I got: yes'
14        self.assertEqual(reality, my_expectation)
15
16    def test_passing_none(self):
17        reality = src.telephone.text(None)
18        my_expectation = 'I got: None'
19        self.assertEqual(reality, my_expectation)
20
21    def test_passing_booleans(self):
22        reality = src.telephone.text(False)
23        my_expectation = 'I got: False'
24        self.assertEqual(reality, my_expectation)
25
26        reality = src.telephone.text(True)
27        my_expectation = 'I got: True'
28        self.assertEqual(reality, my_expectation)
29
30    def test_passing_an_integer(self):
31        reality = src.telephone.text(1234)
32        my_expectation = 'I got: 1234'
33        self.assertEqual(reality, my_expectation)
34
35    def test_passing_a_float(self):
36        reality = src.telephone.text(1.234)
37        my_expectation = 'I got: 1.234'
38        self.assertEqual(reality, my_expectation)
39
40    def test_passing_a_tuple(self):
41        reality = src.telephone.text((1, 2, 3, 'n'))
42        my_expectation = "I got: (1, 2, 3, 'n')"
43        self.assertEqual(reality, my_expectation)
44
45    def test_passing_a_list(self):
46        reality = src.telephone.text([1, 2, 3, "n"])
47        my_expectation = "I got: [1, 2, 3, 'n']"
48        self.assertEqual(reality, my_expectation)
49
50    def test_passing_a_dictionary(self):
51        reality = src.telephone.text(
52            {
53                'key1': 'value1',
54                'keyN': [0, 1, 2, 'n'],
55            }
56        )
57        my_expectation = (
58            "I got: "
59            "{'key1': 'value1', 'keyN': [0, 1, 2, 'n']}"
60        )
61        self.assertEqual(reality, my_expectation)
62
63    def test_passing_a_class(self):
64        reality = src.telephone.text(object)
65        my_expectation = "I got: <class 'object'>"
66        self.assertEqual(reality, my_expectation)
67
68        reality = src.telephone.text(TestTelephone)
69        my_expectation = (
70            "I got: <class "
71            "'tests.test_telephone.TestTelephone'>"
72        )
73        self.assertEqual(reality, my_expectation)
74
75
76# Exceptions seen
77# AssertionError
78# NameError
79# AttributeError
80# TypeError

solution

the solution in telephone.py from how to pass values

1def text(the_input):
2    return f'I got: {the_input}'