Решение на Пет функции от Янислав Василев
Обратно към всички решения
Към профила на Янислав Василев
Резултати
- 4 точки от тестове
- 0 бонус точки
- 4 точки общо
- 7 успешни тест(а)
- 9 неуспешни тест(а)
Код
Лог от изпълнението
.FF...FF.FF.F.EE
======================================================================
ERROR: test_sort_by_one_element (test.TestSortBy)
----------------------------------------------------------------------
Traceback (most recent call last):
File "lib/language/python/runner.py", line 60, in thread
raise it.exc_info[1]
File "lib/language/python/runner.py", line 48, in run
self.result = func(*args, **kwargs)
File "/tmp/d20140319-21201-19lxo9u/test.py", line 57, in test_sort_by_one_element
self.assertEqual([1], solution.sort_by(lambda x, y: x - y, [1]))
File "/tmp/d20140319-21201-19lxo9u/solution.py", line 46, in sort_by
return sorted(arguments, key=funct)
TypeError: <lambda>() missing 1 required positional argument: 'y'
======================================================================
ERROR: test_sort_by_simple_test (test.TestSortBy)
----------------------------------------------------------------------
Traceback (most recent call last):
File "lib/language/python/runner.py", line 60, in thread
raise it.exc_info[1]
File "lib/language/python/runner.py", line 48, in run
self.result = func(*args, **kwargs)
File "/tmp/d20140319-21201-19lxo9u/test.py", line 54, in test_sort_by_simple_test
solution.sort_by(lambda x, y: x % 2 - y % 2, [0, 1, 2, 3, 4, 5]))
File "/tmp/d20140319-21201-19lxo9u/solution.py", line 46, in sort_by
return sorted(arguments, key=funct)
TypeError: <lambda>() missing 1 required positional argument: 'y'
======================================================================
FAIL: test_with_different_cases (test.TestAnagrams)
----------------------------------------------------------------------
Traceback (most recent call last):
File "lib/language/python/runner.py", line 60, in thread
raise it.exc_info[1]
File "lib/language/python/runner.py", line 48, in run
self.result = func(*args, **kwargs)
File "/tmp/d20140319-21201-19lxo9u/test.py", line 125, in test_with_different_cases
set(map(frozenset, solution.anagrams(words))))
AssertionError: Items in the first set but not the second:
frozenset({'Ray Adverb', 'Dave Barry'})
Items in the second set but not the first:
frozenset({'Dave Barry'})
frozenset({'Ray Adverb'})
======================================================================
FAIL: test_with_different_symbols (test.TestAnagrams)
----------------------------------------------------------------------
Traceback (most recent call last):
File "lib/language/python/runner.py", line 60, in thread
raise it.exc_info[1]
File "lib/language/python/runner.py", line 48, in run
self.result = func(*args, **kwargs)
File "/tmp/d20140319-21201-19lxo9u/test.py", line 135, in test_with_different_symbols
set(map(frozenset, solution.anagrams(words))))
AssertionError: Items in the first set but not the second:
frozenset({'I am Lord Voldemort', 'Tom Marvolo Riddle'})
frozenset({'Tom Cruise', "So I'm cuter"})
Items in the second set but not the first:
frozenset({'Tom Marvolo Riddle'})
frozenset({'I am Lord Voldemort'})
frozenset({'Tom Cruise'})
frozenset({"So I'm cuter"})
======================================================================
FAIL: test_another_group_by_type (test.TestGroupByType)
----------------------------------------------------------------------
Traceback (most recent call last):
File "lib/language/python/runner.py", line 60, in thread
raise it.exc_info[1]
File "lib/language/python/runner.py", line 48, in run
self.result = func(*args, **kwargs)
File "/tmp/d20140319-21201-19lxo9u/test.py", line 74, in test_another_group_by_type
solution.group_by_type({(1, 2): 12, ('a', 1): 1, 1: 'b', 'c': 15}))
AssertionError: {<class 'tuple'>: {(1, 2): 12, ('a', 1): 1}, <class 'int'>: {1: 'b'}, <class 'st [truncated]... != {<class 'tuple'>: {('a', 1): 12}, <class 'int'>: {1: 12}, <class 'str'>: {'c': 1 [truncated]...
- {<class 'tuple'>: {(1, 2): 12, ('a', 1): 1},
? ------------
+ {<class 'tuple'>: {('a', 1): 12},
? +
- <class 'str'>: {'c': 15},
? ^
+ <class 'str'>: {'c': 12},
? ^
- <class 'int'>: {1: 'b'}}
? ^^^
+ <class 'int'>: {1: 12}}
? ^^
======================================================================
FAIL: test_group_by_type (test.TestGroupByType)
----------------------------------------------------------------------
Traceback (most recent call last):
File "lib/language/python/runner.py", line 60, in thread
raise it.exc_info[1]
File "lib/language/python/runner.py", line 48, in run
self.result = func(*args, **kwargs)
File "/tmp/d20140319-21201-19lxo9u/test.py", line 68, in test_group_by_type
solution.group_by_type({'a': 12, 'b': 1, 1: 'foo'}))
AssertionError: {<class 'int'>: {1: 'foo'}, <class 'str'>: {'a': 12, 'b': 1}} != {<class 'int'>: {1: 12}, <class 'str'>: {'a': 12, 'b': 1}}
- {<class 'str'>: {'a': 12, 'b': 1}, <class 'int'>: {1: 'foo'}}
? ^^^^^
+ {<class 'str'>: {'a': 12, 'b': 1}, <class 'int'>: {1: 12}}
? ^^
======================================================================
FAIL: test_group_by_type_with_frozen_set_key (test.TestGroupByType)
----------------------------------------------------------------------
Traceback (most recent call last):
File "lib/language/python/runner.py", line 60, in thread
raise it.exc_info[1]
File "lib/language/python/runner.py", line 48, in run
self.result = func(*args, **kwargs)
File "/tmp/d20140319-21201-19lxo9u/test.py", line 80, in test_group_by_type_with_frozen_set_key
solution.group_by_type({(1, 2): 12, ('a', 1): 1, test_set: 15}))
AssertionError: {<class 'frozenset'>: {frozenset({1, 2, 3}): 15}, <class 'tuple'>: {(1, 2): 12, [truncated]... != {<class 'frozenset'>: {frozenset({1, 2, 3}): 12}, <class 'tuple'>: {('a', 1): 12 [truncated]...
- {<class 'frozenset'>: {frozenset({1, 2, 3}): 15},
? ^
+ {<class 'frozenset'>: {frozenset({1, 2, 3}): 12},
? ^
- <class 'tuple'>: {(1, 2): 12, ('a', 1): 1}}
? ------------
+ <class 'tuple'>: {('a', 1): 12}}
? +
======================================================================
FAIL: test_group_by_type_with_functions (test.TestGroupByType)
----------------------------------------------------------------------
Traceback (most recent call last):
File "lib/language/python/runner.py", line 60, in thread
raise it.exc_info[1]
File "lib/language/python/runner.py", line 48, in run
self.result = func(*args, **kwargs)
File "/tmp/d20140319-21201-19lxo9u/test.py", line 93, in test_group_by_type_with_functions
('list', 'of', 'numbers'): [42, 73]
AssertionError: {<class 'function'>: {<function TestGroupByType.test_group_by_type_with_function [truncated]... != {<class 'function'>: {<function TestGroupByType.test_group_by_type_with_function [truncated]...
Diff is 701 characters long. Set self.maxDiff to None to see it.
======================================================================
FAIL: test_with_pangrams (test.TestIsPangram)
----------------------------------------------------------------------
Traceback (most recent call last):
File "lib/language/python/runner.py", line 60, in thread
raise it.exc_info[1]
File "lib/language/python/runner.py", line 48, in run
self.result = func(*args, **kwargs)
File "/tmp/d20140319-21201-19lxo9u/test.py", line 12, in test_with_pangrams
'Ах, чудна българска земьо, полюшвай цъфтящи жита!'))
AssertionError: False is not true
----------------------------------------------------------------------
Ran 16 tests in 0.029s
FAILED (failures=7, errors=2)
История (1 версия и 0 коментара)
Янислав обнови решението на 19.03.2014 16:55 (преди над 10 години)