def deck_sort(c: Card) -> str: s = '' if c.is_creature(): s += 'A' elif c.is_land(): s += 'C' else: s += 'B' m = 'A' for cost in c.get('mana_cost') or (): if mana.has_x(cost): m = 'X' s += m s += str(c.cmc).zfill(10) s += c.name return s
def test_has_x() -> None: assert mana.has_x('{9}{X}') assert not mana.has_x('{1}{W}{W}') assert mana.has_x('{X}{Y}{R}') assert not mana.has_x('{C}') assert mana.has_x('{Y}{Z}')