2026-04-29 00:20:55 -04:00
|
|
|
from django.test import SimpleTestCase
|
|
|
|
|
|
|
|
|
|
from apps.epic.models import TarotCard
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _card(arcana, number, suit='', icon=''):
|
|
|
|
|
c = TarotCard()
|
|
|
|
|
c.arcana = arcana
|
|
|
|
|
c.number = number
|
|
|
|
|
c.suit = suit
|
|
|
|
|
c.icon = icon
|
|
|
|
|
return c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TarotCardCornerRankTest(SimpleTestCase):
|
|
|
|
|
"""TarotCard.corner_rank — alphanumeric display labels."""
|
|
|
|
|
|
|
|
|
|
def test_major_arcana_0_gives_0(self):
|
|
|
|
|
self.assertEqual(_card('MAJOR', 0).corner_rank, '0')
|
|
|
|
|
|
|
|
|
|
def test_major_arcana_1_gives_roman_I(self):
|
|
|
|
|
self.assertEqual(_card('MAJOR', 1).corner_rank, 'I')
|
|
|
|
|
|
|
|
|
|
def test_major_arcana_2_gives_roman_II(self):
|
|
|
|
|
self.assertEqual(_card('MAJOR', 2).corner_rank, 'II')
|
|
|
|
|
|
|
|
|
|
def test_non_major_pip_1_gives_A(self):
|
|
|
|
|
"""Ace — pip card number 1 should show 'A', not '1'."""
|
|
|
|
|
self.assertEqual(_card('MIDDLE', 1, 'BRANDS').corner_rank, 'A')
|
|
|
|
|
|
|
|
|
|
def test_non_major_pip_2_gives_2(self):
|
|
|
|
|
self.assertEqual(_card('MIDDLE', 2, 'BRANDS').corner_rank, '2')
|
|
|
|
|
|
|
|
|
|
def test_non_major_pip_10_gives_10(self):
|
|
|
|
|
self.assertEqual(_card('MIDDLE', 10, 'CROWNS').corner_rank, '10')
|
|
|
|
|
|
|
|
|
|
def test_court_maid_gives_M(self):
|
|
|
|
|
self.assertEqual(_card('MIDDLE', 11, 'GRAILS').corner_rank, 'M')
|
|
|
|
|
|
|
|
|
|
def test_court_jack_gives_J(self):
|
|
|
|
|
self.assertEqual(_card('MIDDLE', 12, 'BLADES').corner_rank, 'J')
|
|
|
|
|
|
|
|
|
|
def test_court_queen_gives_Q(self):
|
|
|
|
|
self.assertEqual(_card('MIDDLE', 13, 'BRANDS').corner_rank, 'Q')
|
|
|
|
|
|
|
|
|
|
def test_court_king_gives_K(self):
|
|
|
|
|
self.assertEqual(_card('MIDDLE', 14, 'CROWNS').corner_rank, 'K')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TarotCardSuitIconTest(SimpleTestCase):
|
|
|
|
|
"""TarotCard.suit_icon — icon class resolution."""
|
|
|
|
|
|
|
|
|
|
def test_major_with_icon_returns_icon(self):
|
2026-04-29 12:07:41 -04:00
|
|
|
self.assertEqual(_card('MAJOR', 0, icon='fa-hat-cowboy-side').suit_icon, 'fa-hat-cowboy-side')
|
2026-04-29 00:20:55 -04:00
|
|
|
|
|
|
|
|
def test_major_without_icon_returns_empty(self):
|
|
|
|
|
self.assertEqual(_card('MAJOR', 5).suit_icon, '')
|
|
|
|
|
|
|
|
|
|
def test_brands_returns_wand_sparkles(self):
|
|
|
|
|
self.assertEqual(_card('MIDDLE', 11, 'BRANDS').suit_icon, 'fa-wand-sparkles')
|
|
|
|
|
|
|
|
|
|
def test_grails_returns_trophy(self):
|
|
|
|
|
self.assertEqual(_card('MIDDLE', 11, 'GRAILS').suit_icon, 'fa-trophy')
|
|
|
|
|
|
|
|
|
|
def test_blades_returns_gun(self):
|
|
|
|
|
self.assertEqual(_card('MIDDLE', 11, 'BLADES').suit_icon, 'fa-gun')
|
|
|
|
|
|
|
|
|
|
def test_crowns_returns_crown(self):
|
|
|
|
|
self.assertEqual(_card('MIDDLE', 11, 'CROWNS').suit_icon, 'fa-crown')
|
|
|
|
|
|
|
|
|
|
def test_icon_override_takes_priority_over_suit(self):
|
|
|
|
|
self.assertEqual(_card('MIDDLE', 11, 'CROWNS', icon='fa-star').suit_icon, 'fa-star')
|