Exemplo n.º 1
0
def test_team_stats():
    input_values = [
        'Team1', '1', 'Steve', '100', 'y', 'Amazing Ability', '5000', 'n', 'y',
        'Amazing Weapon', '200', 'n', 'y', 'God Armor', '500', 'n', 'Team2',
        '2', 'Fivee', '100', 'y', 'Amazing Ability', '100', 'n', 'y',
        'Amazing Weapon', '200', 'n', 'y', 'God Armor', '500', 'n', 'Amazin',
        '100', 'y', 'Amazing Ability', '100', 'n', 'y', 'Amazing Weapon',
        '200', 'n', 'y', 'God Armor', '500', 'n'
    ]

    def mock_input(s):
        if input_values != []:
            return input_values.pop(0)

    superheroes.input = mock_input

    arena = superheroes.Arena()
    arena.build_team_one()
    arena.build_team_two()

    arena.team_battle()

    arena.show_stats()

    output_str = capture_console_output(arena.show_stats)
Exemplo n.º 2
0
def test_create_weapon():
    input_values = ["Amazing Weapon", '200']
    def mock_input(s):
        return input_values.pop(0)
    superheroes.input = mock_input
    arena = superheroes.Arena()
    weapon = arena.create_weapon()
    assert ['Amazing Weapon', 200] == [weapon.name, weapon.max_damage]
Exemplo n.º 3
0
def test_create_armor():
    input_values = ["Amazing Armor", '300']

    def mock_input(s):
        return input_values.pop(0)

    superheroes.input = mock_input
    arena = superheroes.Arena()
    armor = arena.create_armor()
    assert ['Amazing Armor', 300] == [armor.name, armor.max_block]
Exemplo n.º 4
0
def test_build_team_one():
    input_values = ['Team 2', '1', 'Ben', '100', 'y', 'Amazing Ability', '100', 'n',
                    'y', 'Amazing Weapon', '200', 'n', 'y', 'God Armor', '500', 'n']
    
    def mock_input(s):
        return input_values.pop(0)
    superheroes.input = mock_input

    arena = superheroes.Arena()
    arena.build_team_one()

    assert [1, 'Ben'] == [len(arena.team_one.heroes), arena.team_one.heroes[0].name]
Exemplo n.º 5
0
def test_create_ability():
    input_values = ["Amazing Ability", '200']
    # output = []
    def mock_input(s):
        # output.append(s)
        return input_values.pop(0)
    superheroes.input = mock_input
    # superheroes.print = lambda s: output.append(s)

    arena = superheroes.Arena()
    ability = arena.create_ability()

    assert ['Amazing Ability', 200] == [ability.name, ability.max_damage]
Exemplo n.º 6
0
def test_create_hero():
    # These are the values needed to create a hero. Could be different from application to application
    # due to implementation
    input_values = ['Ben', '100', 'y', 'Amazing Ability', '100', 'n',
                    'y', 'Amazing Weapon', '200', 'n', 'y', 'God Armor', '500', 'n']

    def mock_input(s):
        return input_values.pop(0)
    superheroes.input = mock_input

    arena = superheroes.Arena()
    hero = arena.create_hero()

    assert ['Ben', 100, True, 0, 0] == [hero.name, hero.current_health, hero.is_alive(), hero.kills, hero.deaths]
Exemplo n.º 7
0
def test_team_stats():
    input_values = ['1', 'Steve', '100', 'y', 'Amazing Ability', '5000', 'n',
                    'y', 'Amazing Weapon', '200', 'n', 'y', 'God Armor', '500', 'n',
                    '1', 'Fivee', '100', 'y', 'Amazing Ability', '100', 'n',
                    'y', 'Amazing Weapon', '200', 'n', 'y', 'God Armor', '500', 'n']

    def mock_input(s):
        return input_values.pop(0)
    superheroes.input = mock_input

    arena = superheroes.Arena()

	arena.build_team_one()
	arena.build_team_two()
Exemplo n.º 8
0
def test_build_team_two():
    input_values = [
        'Team 1', '1', 'Ben is the Best', '100', '1', 'Ian is SUPER COOL',
        '100', '1', 'AMAZING ABILITY', '100', '1', 'AMAZIN', '200', 'GOD ARMOR'
    ]

    def mock_input(s):
        return input_values.pop(0)

    superheroes.input = mock_input

    arena = superheroes.Arena()
    arena.build_team_two()

    assert [1, 'Ben is the Best'
            ] == [len(arena.team2.heroes), arena.team2.heroes[0].name]
Exemplo n.º 9
0
def test_build_team_two():
    input_values = [
        'Team 2', '1', 'Steve', '100', 'A', 'Amazing Ability', '100', 'W',
        'Awesome Weapon', '200', 'R', 'Breastplate', '300', 'F'
    ]

    def mock_input(s):
        return input_values.pop(0)

    superheroes.input = mock_input

    arena = superheroes.Arena()
    arena.build_team_two()

    assert [1, 'Steve'
            ] == [len(arena.team_two.heroes), arena.team_two.heroes[0].name]
Exemplo n.º 10
0
def test_team_stats():
    input_values = [
        'meme', '1', 'test', 'god', '1000', 'meme', '1000', 'meme', '1000',
        'bad team', '1', 'test', 'god', '1000', 'meme', '1000', 'meme', '1000'
    ]

    def mock_input(s):
        return input_values.pop(0)

    superheroes.input = mock_input

    arena = superheroes.Arena()
    arena.build_team_one()
    arena.build_team_two()

    arena.team_battle()
    print("battle completed")
Exemplo n.º 11
0
def test_create_hero():
    # These are the values needed to create a hero. Could be different from application to application
    # due to implementation
    input_values = [
        'Ben', '100', '1', 'Ian is SUPER COOL', '100', '1', 'AMAZING ABILITY',
        '100', '1', 'AMAZIN', '200', 'GOD ARMOR'
    ]

    def mock_input(s):
        return input_values.pop(0)

    superheroes.input = mock_input

    arena = superheroes.Arena()
    hero = arena.create_hero()

    assert ['Ben', 100, True, 0, 0] == [
        hero.name, hero.current_health,
        hero.is_alive(), hero.kills, hero.deaths
    ]
Exemplo n.º 12
0
def test_team_stats():
    input_values = [
        'Team 1', '1', 'Ben', '100', '1', 'Mondale', '100', '1',
        'Amazin Ability', '100', '1', 'AMAZIN', '200', 'Team 2', '1', 'Ben',
        '100', '1', 'Ian', '100', '1', 'Amazin Ability', '100', '1', 'AMAZIN',
        '200'
    ]

    def mock_input(s):
        return input_values.pop(0)

    superheroes.input = mock_input

    arena = superheroes.Arena()
    arena.build_team_one()
    arena.build_team_two()

    arena.team_battle()

    arena.show_stats()

    output_str = capture_console_output(arena.show_stats)
Exemplo n.º 13
0
import superheroes



arena = superheroes.Arena()
arena.build_team_one()
arena.build_team_two()
superheroes.game_loop(arena)