def test_simple_scoring(capsys): cli_execute( ("seating -vi 0 -p " "1,2,3,4,5,6,7,8,9 2,5,7,1,8,9,4,6,3 4,1,9,7,2,8,3,5,6").split()) outerr = capsys.readouterr() assert outerr.err == "" assert outerr.out == ( "1,2,3,4,5,6,7,8,9\n" "2,5,7,1,8,9,4,6,3\n" "4,1,9,7,2,8,3,5,6\n" "--------------------------------- details ---------------------------------\n" "Round 1: [[1, 2, 3, 4, 5], [6, 7, 8, 9]]\n" "Round 2: [[2, 5, 7, 1, 8], [9, 4, 6, 3]]\n" "Round 3: [[4, 1, 9, 7, 2], [8, 3, 5, 6]]\n" "R1 0.00 OK (predator-prey)\n" "R2 1.00 NOK (opponent thrice): 1-2\n" "R3 0.31 NOK (available vps): mean is 4.56, [6] has 4.0, [1, 2] have 5.0\n" "R4 16.00 NOK (opponent twice): 1-2, 1-4, 1-5, 1-7, 2-4, 2-5, 2-7, " "3-4, 3-5, 3-6, 4-9, 5-8, 6-8, 6-9, 7-8, 7-9\n" "R5 0.00 OK (fifth seat)\n" "R6 0.00 OK (position)\n" "R7 0.00 OK (same seat)\n" "R8 0.27 NOK (starting transfers): mean is 2.67, [3, 5, 7] have 3.0\n" "R9 2.00 NOK (position group): 1 is 2 non-adjacent twice, " "5 is 8 non-adjacent twice\n")
def test(capsys): cli_execute([]) outerr = capsys.readouterr() assert outerr.err == "" assert (outerr.out == """usage: krcg [-h] ... VTES tool optional arguments: -h, --help show this help message and exit subcommands: card show cards complete card name completion search search card deck show TWDA decks top display top cards (most played) affinity display cards affinity (most played together) build build a deck around given card(s), based on the TWDA format format a decklist seating compute optimal seating """ # noqa: W293 )
def test_international(capsys): cli_execute(["card", "--international", ".44 Magnum"]) outerr = capsys.readouterr() assert outerr.err == "" assert ( outerr.out == """.44 Magnum fr -- Magnum .44 es -- Magnum .44 [Equipment][2P] -- (#100001) Weapon: gun. Strike: 2R damage, with 1 optional maneuver each combat. -- fr Arme à feu. Frapper à toute portée : 2 points de dégâts, avec 1 manœuvre optionnelle durant chaque combat. -- es Arma: arma de fuego. Ataque: 2 de daño a distancia, con una maniobra opcional por combate. -- Rulings Provides only ony maneuver each combat, even if the bearer changes. [LSJ 19980302-2] The optional maneuver cannot be used if the strike cannot be used (eg. {Hidden Lurker}). [LSJ 20021028] """ # noqa: E501 )
def test(capsys): cli_execute(["affinity", "--from", "2015", "--to", "2020", "Fame"]) outerr = capsys.readouterr() assert outerr.err == "" assert ( outerr.out == """Taste of Vitae (in 61% of decks, typically 3-5 copies) Powerbase: Montreal (in 44% of decks, typically 1 copy) Haven Uncovered (in 37% of decks, typically 1-4 copies) Target Vitals (in 37% of decks, typically 2-5 copies) Anarch Convert (in 36% of decks, typically 2-5 copies) Cats' Guidance (in 36% of decks, typically 2-5 copies) Ashur Tablets (in 35% of decks, typically 6-11 copies) Carrion Crows (in 34% of decks, typically 7-11 copies) Archon Investigation (in 32% of decks, typically 1 copy) Deep Song (in 31% of decks, typically 5-11 copies) The Parthenon (in 30% of decks, typically 1-4 copies) Canine Horde (in 29% of decks, typically 1-3 copies) Anarch Revolt (in 28% of decks, typically 3-9 copies) Aid from Bats (in 28% of decks, typically 9-15 copies) The Rack (in 26% of decks, typically 1 copy) Dragonbound (in 26% of decks, typically 1 copy) Stick (in 26% of decks, typically 1 copy) Beetleman (in 25% of decks, typically 1 copy) The Unmasking (in 25% of decks, typically 1-2 copies) """) cli_execute(["affinity", "Foobar"]) outerr = capsys.readouterr() assert outerr.err == "Card not found: foobar\n" assert outerr.out == ""
def test_text(capsys): cli_execute(["card", "--text", "alastor"]) outerr = capsys.readouterr() assert outerr.err == "" assert ( outerr.out == """Alastor [Political Action] -- (#100038) Requires a justicar or Inner Circle member. Choose a ready Camarilla vampire. If this referendum is successful, search your library for an equipment card and place this card and the equipment on the chosen vampire. Pay half the cost (round down) of the equipment. This vampire may enter combat with any vampire controlled by another Methuselah as a +1 stealth Ⓓ action. This vampire cannot commit diablerie. A vampire may have only one Alastor. """ # noqa: E501 )
def test_base(capsys): cli_execute(["card", "krcg"]) outerr = capsys.readouterr() assert outerr.err == "" assert ( outerr.out == """KRCG News Radio [Master][2P] -- (#101067) Unique location. Lock to give a minion you control +1 intercept. Lock and burn 1 pool to give a minion controlled by another Methuselah +1 intercept. """ # noqa: E501 )
def test(capsys): cli_execute(["complete", "Pentex"]) outerr = capsys.readouterr() assert outerr.err == "" assert ( outerr.out == """Pentex™ Loves You! Pentex™ Subversion Enzo Giovanni, Pentex Board of Directors Enzo Giovanni, Pentex Board of Directors (ADV) Harold Zettler, Pentex Director """ )
def test(capsys): cli_execute(["top", "--from", "2015", "--to", "2020", "-d", "ani"]) outerr = capsys.readouterr() assert outerr.err == "" assert ( outerr.out == """Carrion Crows (played in 72 decks, typically 5-10 copies) Cats' Guidance (played in 70 decks, typically 2-6 copies) Deep Song (played in 58 decks, typically 3-10 copies) Sense the Savage Way (played in 55 decks, typically 2-7 copies) Canine Horde (played in 54 decks, typically 1-2 copies) Raven Spy (played in 47 decks, typically 1-5 copies) Aid from Bats (played in 44 decks, typically 6-14 copies) Army of Rats (played in 40 decks, typically 1-2 copies) Guard Dogs (played in 30 decks, typically 1-4 copies) Beetleman (played in 29 decks, typically 1 copy) """)
def test_links(capsys): cli_execute(["card", "--links", "alastor"]) outerr = capsys.readouterr() assert outerr.err == "" assert ( outerr.out == """Alastor [Political Action] -- (#100038) Requires a justicar or Inner Circle member. Choose a ready Camarilla vampire. If this referendum is successful, search your library for an equipment card and place this card and the equipment on the chosen vampire. Pay half the cost (round down) of the equipment. This vampire may enter combat with any vampire controlled by another Methuselah as a +1 stealth Ⓓ action. This vampire cannot commit diablerie. A vampire may have only one Alastor. -- Rulings If the given weapon costs blood, the target Alastor pays the cost. [LSJ 20040518] Requirements do not apply. If a discipline is required (eg. {Inscription}) and the Alastor vampire does not have it, the inferior version is used. [ANK 20200901] [LSJ 20040518-2] [LSJ 20040518]: https://groups.google.com/d/msg/rec.games.trading-cards.jyhad/4emymfUPwAM/B2SCC7L6kuMJ [ANK 20200901]: http://www.vekn.net/forum/rules-questions/78830-alastor-and-ankara-citadel#100653 [LSJ 20040518-2]: https://groups.google.com/g/rec.games.trading-cards.jyhad/c/4emymfUPwAM/m/JF_o7OOoCbkJ """ # noqa: E501 )
def test_base(capsys): # # Base usage, defaults to 3 rounds # cli_execute("seating -i 1 12".split()) outerr = capsys.readouterr() assert outerr.err == "" assert outerr.out assert set(int(i) for i in outerr.out.split()[0].split(",")) == set(range(1, 13)) assert set(int(i) for i in outerr.out.split()[1].split(",")) == set(range(1, 13)) assert set(int(i) for i in outerr.out.split()[2].split(",")) == set(range(1, 13)) # # Two rounds # cli_execute("seating -i 1 -r 2 12".split()) outerr = capsys.readouterr() assert outerr.err == "" assert outerr.out assert set(int(i) for i in outerr.out.split()[0].split(",")) == set(range(1, 13)) assert set(int(i) for i in outerr.out.split()[1].split(",")) == set(range(1, 13)) # # Two rounds for six players results in three intertwined rounds with sit outs # cli_execute("seating -i 1 -r 2 6".split()) outerr = capsys.readouterr() assert outerr.err == "" assert outerr.out players = set(range(1, 7)) assert set(int(i) for i in outerr.out.split()[0].split(",")).issubset(players) assert set(int(i) for i in outerr.out.split()[1].split(",")).issubset(players) assert set(int(i) for i in outerr.out.split()[2].split(",")).issubset(players)
def test(capsys): cli_execute(["deck", "foobar"]) outerr = capsys.readouterr() assert outerr.err == '"foobar" did not match a deck #, card or author' assert outerr.out == "" cli_execute(["deck", "2010tcdbng"]) outerr = capsys.readouterr() assert outerr.err == "" assert ( outerr.out == """[2010tcdbng ]=================================================== Trading Card Day Bad Naumheim, Germany May 8th 2010 2R+F 10 players Rudolf Scholz -- 4vp in the final Deck Name: The Storage Procurers Description: Allies with Flash Grenades to keep troubles at bay. Storage Annex for card efficiency and a structured hand. Weenies and Midcaps with Obfuscate and/or Dominate to oust via Conditionings and Deflections. Crypt (12 cards, min=7, max=24, avg=3.75) ----------------------------------------- 1x Gilbert Duane 7 AUS DOM OBF prince Malkavian:1 1x Mariel, Lady Thunder 7 DOM OBF aus tha Malkavian:1 1x Badr al-Budur 5 OBF cel dom qui Banu Haqim:2 1x Count Ormonde 5 OBF dom pre ser Ministry:2 1x Didi Meyers 5 DOM aus cel obf Malkavian:1 1x Zebulon 5 OBF aus dom pro Malkavian:1 1x Dimple 2 obf Nosferatu:1 1x Mustafa Rahman 2 dom Tremere:2 1x Normal 2 obf Malkavian:1 1x Ohanna 2 dom Malkavian:2 1x Samson 2 dom Ventrue antitribu:2 1x Basil 1 obf Pander:2 Library (87 cards) Master (19; 3 trifle) 1x Channel 10 2x Charisma 1x Creepshow Casino 1x KRCG News Radio 2x Perfectionist 6x Storage Annex -- great card! usually underestimated 3x Sudden Reversal 3x Vessel Ally (12) 1x Carlton Van Wyk 1x Gregory Winter 1x Impundulu 1x Muddled Vampire Hunter 1x Ossian 6x Procurer 1x Young Bloods Equipment (9) 1x Deer Rifle 8x Flash Grenade -- brings fear to the methuselahs rather than to minions Action Modifier (19) 6x Cloak the Gathering 7x Conditioning -- should be more! 2x Lost in Crowds 4x Veil the Legions Reaction (16) 7x Deflection 2x Delaying Tactics 7x On the Qui Vive Combat (8) 8x Concealed Weapon Event (4) 1x FBI Special Affairs Division 1x Hunger Moon 1x Restricted Vitae 1x Unmasking, The """ # noqa: E501 ) cli_execute([ "deck", "--from", "2019-01-01", "--to", "2020-01-01", "--players", "25", "Fame", ]) outerr = capsys.readouterr() assert outerr.err == "" assert (outerr.out == """-- 4 decks -- [2019pncwp] Anson Ashurs [2019ecwon2pf] None [2019ecday2pf] Finnish Politics [2019ptfplpp] Amiable Jacko and friends """) cli_execute(["deck", "--to", "2020-01-01", "Rudolf Scholz"]) outerr = capsys.readouterr() assert outerr.err == "" assert (outerr.out == """-- 11 decks -- [2k8madhanau] Thank You Vlada [2010dorkside] New Days, Old School [2010tcdbng] The Storage Procurers [2011pombmg] Announce your PRE [2012dnccd] Anson will find the Danish throne [2013dnccd] Obey the Tremere [2013fcqf14pf] Maris et Lutz à Paris [2015gitamv2bng] Anson reloaded [2017gecqgitamv4bng] German ECQ 2017 (1st place): Matasuntha's unbound heart [2018dnccd] Danish Nationals 2018 (1st Place): Supply and Demand [2019bfbafg] Swedish Legionnaires """) cli_execute([ "deck", "--from", "2018", "--to", "2019", "--players", "50", ]) outerr = capsys.readouterr() assert outerr.err == "" assert (outerr.out == """-- 5 decks -- [2018igpadhs] None [2018eclcqwp] Dear diary, today I feel like a wraith.. Liquidation [2018ecday1wp] MMA.MPA (EC 2018) [2018ecday2wp] EC 2018 win [2018pncwp] Deadly kittens """)
def test(capsys, tmpdir): file_path = tmpdir + "test-format.txt" with file_path.open("w") as f: f.write("""Crypt (12 cards, min=7, max=24, avg=3.75) ----------------------------------------- 1x Gilbert Duane 7 AUS DOM OBF prince Malkavian:1 1x Mariel, Lady Thunder 7 DOM OBF aus tha Malkavian:1 1x Badr al-Budur 5 OBF cel dom qui Banu Haqim:2 1x Count Ormonde 5 OBF dom pre ser Ministry:2 1x Didi Meyers 5 DOM aus cel obf Malkavian:1 1x Zebulon 5 OBF aus dom pro Malkavian:1 1x Dimple 2 obf Nosferatu:1 1x Mustafa Rahman 2 dom Tremere:2 1x Normal 2 obf Malkavian:1 1x Ohanna 2 dom Malkavian:2 1x Samson 2 dom Ventrue antitribu:2 1x Basil 1 obf Pander:2 Library (87 cards) Master (19; 3 trifle) 1x Channel 10 2x Charisma 1x Creepshow Casino 1x KRCG News Radio 2x Perfectionist 6x Storage Annex 3x Sudden Reversal 3x Vessel Ally (12) 1x Carlton Van Wyk 1x Gregory Winter 1x Impundulu 1x Muddled Vampire Hunter 1x Ossian 6x Procurer 1x Young Bloods Equipment (9) 1x Deer Rifle 8x Flash Grenade Action Modifier (19) 6x Cloak the Gathering 7x Conditioning 2x Lost in Crowds 4x Veil the Legions Reaction (16) 7x Deflection 2x Delaying Tactics 7x On the Qui Vive Combat (8) 8x Concealed Weapon Event (4) 1x FBI Special Affairs Division 1x Hunger Moon 1x Restricted Vitae 1x Unmasking, The """) cli_execute(["format", "-f", "twd", str(file_path)]) outerr = capsys.readouterr() assert outerr.err == "" assert outerr.out == ("""Crypt (12 cards, min=7, max=24, avg=3.75) ----------------------------------------- 1x Gilbert Duane 7 AUS DOM OBF prince Malkavian:1 1x Mariel, Lady Thunder 7 DOM OBF aus tha Malkavian:1 1x Badr al-Budur 5 OBF cel dom qui Banu Haqim:2 1x Count Ormonde 5 OBF dom pre ser Ministry:2 1x Didi Meyers 5 DOM aus cel obf Malkavian:1 1x Zebulon 5 OBF aus dom pro Malkavian:1 1x Dimple 2 obf Nosferatu:1 1x Mustafa Rahman 2 dom Tremere:2 1x Normal 2 obf Malkavian:1 1x Ohanna 2 dom Malkavian:2 1x Samson 2 dom Ventrue antitribu:2 1x Basil 1 obf Pander:2 Library (87 cards) Master (19; 3 trifle) 1x Channel 10 2x Charisma 1x Creepshow Casino 1x KRCG News Radio 2x Perfectionist 6x Storage Annex 3x Sudden Reversal 3x Vessel Ally (12) 1x Carlton Van Wyk 1x Gregory Winter 1x Impundulu 1x Muddled Vampire Hunter 1x Ossian 6x Procurer 1x Young Bloods Equipment (9) 1x Deer Rifle 8x Flash Grenade Action Modifier (19) 6x Cloak the Gathering 7x Conditioning 2x Lost in Crowds 4x Veil the Legions Reaction (16) 7x Deflection 2x Delaying Tactics 7x On the Qui Vive Combat (8) 8x Concealed Weapon Event (4) 1x FBI Special Affairs Division 1x Hunger Moon 1x Restricted Vitae 1x Unmasking, The """) cli_execute(["format", "-f", "lackey", str(file_path)]) outerr = capsys.readouterr() assert outerr.err == "" assert (outerr.out == """1 Channel 10 2 Charisma 1 Creepshow Casino 1 KRCG News Radio 2 Perfectionist 6 Storage Annex 3 Sudden Reversal 3 Vessel 1 Carlton Van Wyk 1 Gregory Winter 1 Impundulu 1 Muddled Vampire Hunter 1 Ossian 6 Procurer 1 Young Bloods 1 Deer Rifle 8 Flash Grenade 6 Cloak the Gathering 7 Conditioning 2 Lost in Crowds 4 Veil the Legions 7 Deflection 2 Delaying Tactics 7 On the Qui Vive 8 Concealed Weapon 1 FBI Special Affairs Division 1 Hunger Moon 1 Restricted Vitae 1 Unmasking, The Crypt: 1 Gilbert Duane 1 Mariel, Lady Thunder 1 Badr al-Budur 1 Count Ormonde 1 Didi Meyers 1 Zebulon 1 Dimple 1 Mustafa Rahman 1 Normal 1 Ohanna 1 Samson 1 Basil """) cli_execute(["format", "-f", "jol", str(file_path)]) outerr = capsys.readouterr() assert outerr.err == "" assert (outerr.out == """1x Gilbert Duane 1x Mariel, Lady Thunder 1x Badr al-Budur 1x Count Ormonde 1x Didi Meyers 1x Zebulon 1x Dimple 1x Mustafa Rahman 1x Normal 1x Ohanna 1x Samson 1x Basil 1x Channel 10 2x Charisma 1x Creepshow Casino 1x KRCG News Radio 2x Perfectionist 6x Storage Annex 3x Sudden Reversal 3x Vessel 1x Carlton Van Wyk 1x Gregory Winter 1x Impundulu 1x Muddled Vampire Hunter 1x Ossian 6x Procurer 1x Young Bloods 1x Deer Rifle 8x Flash Grenade 6x Cloak the Gathering 7x Conditioning 2x Lost in Crowds 4x Veil the Legions 7x Deflection 2x Delaying Tactics 7x On the Qui Vive 8x Concealed Weapon 1x FBI Special Affairs Division 1x Hunger Moon 1x Restricted Vitae 1x Unmasking, The """) cli_execute(["format", "-f", "json", str(file_path)]) outerr = capsys.readouterr() assert outerr.err == "" assert (outerr.out == """{ "crypt": { "count": 12, "cards": [ { "id": 200517, "count": 1, "name": "Gilbert Duane" }, { "id": 200929, "count": 1, "name": "Mariel, Lady Thunder" }, { "id": 200161, "count": 1, "name": "Badr al-Budur" }, { "id": 200295, "count": 1, "name": "Count Ormonde" }, { "id": 200343, "count": 1, "name": "Didi Meyers" }, { "id": 201503, "count": 1, "name": "Zebulon" }, { "id": 200346, "count": 1, "name": "Dimple" }, { "id": 201027, "count": 1, "name": "Mustafa Rahman" }, { "id": 201065, "count": 1, "name": "Normal" }, { "id": 201073, "count": 1, "name": "Ohanna" }, { "id": 201231, "count": 1, "name": "Samson" }, { "id": 200173, "count": 1, "name": "Basil" } ] }, "library": { "count": 87, "cards": [ { "type": "Master", "count": 19, "cards": [ { "id": 100327, "count": 1, "name": "Channel 10" }, { "id": 100332, "count": 2, "name": "Charisma" }, { "id": 100444, "count": 1, "name": "Creepshow Casino" }, { "id": 101067, "count": 1, "name": "KRCG News Radio" }, { "id": 101388, "count": 2, "name": "Perfectionist" }, { "id": 101877, "count": 6, "name": "Storage Annex" }, { "id": 101896, "count": 3, "name": "Sudden Reversal" }, { "id": 102113, "count": 3, "name": "Vessel" } ] }, { "type": "Ally", "count": 12, "cards": [ { "id": 100298, "count": 1, "name": "Carlton Van Wyk" }, { "id": 100855, "count": 1, "name": "Gregory Winter" }, { "id": 100966, "count": 1, "name": "Impundulu" }, { "id": 101250, "count": 1, "name": "Muddled Vampire Hunter" }, { "id": 101333, "count": 1, "name": "Ossian" }, { "id": 101491, "count": 6, "name": "Procurer" }, { "id": 102202, "count": 1, "name": "Young Bloods" } ] }, { "type": "Equipment", "count": 9, "cards": [ { "id": 100516, "count": 1, "name": "Deer Rifle" }, { "id": 100745, "count": 8, "name": "Flash Grenade" } ] }, { "type": "Action Modifier", "count": 19, "cards": [ { "id": 100362, "count": 6, "name": "Cloak the Gathering" }, { "id": 100401, "count": 7, "name": "Conditioning" }, { "id": 101125, "count": 2, "name": "Lost in Crowds" }, { "id": 102097, "count": 4, "name": "Veil the Legions" } ] }, { "type": "Reaction", "count": 16, "cards": [ { "id": 100518, "count": 7, "name": "Deflection" }, { "id": 100519, "count": 2, "name": "Delaying Tactics" }, { "id": 101321, "count": 7, "name": "On the Qui Vive" } ] }, { "type": "Combat", "count": 8, "cards": [ { "id": 100392, "count": 8, "name": "Concealed Weapon" } ] }, { "type": "Event", "count": 4, "cards": [ { "id": 100709, "count": 1, "name": "FBI Special Affairs Division" }, { "id": 100944, "count": 1, "name": "Hunger Moon" }, { "id": 101614, "count": 1, "name": "Restricted Vitae" }, { "id": 102079, "count": 1, "name": "The Unmasking" } ] } ] } }""")
def test(capsys): cli_execute(["build", "--from", "2018", "--to", "2020", "KRCG"]) outerr = capsys.readouterr() assert outerr.err == "" assert (outerr.out == """Created by: KRCG Inspired by: - 2019ctllpdvs (No Name) - 2019bcspspdms (No Name) - 2019gppwp Bored Owain (sorry, I just need to do it - Szewski) - 2018pbcthbc !Ventrue Toolbox Crypt (12 cards, min=19, max=31, avg=6.33) ------------------------------------------ 2x Owain Evans, The Wanderer 8 AUS DOM FOR cel pre Ventrue antitribu:3 2x Blackhorse Tanner 7 AUS DOM FOR Ventrue antitribu:3 1x Joseph O'Grady 7 DOM FOR aus cel Ventrue antitribu:3 1x Charice Fontaigne 6 AUS DOM for pot Ventrue antitribu:3 2x Jefferson Foster 6 AUS DOM for tha bishop Ventrue antitribu:4 1x Neighbor John 5 AUS dom for Ventrue antitribu:4 1x Jesse Menks 8 AUS DOM FOR ani archbishop Ventrue antitribu:3 1x Jephta Hester 5 DOM FOR aus Ventrue antitribu:4 1x Ulrike Rothbart 3 dom for Ventrue antitribu:4 Library (90 cards) Master (19; 5 trifle) 1x Anarch Troublemaker 2x Blood Doll 1x Channel 10 1x Corporate Hunting Ground 2x Dreams of the Sphinx 1x Giant's Blood 1x KRCG News Radio 1x Misdirection 1x Pentex(TM) Subversion 1x Powerbase: Barranquilla 1x Powerbase: Montreal 3x Vessel 1x Wall Street Night, Financial Newspaper 2x Wider View Action (14) 1x Abbot 13x Govern the Unaligned Equipment (3) 1x Bowl of Convergence 1x Heart of Nizchetus 1x Ivory Bow Action Modifier (10) 2x Bonding 5x Conditioning 2x Daring the Dawn 1x Day Operation Reaction (28) 6x Deflection 2x Delaying Tactics 2x Eagle's Sight 2x Enhanced Senses 5x Eyes of Argus 2x My Enemy's Enemy 5x On the Qui Vive 4x Telepathic Misdirection Combat (16) 4x Hidden Strength 3x Indomitability 4x Rolling with the Punches 5x Weighted Walking Stick """) cli_execute(["build", "Foobar"]) outerr = capsys.readouterr() assert outerr.err == "Card not found: foobar\n" assert outerr.out == ""
def test_short(capsys): cli_execute(["card", "--short", "alastor"]) outerr = capsys.readouterr() assert outerr.err == "" assert outerr.out == "Alastor\n"
def test_add_remove(capsys): # # Adding and removing players after first round have been played # cli_execute( "seating -i 1 -p 1,2,3,4,5,6,7,8,9,10,11,12 --add 13 14 --remove 5". split()) outerr = capsys.readouterr() assert outerr.err == "" assert outerr.out # played round is left untouched assert outerr.out.split()[0] == "1,2,3,4,5,6,7,8,9,10,11,12" # other rounds have new players players = (set(range(1, 13)) - {5}) | {13, 14} assert set(int(i) for i in outerr.out.split()[1].split(",")) == players assert set(int(i) for i in outerr.out.split()[2].split(",")) == players # # Down to 11 players with 2 rounds left is doable, it adds a round # cli_execute( "seating -i 1 -p 1,2,3,4,5,6,7,8,9,10,11,12 --remove 5".split()) outerr = capsys.readouterr() assert outerr.err == "" assert outerr.out assert outerr.out.split()[0] == "1,2,3,4,5,6,7,8,9,10,11,12" players = set(range(1, 13)) - {5} assert set(int(i) for i in outerr.out.split()[1].split(",")).issubset(players) assert set(int(i) for i in outerr.out.split()[2].split(",")).issubset(players) assert set(int(i) for i in outerr.out.split()[3].split(",")).issubset(players) # # Down to 7 players with 2 rounds left is doable too # cli_execute("seating -i 1 -p 1,2,3,4,5,6,7,8,9 --remove 4 5".split()) outerr = capsys.readouterr() assert outerr.err == "" assert outerr.out assert outerr.out.split()[0] == "1,2,3,4,5,6,7,8,9" players = set(range(1, 10)) - {4, 5} assert set(int(i) for i in outerr.out.split()[1].split(",")).issubset(players) assert set(int(i) for i in outerr.out.split()[2].split(",")).issubset(players) assert set(int(i) for i in outerr.out.split()[3].split(",")).issubset(players) # # down to 11 players with a single round left to play is impossible # cli_execute(("seating -i 1 -p 1,2,3,4,5,6,7,8,9,10,11,12 " "12,11,10,9,8,7,6,5,4,3,2,1 --remove 5").split()) outerr = capsys.readouterr() assert (outerr.err == "seating cannot be arranged - more rounds or players required\n") assert outerr.out == "" # # but 10 players with a single round is OK # cli_execute(("seating -i 1 -p 1,2,3,4,5,6,7,8,9,10,11,12 " "12,11,10,9,8,7,6,5,4,3,2,1 --remove 5 6").split()) outerr = capsys.readouterr() assert outerr.err == "" assert outerr.out assert outerr.out.split()[0] == "1,2,3,4,5,6,7,8,9,10,11,12" assert outerr.out.split()[1] == "12,11,10,9,8,7,6,5,4,3,2,1" players = set(range(1, 13)) - {5, 6} assert set(int(i) for i in outerr.out.split()[2].split(",")) == players
def test(capsys): cli_execute(["search", "--text", "Pentex"]) outerr = capsys.readouterr() assert outerr.err == "" assert (outerr.out == """Enzo Giovanni, Pentex Board of Directors Enzo Giovanni, Pentex Board of Directors (ADV) Harold Zettler, Pentex Director Pentex™ Loves You! Pentex™ Subversion """) cli_execute(["search", "--city", "chicago"]) outerr = capsys.readouterr() assert outerr.err == "" assert (outerr.out == """Antón de Concepción Crusade: Chicago Horatio Ballard Lachlan, Noddist Lodin (Olaf Holte) Maldavis (ADV) Maxwell Praxis Seizure: Chicago Sir Walter Nash """) cli_execute(["search", "--title", "imperator"]) outerr = capsys.readouterr() assert outerr.err == "" assert (outerr.out == """Imperator Karsh (ADV) National Guard Support Persona Non Grata Reinforcements Rubicon Scourge """) cli_execute(["search", "--title", "primogen", "-d", "ser"]) outerr = capsys.readouterr() assert outerr.err == "" assert outerr.out == "Amenophobis\n" cli_execute(["search", "--bonus", "stealth", "votes"]) outerr = capsys.readouterr() assert outerr.err == "" assert (outerr.out == """Antonio Veradas Bulscu (ADV) Dark Selina Jessica (ADV) Joseph Cambridge Karen Suadela Loki's Gift Maxwell Natasha Volfchek Perfect Paragon ... 3 more results, use -n 13 to display them. """) cli_execute(["search", "--bonus", "stealth", "votes", "-n", "13"]) outerr = capsys.readouterr() assert outerr.err == "" assert (outerr.out == """Antonio Veradas Bulscu (ADV) Dark Selina Jessica (ADV) Joseph Cambridge Karen Suadela Loki's Gift Maxwell Natasha Volfchek Perfect Paragon Sela (ADV) Suhailah Zayyat, The Sandstorm """)
def test_id(capsys): cli_execute(["card", "-s", "100001"]) outerr = capsys.readouterr() assert outerr.err == "" assert outerr.out == ".44 Magnum\n"