1def no_it_isnt(input_list):
2 reversed_list = input_list[::-1]
3 new_list = []
4
5 for item in reversed_list:
6 opposite_item = None
7 if type(item) == bool:
8 opposite_item = False
9 elif type(item) == str:
10 opposite_item = item[::-1]
11 else:
12 opposite_item = -item
13 new_list.append(opposite_item)
14
15 return new_list
F..F.
======================================================================
FAIL: test_bool (test.TestOpposite)
Test with a bool.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/test.py", line 23, in test_bool
self.assertEqual(no_it_isnt([True, False]), [True, False])
AssertionError: Lists differ: [False, False] != [True, False]
First differing element 0:
False
True
- [False, False]
+ [True, False]
======================================================================
FAIL: test_mixed (test.TestOpposite)
Test with a long mixed content of types.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/test.py", line 34, in test_mixed
self.assertEqual(no_it_isnt([True, True, False]), [True, False, False])
AssertionError: Lists differ: [False, False, False] != [True, False, False]
First differing element 0:
False
True
- [False, False, False]
+ [True, False, False]
----------------------------------------------------------------------
Ran 5 tests in 0.001s
FAILED (failures=2)
19.10.2023 08:54