コード例 #1
0
ファイル: test_ship.py プロジェクト: pyfa-org/eos
 def test_none_to_item_type_failure(self):
     fit = Fit()
     item = Stance(self.mktype().id)
     # Action
     with self.assertRaises(TypeError):
         fit.ship = item
     # Verification
     self.assertIsNone(fit.ship)
     # Check that item which failed to be added can be assigned to other
     # field
     fit.stance = item
     # Cleanup
     self.assert_item_buffers_empty(item)
     self.assert_solsys_buffers_empty(fit.solar_system)
     self.assert_log_entries(0)
コード例 #2
0
ファイル: test_ship.py プロジェクト: DarkFenX/eos
 def test_none_to_item_type_failure(self):
     fit = Fit()
     item = Stance(self.mktype().id)
     # Action
     with self.assertRaises(TypeError):
         fit.ship = item
     # Verification
     self.assertIsNone(fit.ship)
     # Check that item which failed to be added can be assigned to other
     # field
     fit.stance = item
     # Cleanup
     self.assert_item_buffers_empty(item)
     self.assert_solsys_buffers_empty(fit.solar_system)
     self.assert_log_entries(0)
コード例 #3
0
ファイル: test_charge.py プロジェクト: DarkFenX/eos
 def test_fit_none_to_non_charge(self):
     fit = Fit()
     module = ModuleHigh(self.mktype().id, state=State.active, charge=None)
     non_charge = Stance(self.mktype().id)
     fit.modules.high.append(module)
     # Action
     with self.assertRaises(TypeError):
         module.charge = non_charge
     # Verification
     self.assertIsNone(module.charge)
     fit.stance = non_charge
     # Cleanup
     self.assert_item_buffers_empty(module)
     self.assert_item_buffers_empty(non_charge)
     self.assert_solsys_buffers_empty(fit.solar_system)
     self.assert_log_entries(0)
コード例 #4
0
ファイル: test_ship.py プロジェクト: pyfa-org/eos
 def test_item_to_item_type_failure(self):
     fit = Fit()
     item1 = Ship(self.mktype().id)
     item2 = Stance(self.mktype().id)
     fit.ship = item1
     # Action
     with self.assertRaises(TypeError):
         fit.ship = item2
     # Verification
     self.assertIs(fit.ship, item1)
     fit.stance = item2
     # Cleanup
     self.assert_item_buffers_empty(item1)
     self.assert_item_buffers_empty(item2)
     self.assert_solsys_buffers_empty(fit.solar_system)
     self.assert_log_entries(0)
コード例 #5
0
ファイル: test_charge.py プロジェクト: pyfa-org/eos
 def test_fit_none_to_non_charge(self):
     fit = Fit()
     module = ModuleHigh(self.mktype().id, state=State.active, charge=None)
     non_charge = Stance(self.mktype().id)
     fit.modules.high.append(module)
     # Action
     with self.assertRaises(TypeError):
         module.charge = non_charge
     # Verification
     self.assertIsNone(module.charge)
     fit.stance = non_charge
     # Cleanup
     self.assert_item_buffers_empty(module)
     self.assert_item_buffers_empty(non_charge)
     self.assert_solsys_buffers_empty(fit.solar_system)
     self.assert_log_entries(0)
コード例 #6
0
ファイル: test_ship.py プロジェクト: DarkFenX/eos
 def test_item_to_item_type_failure(self):
     fit = Fit()
     item1 = Ship(self.mktype().id)
     item2 = Stance(self.mktype().id)
     fit.ship = item1
     # Action
     with self.assertRaises(TypeError):
         fit.ship = item2
     # Verification
     self.assertIs(fit.ship, item1)
     fit.stance = item2
     # Cleanup
     self.assert_item_buffers_empty(item1)
     self.assert_item_buffers_empty(item2)
     self.assert_solsys_buffers_empty(fit.solar_system)
     self.assert_log_entries(0)
コード例 #7
0
ファイル: test_charge.py プロジェクト: DarkFenX/eos
 def test_detached_module_charge_to_non_charge(self):
     fit_other = Fit()
     module = ModuleHigh(self.mktype().id, state=State.active, charge=None)
     charge = Charge(self.mktype().id)
     non_charge = Stance(self.mktype().id)
     module.charge = charge
     # Action
     with self.assertRaises(TypeError):
         module.charge = non_charge
     # Verification
     self.assertIs(module.charge, charge)
     fit_other.stance = non_charge
     # Cleanup
     self.assert_item_buffers_empty(module)
     self.assert_item_buffers_empty(charge)
     self.assert_item_buffers_empty(non_charge)
     self.assert_solsys_buffers_empty(fit_other.solar_system)
     self.assert_log_entries(0)
コード例 #8
0
ファイル: test_charge.py プロジェクト: pyfa-org/eos
 def test_detached_module_charge_to_non_charge(self):
     fit_other = Fit()
     module = ModuleHigh(self.mktype().id, state=State.active, charge=None)
     charge = Charge(self.mktype().id)
     non_charge = Stance(self.mktype().id)
     module.charge = charge
     # Action
     with self.assertRaises(TypeError):
         module.charge = non_charge
     # Verification
     self.assertIs(module.charge, charge)
     fit_other.stance = non_charge
     # Cleanup
     self.assert_item_buffers_empty(module)
     self.assert_item_buffers_empty(charge)
     self.assert_item_buffers_empty(non_charge)
     self.assert_solsys_buffers_empty(fit_other.solar_system)
     self.assert_log_entries(0)