- Коректно
- 6 успешни тест(а)
- 0 неуспешни тест(а)
...... ---------------------------------------------------------------------- Ran 6 tests in 0.157s OK
Срокът за предаване на решения е отминал
Чували ли сте вица за тухличка? Ако не сте, питайте. Обратно към задачата.
Повечето от вас са играли в някакъв период от своите посттийн години това:

Ако не сте, или пък сте забравили, може да се позабавлявате!
Целта е да упражним генератори. Напишете функция def solvable_tiles(size=3),
която връща по мързеливия начин итеруем обект, на който като се извика next(), връща подредба на дъска (съответно с размер size x size).
Подредбите трябва да са различни и да са възможни за изпълнение. Връщането на дъски продължава до изчерпвне на количествата.
Дъската се представя като кортеж от кортежи отразяващи съответно редовете. С 0 се означава празно квадратче.
Например дъската от картинката по-горе се представя като:
(
(1, 2, 3, 4),
(5, 6, 7, 8),
(9, 10, 11, 12),
(13, 14, 15, 0)
)
Как се разбира, че една конкретна подредба има решение, може да прочете тук. Да се пробвате да измислите сами формула, да питате във форума или нещо друго.
...... ---------------------------------------------------------------------- Ran 6 tests in 0.157s OK
E.EEEE
======================================================================
ERROR: test_board_rows_are_correct_size (test.TestSolvableTiles)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/data/rails/pyfmi-2016/releases/20160307095126/lib/language/python/runner.py", line 67, in thread
raise result
NameError: name 'groupby' is not defined
======================================================================
ERROR: test_solvable_tiles_actually_returns_solvable_tiles (test.TestSolvableTiles)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/data/rails/pyfmi-2016/releases/20160307095126/lib/language/python/runner.py", line 67, in thread
raise result
NameError: name 'groupby' is not defined
======================================================================
ERROR: test_solvable_tiles_returns_tuple_of_tuples (test.TestSolvableTiles)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/data/rails/pyfmi-2016/releases/20160307095126/lib/language/python/runner.py", line 67, in thread
raise result
NameError: name 'groupby' is not defined
======================================================================
ERROR: test_stopiteration_error_is_raised (test.TestSolvableTiles)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/data/rails/pyfmi-2016/releases/20160307095126/lib/language/python/runner.py", line 67, in thread
raise result
NameError: name 'groupby' is not defined
======================================================================
ERROR: test_tiles_generated_uniqueness (test.TestSolvableTiles)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/data/rails/pyfmi-2016/releases/20160307095126/lib/language/python/runner.py", line 67, in thread
raise result
NameError: name 'groupby' is not defined
----------------------------------------------------------------------
Ran 6 tests in 0.116s
FAILED (errors=5)
No module named 'numpy'
File "/data/rails/pyfmi-2016/releases/20160307095126/lib/language/python/runner.py", line 114, in main
loaded_test = imp.load_source('test', test_module)
File "/usr/local/lib/python3.5/imp.py", line 172, in load_source
module = _load(spec)
File "<frozen importlib._bootstrap>", line 693, in _load
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 662, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/tmp/d20160330-2514-169viji/test.py", line 3, in <module>
import solution
File "/tmp/d20160330-2514-169viji/solution.py", line 2, in <module>
import numpy as np
...... ---------------------------------------------------------------------- Ran 6 tests in 0.365s OK
...... ---------------------------------------------------------------------- Ran 6 tests in 0.392s OK
...... ---------------------------------------------------------------------- Ran 6 tests in 0.598s OK
...... ---------------------------------------------------------------------- Ran 6 tests in 0.137s OK
...... ---------------------------------------------------------------------- Ran 6 tests in 0.152s OK
...... ---------------------------------------------------------------------- Ran 6 tests in 0.126s OK
...... ---------------------------------------------------------------------- Ran 6 tests in 0.242s OK
...... ---------------------------------------------------------------------- Ran 6 tests in 0.248s OK
...... ---------------------------------------------------------------------- Ran 6 tests in 0.142s OK
...... ---------------------------------------------------------------------- Ran 6 tests in 0.204s OK
..F...
======================================================================
FAIL: test_solvable_tiles_actually_returns_solvable_tiles (test.TestSolvableTiles)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/data/rails/pyfmi-2016/releases/20160307095126/lib/language/python/runner.py", line 67, in thread
raise result
AssertionError: False is not true
----------------------------------------------------------------------
Ran 6 tests in 0.146s
FAILED (failures=1)
...... ---------------------------------------------------------------------- Ran 6 tests in 0.184s OK
...... ---------------------------------------------------------------------- Ran 6 tests in 0.160s OK
...... ---------------------------------------------------------------------- Ran 6 tests in 0.160s OK
...... ---------------------------------------------------------------------- Ran 6 tests in 0.208s OK
...... ---------------------------------------------------------------------- Ran 6 tests in 0.110s OK
...... ---------------------------------------------------------------------- Ran 6 tests in 0.805s OK
...... ---------------------------------------------------------------------- Ran 6 tests in 0.135s OK
...... ---------------------------------------------------------------------- Ran 6 tests in 0.139s OK
..EF.E
======================================================================
ERROR: test_solvable_tiles_actually_returns_solvable_tiles (test.TestSolvableTiles)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/data/rails/pyfmi-2016/releases/20160307095126/lib/language/python/runner.py", line 67, in thread
raise result
TypeError: can only concatenate tuple (not "list") to tuple
======================================================================
ERROR: test_tiles_generated_uniqueness (test.TestSolvableTiles)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/data/rails/pyfmi-2016/releases/20160307095126/lib/language/python/runner.py", line 67, in thread
raise result
TypeError: unhashable type: 'list'
======================================================================
FAIL: test_solvable_tiles_returns_tuple_of_tuples (test.TestSolvableTiles)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/data/rails/pyfmi-2016/releases/20160307095126/lib/language/python/runner.py", line 67, in thread
raise result
AssertionError: [[0, 1, 2, 3, 4, 5, 6], [7, 8, 9, 10, 11, 12, 13], [14, 15, 16, 17, 18, 19, 20], [21, 22, 23, 24, 25, 26, 27], [28, 29, 30, 31, 32, 33, 34], [35, 36, 37, 38, 39, 40, 41], [42, 43, 44, 45, 46, 47, 48]] is not an instance of <class 'tuple'>
----------------------------------------------------------------------
Ran 6 tests in 0.085s
FAILED (failures=1, errors=2)
...... ---------------------------------------------------------------------- Ran 6 tests in 0.179s OK
...... ---------------------------------------------------------------------- Ran 6 tests in 0.150s OK
...... ---------------------------------------------------------------------- Ran 6 tests in 0.181s OK
E....E
======================================================================
ERROR: test_board_rows_are_correct_size (test.TestSolvableTiles)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/data/rails/pyfmi-2016/releases/20160307095126/lib/language/python/runner.py", line 63, in thread
raise TimeoutError
TimeoutError
======================================================================
ERROR: test_tiles_generated_uniqueness (test.TestSolvableTiles)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/data/rails/pyfmi-2016/releases/20160307095126/lib/language/python/runner.py", line 63, in thread
raise TimeoutError
TimeoutError
----------------------------------------------------------------------
Ran 6 tests in 4.130s
FAILED (errors=2)