def test_velocity_modifier_ship_attr_mass_zero(self): ship = Ship(self.mktype(attrs={ AttrId.max_velocity: 455, AttrId.signature_radius: 32, AttrId.mass: 0}).id) propmod_effect = self.mkeffect( effect_id=EffectId.module_bonus_microwarpdrive, category_id=EffectCategoryId.active) propmod = ModuleMid(self.mktype( attrs={ AttrId.mass_addition: 0, AttrId.signature_radius_bonus: 410, AttrId.speed_factor: 518, AttrId.speed_boost_factor: 1500000}, effects=[propmod_effect], default_effect=propmod_effect).id) propmod.state = State.active self.fit.ship = ship self.fit.modules.mid.append(propmod) # Verification self.assertAlmostEqual(ship.attrs[AttrId.max_velocity], 455) self.assert_log_entries(1) log_record = self.log[0] self.assertEqual( log_record.name, 'eos.eve_obj.custom.propulsion_modules.modifier.python') self.assertEqual(log_record.levelno, logging.WARNING) self.assertEqual( log_record.msg, 'cannot calculate propulsion speed boost due to zero ship mass') # Cleanup self.assert_solsys_buffers_empty(self.fit.solar_system)
def test_velocity_modifier_isolation(self): # When velocity cannot be modified due to errors, sig and mass still # should be successfully modified ship = self.make_ship() propmod_effect = self.mkeffect( effect_id=EffectId.module_bonus_microwarpdrive, category_id=EffectCategoryId.active) propmod = ModuleMid( self.mktype(attrs={ AttrId.mass_addition: 500000, AttrId.signature_radius_bonus: 410, AttrId.speed_boost_factor: 1500000 }, effects=[propmod_effect], default_effect=propmod_effect).id) propmod.state = State.active self.fit.ship = ship self.fit.modules.mid.append(propmod) # Verification self.assertAlmostEqual(ship.attrs[AttrId.max_velocity], 455) self.assertAlmostEqual(ship.attrs[AttrId.signature_radius], 163.2) self.assertAlmostEqual(ship.attrs[AttrId.mass], 1550000) # Cleanup self.assert_solsys_buffers_empty(self.fit.solar_system) self.assert_log_entries(0)
def test_velocity_modifier_propmod_attr_thrust_absent(self): ship = self.make_ship() propmod_effect = self.mkeffect( effect_id=EffectId.module_bonus_microwarpdrive, category_id=EffectCategoryId.active) propmod = ModuleMid(self.mktype( attrs={ AttrId.mass_addition: 500000, AttrId.signature_radius_bonus: 410, AttrId.speed_factor: 518}, effects=[propmod_effect], default_effect=propmod_effect).id) propmod.state = State.active self.fit.ship = ship self.fit.modules.mid.append(propmod) # Verification self.assertAlmostEqual(ship.attrs[AttrId.max_velocity], 455) # Cleanup self.assert_solsys_buffers_empty(self.fit.solar_system) self.assert_log_entries(0)
def test_velocity_modifier_propmod_attr_thrust_absent(self): ship = self.make_ship() propmod_effect = self.mkeffect( effect_id=EffectId.module_bonus_microwarpdrive, category_id=EffectCategoryId.active) propmod = ModuleMid( self.mktype(attrs={ AttrId.mass_addition: 500000, AttrId.signature_radius_bonus: 410, AttrId.speed_factor: 518 }, effects=[propmod_effect], default_effect=propmod_effect).id) propmod.state = State.active self.fit.ship = ship self.fit.modules.mid.append(propmod) # Verification self.assertAlmostEqual(ship.attrs[AttrId.max_velocity], 455) # Cleanup self.assert_solsys_buffers_empty(self.fit.solar_system) self.assert_log_entries(0)
def test_velocity_modifier_isolation(self): # When velocity cannot be modified due to errors, sig and mass still # should be successfully modified ship = self.make_ship() propmod_effect = self.mkeffect( effect_id=EffectId.module_bonus_microwarpdrive, category_id=EffectCategoryId.active) propmod = ModuleMid(self.mktype( attrs={ AttrId.mass_addition: 500000, AttrId.signature_radius_bonus: 410, AttrId.speed_boost_factor: 1500000}, effects=[propmod_effect], default_effect=propmod_effect).id) propmod.state = State.active self.fit.ship = ship self.fit.modules.mid.append(propmod) # Verification self.assertAlmostEqual(ship.attrs[AttrId.max_velocity], 455) self.assertAlmostEqual(ship.attrs[AttrId.signature_radius], 163.2) self.assertAlmostEqual(ship.attrs[AttrId.mass], 1550000) # Cleanup self.assert_solsys_buffers_empty(self.fit.solar_system) self.assert_log_entries(0)
def test_velocity_modifier_ship_attr_mass_zero(self): ship = Ship( self.mktype( attrs={ AttrId.max_velocity: 455, AttrId.signature_radius: 32, AttrId.mass: 0 }).id) propmod_effect = self.mkeffect( effect_id=EffectId.module_bonus_microwarpdrive, category_id=EffectCategoryId.active) propmod = ModuleMid( self.mktype(attrs={ AttrId.mass_addition: 0, AttrId.signature_radius_bonus: 410, AttrId.speed_factor: 518, AttrId.speed_boost_factor: 1500000 }, effects=[propmod_effect], default_effect=propmod_effect).id) propmod.state = State.active self.fit.ship = ship self.fit.modules.mid.append(propmod) # Verification self.assertAlmostEqual(ship.attrs[AttrId.max_velocity], 455) self.assert_log_entries(1) log_record = self.log[0] self.assertEqual( log_record.name, 'eos.eve_obj.custom.propulsion_modules.modifier.python') self.assertEqual(log_record.levelno, logging.WARNING) self.assertEqual( log_record.msg, 'cannot calculate propulsion speed boost due to zero ship mass') # Cleanup self.assert_solsys_buffers_empty(self.fit.solar_system)