Решение на Тесте карти от Александър Стоичков
Обратно към всички решения
Към профила на Александър Стоичков
Резултати
- 3 точки от тестове
- 0 бонус точки
- 3 точки общо
- 5 успешни тест(а)
- 11 неуспешни тест(а)
Код
Лог от изпълнението
FE.E.EFFF.FF.FF.
======================================================================
ERROR: test_deck_add (test.CardCollectionTest)
----------------------------------------------------------------------
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/d20140407-19315-1ptqrfr/test.py", line 121, in test_deck_add
self.assertEqual(deck[0], card1)
File "/opt/python3.3/lib/python3.3/unittest/case.py", line 642, in assertEqual
assertion_func(first, second, msg=msg)
File "/opt/python3.3/lib/python3.3/unittest/case.py", line 632, in _baseAssertEqual
if not first == second:
File "/tmp/d20140407-19315-1ptqrfr/solution.py", line 43, in __eq__
return self.rank == other.rank and self.suit == other.suit
AttributeError: 'str' object has no attribute 'rank'
======================================================================
ERROR: test_deck_index (test.CardCollectionTest)
----------------------------------------------------------------------
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/d20140407-19315-1ptqrfr/test.py", line 160, in test_deck_index
self.assertEqual(0, deck.index(card1))
File "/tmp/d20140407-19315-1ptqrfr/solution.py", line 81, in index
first_found = next(obj for obj in self.collection if obj == card)
File "/tmp/d20140407-19315-1ptqrfr/solution.py", line 81, in <genexpr>
first_found = next(obj for obj in self.collection if obj == card)
File "/tmp/d20140407-19315-1ptqrfr/solution.py", line 43, in __eq__
return self.rank == other.rank and self.suit == other.suit
AttributeError: 'str' object has no attribute 'rank'
======================================================================
ERROR: test_deck_order (test.CardCollectionTest)
----------------------------------------------------------------------
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/d20140407-19315-1ptqrfr/test.py", line 134, in test_deck_order
self.assertEqual(deck.bottom_card(), card1)
File "/opt/python3.3/lib/python3.3/unittest/case.py", line 642, in assertEqual
assertion_func(first, second, msg=msg)
File "/opt/python3.3/lib/python3.3/unittest/case.py", line 632, in _baseAssertEqual
if not first == second:
File "/tmp/d20140407-19315-1ptqrfr/solution.py", line 43, in __eq__
return self.rank == other.rank and self.suit == other.suit
AttributeError: 'str' object has no attribute 'rank'
======================================================================
FAIL: test_belote_deck (test.CardCollectionTest)
----------------------------------------------------------------------
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/d20140407-19315-1ptqrfr/test.py", line 175, in test_belote_deck
self.assertEqual(BELOTE_DECK, cards)
AssertionError: Lists differ: ['King of Diamonds', 'Queen of... != ['Nine of Spades', 'Nine of He...
First differing element 0:
King of Diamonds
Nine of Spades
Diff is 1374 characters long. Set self.maxDiff to None to see it.
======================================================================
FAIL: test_sixtysix_deck (test.CardCollectionTest)
----------------------------------------------------------------------
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/d20140407-19315-1ptqrfr/test.py", line 179, in test_sixtysix_deck
self.assertEqual(SIXTY_SIX_DECK, cards)
AssertionError: Lists differ: ['King of Diamonds', 'Queen of... != ['Nine of Spades', 'Nine of He...
First differing element 0:
King of Diamonds
Nine of Spades
Second list contains 38 additional elements.
First extra element 24:
Eight of Spades
Diff is 1723 characters long. Set self.maxDiff to None to see it.
======================================================================
FAIL: test_standard_deck (test.CardCollectionTest)
----------------------------------------------------------------------
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/d20140407-19315-1ptqrfr/test.py", line 171, in test_standard_deck
self.assertEqual(STANDARD_DECK, cards)
AssertionError: Lists differ: ['King of Diamonds', 'Queen of... != ['Nine of Spades', 'Nine of He...
First differing element 0:
King of Diamonds
Nine of Spades
Second list contains 62 additional elements.
First extra element 52:
Jack of Diamonds
Diff is 3446 characters long. Set self.maxDiff to None to see it.
======================================================================
FAIL: test_all_card_instances (test.CardTest)
----------------------------------------------------------------------
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/d20140407-19315-1ptqrfr/test.py", line 67, in test_all_card_instances
self.assertIsInstance(card.rank, rank)
AssertionError: <class 'solution.Nine'> is not an instance of <class 'solution.Nine'>
======================================================================
FAIL: test_all_suits_ranks_equal (test.CardTest)
----------------------------------------------------------------------
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/d20140407-19315-1ptqrfr/test.py", line 92, in test_all_suits_ranks_equal
self.assertEqual(card.rank, rank())
AssertionError: <class 'solution.Nine'> != <solution.Nine object at 0xb6e43f2c>
======================================================================
FAIL: test_all_to_string (test.CardTest)
----------------------------------------------------------------------
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/d20140407-19315-1ptqrfr/test.py", line 104, in test_all_to_string
+ " of " + str(card.suit))
AssertionError: 'Nine of Spades' != "<class 'solution.Nine'> of <class 'solution.Spades'>"
- Nine of Spades
+ <class 'solution.Nine'> of <class 'solution.Spades'>
======================================================================
FAIL: test_card_instance (test.CardTest)
----------------------------------------------------------------------
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/d20140407-19315-1ptqrfr/test.py", line 60, in test_card_instance
self.assertIsInstance(aos.rank, solution.RANKS["Ace"])
AssertionError: <class 'solution.Ace'> is not an instance of <class 'solution.Ace'>
======================================================================
FAIL: test_suit_rank_equals (test.CardTest)
----------------------------------------------------------------------
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/d20140407-19315-1ptqrfr/test.py", line 85, in test_suit_rank_equals
self.assertEqual(aos.rank, solution.RANKS["Ace"]())
AssertionError: <class 'solution.Ace'> != <solution.Ace object at 0xb6e4896c>
----------------------------------------------------------------------
Ran 16 tests in 0.051s
FAILED (failures=8, errors=3)
История (1 версия и 0 коментара)
Александър обнови решението на 26.03.2014 13:09 (преди над 10 години)