kyu_4.the_greatest_warrior package

Submodules

kyu_4.the_greatest_warrior.test_battle module

Test for -> The Greatest Warrior -> test battle.

Created by Egor Kostan. GitHub: https://github.com/ikostan

class kyu_4.the_greatest_warrior.test_battle.BattleTestCase(methodName='runTest')[source]

Bases: TestCase

Testing Battle method.

_classSetupFailed = False
_class_cleanups = []
test_battle()[source]

Testing Battle method with various test data.

Returns:

kyu_4.the_greatest_warrior.test_warrior module

Test for -> The Greatest Warrior -> test warrior.

Created by Egor Kostan. GitHub: https://github.com/ikostan

class kyu_4.the_greatest_warrior.test_warrior.WarriorTestCase(methodName='runTest')[source]

Bases: TestCase

Testing Warrior class.

_classSetupFailed = False
_class_cleanups = []
test_warrior_bruce_lee()[source]

Testing Warrior class >>> bruce_lee.

Returns:

test_warrior_tom()[source]

Testing Warrior class >>> tom.

Returns:

kyu_4.the_greatest_warrior.warrior module

Solution for -> The Greatest Warrior.

Created by Egor Kostan. GitHub: https://github.com/ikostan

class kyu_4.the_greatest_warrior.warrior.Warrior[source]

Bases: object

Warrior class.

A class called Warrior which calculates and keeps track of level and skills, and ranks.

__set_level() int

Set level.

A warrior starts at level 1 and can progress all the way to 100.

A warrior cannot progress beyond level 100.

Each time the warrior’s experience increases by another 100, the warrior’s level rises to the next level.

Returns:

int

__set_rank() str

Set rank.

Returns:

warrior’s experience

__update_experience(experience: int) None

Update experience.

A warrior’s experience is cumulative, and does not reset with each rise of level. The only exception is when the warrior reaches level 100, with which the experience stops at 10000. :return:

property achievements: list

Return achievements as a list.

Returns:

list

battle(enemy_level: int) str[source]

Return message based on the result of the battle.

Parameters:

enemy_level – int

Returns:

str

property experience: int

Return experience value.

Returns:

int

property level: int

A warrior’s level.

Returns:

A warrior’s level

property rank: str

Rank.

A warrior starts at rank “Pushover” and can progress all the way to “Greatest”.

Returns:

warrior’s rank

training(params: list) str[source]

Training method.

Training will accept an array of three elements:
  1. the description.

  2. the experience points your warrior earns.

  3. the minimum level requirement.

Parameters:

params – list

Returns:

str

Module contents

The Greatest Warrior package.