def test_vypis_sloupecky_rozehrana(capsys): """Kontrola výpisu sloupečků rozehrané hry""" from klondike import vypis_sloupecky sloupecky = [ [(13, 'Pi', False)] * 1 + [(8, 'Kr', True)], [(13, 'Pi', False)] * 8 + [(9, 'Ka', True)], [(13, 'Pi', False)] * 2 + [(10, 'Sr', True), (9, 'Kr', True), (8, 'Ka', True)], [(13, 'Pi', False)] * 6 + [(3, 'Ka', True)], [(13, 'Pi', False)] * 1 + [(4, 'Pi', True)], [(13, 'Pi', False)] * 9 + [(9, 'Kr', True)], [(13, 'Pi', False)] * 5 + [(12, 'Sr', True), (11, 'Pi', True)], ] vypis_sloupecky(sloupecky) out, err = capsys.readouterr() check_text( out, """ [???] [???] [???] [???] [???] [???] [???] [8♣ ] [???] [???] [???] [4♠ ] [???] [???] [???] [X ♥] [???] [???] [???] [???] [9♣ ] [???] [???] [???] [???] [8 ♦] [???] [???] [???] [???] [???] [???] [Q ♥] [???] [3 ♦] [???] [J♠ ] [???] [???] [9 ♦] [???] [9♣ ] """)
def test_vypis_sloupecky_ruby(capsys): """Kontrola výpisu sloupečků, kde jsou všechny karty rubem nahoru""" from klondike import vypis_sloupecky sloupecky = [ [(13, 'Pi', False)] * 2, [(13, 'Pi', False)] * 3, [(13, 'Pi', False)] * 4, [(13, 'Pi', False)] * 5, [(13, 'Pi', False)] * 6, [(13, 'Pi', False)] * 7, [(13, 'Pi', False)] * 8, ] vypis_sloupecky(sloupecky) out, err = capsys.readouterr() check_text( out, """ [???] [???] [???] [???] [???] [???] [???] [???] [???] [???] [???] [???] [???] [???] [???] [???] [???] [???] [???] [???] [???] [???] [???] [???] [???] [???] [???] [???] [???] [???] [???] [???] [???] [???] [???] """)
def test_vypis_sloupecky_po_jedne_karte_licem_nahoru(capsys): from klondike import vypis_sloupecky vypis_sloupecky([ [(1, 'Pi', True)], [(2, 'Sr', True)], [(3, 'Ka', True)], [(4, 'Kr', True)], [(5, 'Pi', True)], [(6, 'Sr', True)], [(7, 'Ka', True)], ]) out, err = capsys.readouterr() check_text(out, "[A♠ ] [2 ♥] [3 ♦] [4♣ ] [5♠ ] [6 ♥] [7 ♦]")
def test_vypis_sloupecky_dvou_kartach(capsys): from klondike import vypis_sloupecky vypis_sloupecky([ [(1, 'Pi', True), (7, 'Sr', True)], [(2, 'Sr', True), (6, 'Ka', True)], [(3, 'Ka', True), (5, 'Kr', False)], [(4, 'Kr', False), (4, 'Pi', True)], [(5, 'Pi', False), (3, 'Sr', True)], [(6, 'Sr', True), (2, 'Ka', True)], [(7, 'Ka', True), (1, 'Kr', True)], ]) out, err = capsys.readouterr() check_text( out, """ [A♠ ] [2 ♥] [3 ♦] [???] [???] [6 ♥] [7 ♦] [7 ♥] [6 ♦] [???] [4♠ ] [3 ♥] [2 ♦] [A♣ ] """)
def test_vypis_sloupecky_vice_karet(capsys): from klondike import vypis_sloupecky vypis_sloupecky([ [(1, 'Pi', True)], [(2, 'Pi', True), (2, 'Sr', True)], [(3, 'Pi', True), (3, 'Sr', True), (3, 'Ka', True)], [(4, 'Pi', True), (4, 'Sr', True), (4, 'Ka', False), (4, 'Kr', True)], [(5, 'Pi', True), (5, 'Sr', True), (5, 'Ka', True)], [(6, 'Pi', True), (6, 'Sr', True)], [(7, 'Pi', True)], ]) out, err = capsys.readouterr() check_text( out, """ [A♠ ] [2♠ ] [3♠ ] [4♠ ] [5♠ ] [6♠ ] [7♠ ] [2 ♥] [3 ♥] [4 ♥] [5 ♥] [6 ♥] [3 ♦] [???] [5 ♦] [4♣ ] """)
def test_vypis_sloupecky_zacatek_hry(capsys): """Kontrola výpisu sloupečků, kde jsou karty i rubem lícem nahoru""" from klondike import vypis_sloupecky sloupecky = [ [(13, 'Pi', False)] * 0 + [(8, 'Kr', True)], [(13, 'Pi', False)] * 1 + [(9, 'Ka', True)], [(13, 'Pi', False)] * 2 + [(10, 'Sr', True)], [(13, 'Pi', False)] * 3 + [(1, 'Ka', True)], [(13, 'Pi', False)] * 4 + [(4, 'Pi', True)], [(13, 'Pi', False)] * 5 + [(9, 'Kr', True)], [(13, 'Pi', False)] * 6 + [(12, 'Sr', True)], ] vypis_sloupecky(sloupecky) out, err = capsys.readouterr() check_text( out, """ [8♣ ] [???] [???] [???] [???] [???] [???] [9 ♦] [???] [???] [???] [???] [???] [X ♥] [???] [???] [???] [???] [A ♦] [???] [???] [???] [4♠ ] [???] [???] [9♣ ] [???] [Q ♥] """)
def test_vypis_sloupecky_jedna_karta_rubem_nahoru(capsys): from klondike import vypis_sloupecky vypis_sloupecky([[(1, 'Pi', False)]] * 7) out, err = capsys.readouterr() check_text(out, "[???] [???] [???] [???] [???] [???] [???]")
def test_vypis_prazdne_sloupecky(capsys): from klondike import vypis_sloupecky vypis_sloupecky([[], [], [], [], [], [], []]) out, err = capsys.readouterr() check_text(out, "")