1def no_it_isnt(llist):
2 reversed_list = []
3 for value in llist[::-1]:
4 if isinstance(value, int) or isinstance(value, float):
5 reversed_list.append(-value)
6 elif isinstance(value, bool):
7 reversed_list.append(not value)
8 elif isinstance(value, str):
9 reversed_list.append(value[::-1])
10 else:
11 reversed_list.append(value)
12 return reversed_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: [0, -1] != [True, False]
First differing element 0:
0
True
- [0, -1]
+ [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 33, in test_mixed
self.assertEqual(no_it_isnt([1, 1.2, True, 'string']), ['gnirts', False, -1.2, -1])
AssertionError: Lists differ: ['gnirts', -1, -1.2, -1] != ['gnirts', False, -1.2, -1]
First differing element 1:
-1
False
- ['gnirts', -1, -1.2, -1]
? ^^
+ ['gnirts', False, -1.2, -1]
? ^^^^^
----------------------------------------------------------------------
Ran 5 tests in 0.001s
FAILED (failures=2)
19.10.2023 17:03