1python = """
2 /^\\/^\\
3 _|__| O|
4\\/ /~ \\_/ \\
5 \\____|__________/ \\
6 \\_______ \\
7 `\\ \\ \\
8 | | \\
9 / / \\
10 / / \\\\
11 / / \\ \\
12 / / \\ \\
13 / / _----_ \\ \\
14 / / _-~ ~-_ | |
15 ( ( _-~ _--_ ~-_ _/ |
16 \\ ~-____-~ _-~ ~-_ ~-_-~ /
17 ~-_ _-~ ~-_ _-~
18 ~--______-~ ~-___-~
19"""
20
21
22class LockPicker_0MI0600371: #<-къде ми е змията?
23
24 def __init__(self, lock):
25 self.lock = lock
26 self.combinations = []
27
28 def unlock(self):
29 picked = False
30 while picked:
31 try:
32 picked = self.lock.pick(*self.combinations)
33 except Exception as exp:
34 if type(exp) is TypeError:
35 if exp.position is None:
36 self.combinations.clear() #precaution
37 while exp.expected > len(self.combinations):
38 self.combinations.insert(None)
39 else:
40 self.combinations[exp.position-1] = exp.expected()
41 elif type(exp) is ValueError:
42 self.args[exp.position - 1] = exp.expected
43 else:
44 self.pray_to_the_python(python)
45
46 def pray_to_the_python(self):
47 print("Praise be to the Python!(only he can save us)")
48 print(python)
49 print("Praise be to the Python!(I'm starting to think he's clueless too)")
50 return
Неуспешно отключване.
F
======================================================================
FAIL: test_picking (test.TestLockPicker.test_picking)
Ensure the lock is picked based on already stored boolean var.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/test.py", line 72, in test_picking
self.assertTrue(correct, "Не успя да отключиш.")
AssertionError: False is not true : Не успя да отключиш.
----------------------------------------------------------------------
Ran 1 test in 0.000s
FAILED (failures=1)
f | 1 | python = """ | f | 1 | python = """ |
2 | /^\\/^\\ | 2 | /^\\/^\\ | ||
3 | _|__| O| | 3 | _|__| O| | ||
4 | \\/ /~ \\_/ \\ | 4 | \\/ /~ \\_/ \\ | ||
5 | \\____|__________/ \\ | 5 | \\____|__________/ \\ | ||
6 | \\_______ \\ | 6 | \\_______ \\ | ||
7 | `\\ \\ \\ | 7 | `\\ \\ \\ | ||
8 | | | \\ | 8 | | | \\ | ||
9 | / / \\ | 9 | / / \\ | ||
10 | / / \\\\ | 10 | / / \\\\ | ||
11 | / / \\ \\ | 11 | / / \\ \\ | ||
12 | / / \\ \\ | 12 | / / \\ \\ | ||
13 | / / _----_ \\ \\ | 13 | / / _----_ \\ \\ | ||
14 | / / _-~ ~-_ | | | 14 | / / _-~ ~-_ | | | ||
15 | ( ( _-~ _--_ ~-_ _/ | | 15 | ( ( _-~ _--_ ~-_ _/ | | ||
16 | \\ ~-____-~ _-~ ~-_ ~-_-~ / | 16 | \\ ~-____-~ _-~ ~-_ ~-_-~ / | ||
17 | ~-_ _-~ ~-_ _-~ | 17 | ~-_ _-~ ~-_ _-~ | ||
18 | ~--______-~ ~-___-~ | 18 | ~--______-~ ~-___-~ | ||
19 | """ | 19 | """ | ||
20 | 20 | ||||
21 | 21 | ||||
22 | class LockPicker_0MI0600371: #<-къде ми е змията? | 22 | class LockPicker_0MI0600371: #<-къде ми е змията? | ||
23 | 23 | ||||
24 | def __init__(self, lock): | 24 | def __init__(self, lock): | ||
25 | self.lock = lock | 25 | self.lock = lock | ||
26 | self.combinations = [] | 26 | self.combinations = [] | ||
27 | 27 | ||||
28 | def unlock(self): | 28 | def unlock(self): | ||
29 | picked = False | 29 | picked = False | ||
30 | while picked: | 30 | while picked: | ||
31 | try: | 31 | try: | ||
32 | picked = self.lock.pick(*self.combinations) | 32 | picked = self.lock.pick(*self.combinations) | ||
33 | except Exception as exp: | 33 | except Exception as exp: | ||
34 | if type(exp) is TypeError: | 34 | if type(exp) is TypeError: | ||
35 | if exp.position is None: | 35 | if exp.position is None: | ||
36 | self.combinations.clear() #precaution | 36 | self.combinations.clear() #precaution | ||
37 | while exp.expected > len(self.combinations): | 37 | while exp.expected > len(self.combinations): | ||
38 | self.combinations.insert(None) | 38 | self.combinations.insert(None) | ||
39 | else: | 39 | else: | ||
t | 40 | self.combinations[exp.position-1] = exp.expected(0) | t | 40 | self.combinations[exp.position-1] = exp.expected() |
41 | elif type(exp) is ValueError: | 41 | elif type(exp) is ValueError: | ||
42 | self.args[exp.position - 1] = exp.expected | 42 | self.args[exp.position - 1] = exp.expected | ||
43 | else: | 43 | else: | ||
44 | self.pray_to_the_python(python) | 44 | self.pray_to_the_python(python) | ||
45 | 45 | ||||
46 | def pray_to_the_python(self): | 46 | def pray_to_the_python(self): | ||
47 | print("Praise be to the Python!(only he can save us)") | 47 | print("Praise be to the Python!(only he can save us)") | ||
48 | print(python) | 48 | print(python) | ||
49 | print("Praise be to the Python!(I'm starting to think he's clueless too)") | 49 | print("Praise be to the Python!(I'm starting to think he's clueless too)") | ||
50 | return | 50 | return |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
13.11.2024 11:33
13.11.2024 11:33