本文整理汇总了Python中pytrainer.core.equipment.Equipment类的典型用法代码示例。如果您正苦于以下问题:Python Equipment类的具体用法?Python Equipment怎么用?Python Equipment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Equipment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_item_id
def test_get_item_id(self):
equipment = Equipment()
equipment.id = 1
self.mock_equipment_service.get_all_equipment.return_value = [equipment]
equipment_store = EquipmentStore(self.mock_equipment_service)
iter = equipment_store.get_iter_first()
self.assertEquals(1, equipment_store.get_value(iter, 0))
示例2: test_notes_set_to_non_string
def test_notes_set_to_non_string(self):
equipment = Equipment()
try:
equipment.notes = 42
except (TypeError):
pass
else:
self.fail("Should not be able to set notes to non-string value.")
示例3: test_prior_usage_set_to_non_numeric_string
def test_prior_usage_set_to_non_numeric_string(self):
equipment = Equipment()
try:
equipment.prior_usage = "test"
except (ValueError):
pass
else:
self.fail("Should not be able to set life expectancy to non numeric value.")
示例4: test_id_set_to_non_numeric_string
def test_id_set_to_non_numeric_string(self):
equipment = Equipment()
try:
equipment.id = "test"
except (ValueError):
pass
else:
self.fail("Should not be able to set equipment id to non numeric value.")
示例5: test_description_set_to_non_string
def test_description_set_to_non_string(self):
equipment = Equipment()
try:
equipment.description = 42
except (TypeError):
pass
else:
self.fail("Should not be able to set description to non string value.")
示例6: test_active_set_to_non_boolean
def test_active_set_to_non_boolean(self):
equipment = Equipment()
try:
equipment.active = "test"
except (TypeError):
pass
else:
self.fail("Should not be able to set active to non-boolean value.")
示例7: test_get_item_description
def test_get_item_description(self):
equipment = Equipment()
equipment.id = 1
equipment.description = u"item description"
self.mock_equipment_service.get_all_equipment.return_value = [equipment]
equipment_store = EquipmentStore(self.mock_equipment_service)
iter = equipment_store.get_iter_first()
self.assertEquals("item description", equipment_store.get_value(iter, 1))
示例8: test_get_item_active
def test_get_item_active(self):
equipment = Equipment()
equipment.id = 1
equipment.active = False
self.mock_equipment_service.get_all_equipment.return_value = [equipment]
equipment_store = EquipmentStore(self.mock_equipment_service)
iter = equipment_store.get_iter_first()
self.assertFalse(equipment_store.get_value(iter, 4))
示例9: test_update_equipment_non_existant
def test_update_equipment_non_existant(self):
self.mock_ddbb.select.return_value = []
equipment = Equipment()
equipment.id = 1
try:
self.equipment_service.store_equipment(equipment)
self.fail("Should not be able to update an item which did not previously exist.")
except (EquipmentServiceException):
pass
示例10: test_get_item_usage_text
def test_get_item_usage_text(self):
equipment = Equipment()
equipment.id = 1
equipment.life_expectancy = 200
self.mock_equipment_service.get_all_equipment.return_value = [equipment]
self.mock_equipment_service.get_equipment_usage.return_value = 100
equipment_store = EquipmentStore(self.mock_equipment_service)
iter = equipment_store.get_iter_first()
self.assertEquals("100 / 200", equipment_store.get_value(iter, 3))
示例11: test_get_item_usage_percent_usage_exceeds_life_expectancy
def test_get_item_usage_percent_usage_exceeds_life_expectancy(self):
equipment = Equipment()
equipment.id = 1
equipment.life_expectancy = 200
self.mock_equipment_service.get_all_equipment.return_value = [equipment]
self.mock_equipment_service.get_equipment_usage.return_value = 300
equipment_store = EquipmentStore(self.mock_equipment_service)
iter = equipment_store.get_iter_first()
self.assertEquals(100, equipment_store.get_value(iter, 2), "Progress bar cannot exceed 100%.")
示例12: test_get_item_usage_percent_zero_usage
def test_get_item_usage_percent_zero_usage(self):
equipment = Equipment()
equipment.id = 1
equipment.life_expectancy = 200
self.mock_equipment_service.get_all_equipment.return_value = [equipment]
self.mock_equipment_service.get_equipment_usage.return_value = 0
equipment_store = EquipmentStore(self.mock_equipment_service)
iter = equipment_store.get_iter_first()
self.assertEquals(0, equipment_store.get_value(iter, 2))
示例13: test_store_equipment_duplicate_description
def test_store_equipment_duplicate_description(self):
self.mock_ddbb.select.return_value = [(1,)]
equipment = Equipment()
equipment.description = u"test item"
try:
self.equipment_service.store_equipment(equipment)
self.fail("Should not be able to store new item with non-unique description.")
except (EquipmentServiceException):
pass
示例14: test_multiple_equipment_items
def test_multiple_equipment_items(self):
equipment1 = Equipment()
equipment1.id = 1
equipment2 = Equipment()
equipment2.id = 2
self.mock_equipment_service.get_all_equipment.return_value = [equipment1, equipment2]
equipment_store = EquipmentStore(self.mock_equipment_service)
iter = equipment_store.get_iter_first()
iter = equipment_store.iter_next(iter)
self.assertEquals(2, equipment_store.get_value(iter, 0))
示例15: test_update_equipment_duplicate_description
def test_update_equipment_duplicate_description(self):
self.mock_ddbb.select.return_value = [(1, u"test item", True, 500, 200, u"Test notes.")]
equipment = Equipment()
equipment.id = 2
equipment.description = u"test item"
try:
self.equipment_service.store_equipment(equipment)
self.fail("Should not be able to change item description to non-unique value.")
except (EquipmentServiceException):
pass