• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python equipment.Equipment类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pytrainer.core.equipment.Equipment的典型用法代码示例。如果您正苦于以下问题:Python Equipment类的具体用法?Python Equipment怎么用?Python Equipment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Equipment类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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))
开发者ID:rgonzalez72,项目名称:pytrainer,代码行数:7,代码来源:equipment_test.py


示例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.")
开发者ID:viiru-,项目名称:pytrainer,代码行数:8,代码来源:equipment_test.py


示例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.")
开发者ID:viiru-,项目名称:pytrainer,代码行数:8,代码来源:equipment_test.py


示例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.")
开发者ID:viiru-,项目名称:pytrainer,代码行数:8,代码来源:equipment_test.py


示例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.")
开发者ID:viiru-,项目名称:pytrainer,代码行数:8,代码来源:equipment_test.py


示例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.")
开发者ID:viiru-,项目名称:pytrainer,代码行数:8,代码来源:equipment_test.py


示例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))
开发者ID:rgonzalez72,项目名称:pytrainer,代码行数:8,代码来源:equipment_test.py


示例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))
开发者ID:rgonzalez72,项目名称:pytrainer,代码行数:8,代码来源:equipment_test.py


示例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
开发者ID:viiru-,项目名称:pytrainer,代码行数:9,代码来源:equipment_test.py


示例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))
开发者ID:rgonzalez72,项目名称:pytrainer,代码行数:9,代码来源:equipment_test.py


示例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%.")
开发者ID:rgonzalez72,项目名称:pytrainer,代码行数:9,代码来源:equipment_test.py


示例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))
开发者ID:rgonzalez72,项目名称:pytrainer,代码行数:9,代码来源:equipment_test.py


示例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
开发者ID:viiru-,项目名称:pytrainer,代码行数:9,代码来源:equipment_test.py


示例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))
开发者ID:rgonzalez72,项目名称:pytrainer,代码行数:10,代码来源:equipment_test.py


示例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
开发者ID:viiru-,项目名称:pytrainer,代码行数:10,代码来源:equipment_test.py


示例16: test_update_equipment

 def test_update_equipment(self):
     equipment = Equipment()
     equipment.id = 1
     equipment.description = u"new description"
     self.mock_ddbb.select.return_value = [(1, u"old description", 1, 0, 0, u"")]
     self.equipment_service.store_equipment(equipment)
     self.mock_ddbb.update.assert_called_with(
         "equipment",
         "description,active,life_expectancy,prior_usage,notes",
         ["new description", 1, 0, 0, ""],
         "id = 1",
     )
开发者ID:viiru-,项目名称:pytrainer,代码行数:12,代码来源:equipment_test.py


示例17: test_store_equipment

    def test_store_equipment(self):
        equipment = Equipment()
        equipment.description = u"test description"
        equipment_ids = []

        def mock_select(table, columns, where):
            if columns == "id":
                return equipment_ids
            else:
                return [(2, u"", 1, 0, 0, u"")]

        def update_equipment_ids(*args):
            equipment_ids.append([1])

        self.mock_ddbb.select = mock.Mock(wraps=mock_select)
        self.mock_ddbb.insert.side_effect = update_equipment_ids
        stored_equipment = self.equipment_service.store_equipment(equipment)
        self.mock_ddbb.insert.assert_called_with(
            "equipment", "description,active,life_expectancy,prior_usage,notes", ["test description", 1, 0, 0, ""]
        )
        self.assertEquals(2, stored_equipment.id)
开发者ID:viiru-,项目名称:pytrainer,代码行数:21,代码来源:equipment_test.py


示例18: _confirm_add_equipment_clicked

 def _confirm_add_equipment_clicked(self, widget):
     #FIXME input validation for numeric fields
     description = self._builder.get_object("entryEquipmentAddDescription").get_text()
     life_expectancy = self._builder.get_object("entryEquipmentAddLifeExpectancy").get_text()
     prior_usage = self._builder.get_object("entryEquipmentAddPriorUsage").get_text()
     active = self._builder.get_object("checkbuttonEquipmentAddActive").get_active()
     notes_buffer = self._builder.get_object("textviewEquipmentAddNotes").get_buffer()
     notes = notes_buffer.get_text(notes_buffer.get_start_iter(), notes_buffer.get_end_iter())
     new_equipment = Equipment()
     new_equipment.description = unicode(description)
     new_equipment.active = active
     new_equipment.life_expectancy = life_expectancy
     new_equipment.prior_usage = prior_usage
     new_equipment.notes = unicode(notes)
     self._equipment_store.add_equipment(new_equipment)
     self.show_page_equipment_list()
开发者ID:MrBricodage,项目名称:pytrainer,代码行数:16,代码来源:equipment.py


示例19: _confirm_add_equipment_clicked

 def _confirm_add_equipment_clicked(self, widget):
     #FIXME input validation for numeric fields
     description = gtk_str(self._builder.get_object("entryEquipmentAddDescription").get_text())
     life_expectancy = gtk_str(self._builder.get_object("entryEquipmentAddLifeExpectancy").get_text())
     prior_usage = gtk_str(self._builder.get_object("entryEquipmentAddPriorUsage").get_text())
     active = self._builder.get_object("checkbuttonEquipmentAddActive").get_active()
     notes_buffer = self._builder.get_object("textviewEquipmentAddNotes").get_buffer()
     notes = gtk_str(notes_buffer.get_text(notes_buffer.get_start_iter(),
                                           notes_buffer.get_end_iter(), True))
     new_equipment = Equipment()
     new_equipment.description = description
     new_equipment.active = bool(active)
     new_equipment.life_expectancy = int(life_expectancy)
     new_equipment.prior_usage = int(prior_usage)
     new_equipment.notes = notes
     self._equipment_store.add_equipment(new_equipment)
     self.show_page_equipment_list()
开发者ID:pytrainer,项目名称:pytrainer,代码行数:17,代码来源:equipment.py


示例20: test_active_set_to_boolean

 def test_active_set_to_boolean(self):
     equipment = Equipment()
     equipment.active = False
     self.assertFalse(equipment.active)
开发者ID:viiru-,项目名称:pytrainer,代码行数:4,代码来源:equipment_test.py



注:本文中的pytrainer.core.equipment.Equipment类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python sport.Sport类代码示例发布时间:2022-05-27
下一篇:
Python prefork.call_capture_output函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap