本文整理汇总了Python中pytrainer.core.sport.Sport类的典型用法代码示例。如果您正苦于以下问题:Python Sport类的具体用法?Python Sport怎么用?Python Sport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Sport类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_remove_sport_should_remove_associated_entries
def test_remove_sport_should_remove_associated_entries(self):
sport = Sport()
sport.name = u"Test name"
sport = self.sport_service.store_sport(sport)
self.sport_service.remove_sport(sport)
result = self.sport_service.get_sport(1)
self.assertEqual(result, None)
开发者ID:pytrainer,项目名称:pytrainer,代码行数:7,代码来源:test_sport.py
示例2: test_max_pace_should_take_floor_of_float
def test_max_pace_should_take_floor_of_float(self):
sport = Sport()
sport.max_pace = 220.6
self.ddbb.session.add(sport)
self.ddbb.session.commit()
sport = self.ddbb.session.query(Sport).filter(Sport.id == 1).one()
self.assertEqual(220, sport.max_pace)
开发者ID:pytrainer,项目名称:pytrainer,代码行数:7,代码来源:test_sport.py
示例3: test_id_should_accept_integer_string
def test_id_should_accept_integer_string(self):
sport = Sport()
sport.id = "1"
self.ddbb.session.add(sport)
self.ddbb.session.commit()
sport = self.ddbb.session.query(Sport).filter(Sport.id == 1).one()
self.assertEqual(1, sport.id)
开发者ID:pytrainer,项目名称:pytrainer,代码行数:7,代码来源:test_sport.py
示例4: test_met_should_not_accept_non_float_string
def test_met_should_not_accept_non_float_string(self):
sport = Sport()
try:
sport.met = "22.5kg"
except(ValueError):
pass
else:
self.fail()
开发者ID:MrBricodage,项目名称:pytrainer,代码行数:8,代码来源:sport_test.py
示例5: test_met_should_accept_float_string
def test_met_should_accept_float_string(self):
sport = Sport()
sport.name = "test1"
sport.met = "22.5"
self.ddbb.session.add(sport)
self.ddbb.session.commit()
sport = self.ddbb.session.query(Sport).filter(Sport.id == 1).one()
self.assertEqual(22.5, sport.met)
开发者ID:pytrainer,项目名称:pytrainer,代码行数:8,代码来源:test_sport.py
示例6: test_max_pace_should_not_accept_non_integer_string
def test_max_pace_should_not_accept_non_integer_string(self):
sport = Sport()
try:
sport.max_pace = "225s"
except(ValueError):
pass
else:
self.fail()
开发者ID:MrBricodage,项目名称:pytrainer,代码行数:8,代码来源:sport_test.py
示例7: test_max_pace_should_not_accept_negative_value
def test_max_pace_should_not_accept_negative_value(self):
sport = Sport()
try:
sport.max_pace = -1
except(ValueError):
pass
else:
self.fail()
开发者ID:MrBricodage,项目名称:pytrainer,代码行数:8,代码来源:sport_test.py
示例8: test_name_should_not_accept_non_unicode_string
def test_name_should_not_accept_non_unicode_string(self):
sport = Sport()
try:
sport.name = "Juggling"
except(TypeError):
pass
else:
self.fail()
开发者ID:MrBricodage,项目名称:pytrainer,代码行数:8,代码来源:sport_test.py
示例9: test_id_should_not_accept_non_integer_string
def test_id_should_not_accept_non_integer_string(self):
sport = Sport()
try:
sport.id = "1.1"
except(ValueError):
pass
else:
self.fail()
开发者ID:MrBricodage,项目名称:pytrainer,代码行数:8,代码来源:sport_test.py
示例10: test_name_should_not_accept_none
def test_name_should_not_accept_none(self):
sport = Sport()
try:
sport.name = None
except(TypeError):
pass
else:
self.fail()
开发者ID:MrBricodage,项目名称:pytrainer,代码行数:8,代码来源:sport_test.py
示例11: test_store_sport_should_update_row_when_sport_has_id
def test_store_sport_should_update_row_when_sport_has_id(self):
sport = Sport()
sport.name = u"Test name"
sport = self.sport_service.store_sport(sport)
sport.name = u"New name"
self.sport_service.store_sport(sport)
sport = self.sport_service.get_sport(1)
self.assertEqual(sport.name, u"New name")
开发者ID:pytrainer,项目名称:pytrainer,代码行数:8,代码来源:test_sport.py
示例12: test_color_should_not_accept_none
def test_color_should_not_accept_none(self):
sport = Sport()
try:
sport.color = None
except(ValueError):
pass
else:
self.fail()
开发者ID:MrBricodage,项目名称:pytrainer,代码行数:8,代码来源:sport_test.py
示例13: test_weight_should_not_accept_negative_value
def test_weight_should_not_accept_negative_value(self):
sport = Sport()
try:
sport.weight = -1
except(ValueError):
pass
else:
self.fail()
开发者ID:MrBricodage,项目名称:pytrainer,代码行数:8,代码来源:sport_test.py
示例14: test_remove_sport_should_error_when_sport_has_unknown_id
def test_remove_sport_should_error_when_sport_has_unknown_id(self):
sport = Sport()
sport.id = 100
try:
self.sport_service.remove_sport(sport)
except(SportServiceException):
pass
else:
self.fail()
开发者ID:pytrainer,项目名称:pytrainer,代码行数:9,代码来源:test_sport.py
示例15: test_name_should_not_accept_none
def test_name_should_not_accept_none(self):
sport = Sport()
sport.name = None
try:
self.ddbb.session.add(sport)
self.ddbb.session.commit()
except (IntegrityError, OperationalError):
pass
else:
self.fail()
开发者ID:pytrainer,项目名称:pytrainer,代码行数:10,代码来源:test_sport.py
示例16: test_met_should_not_accept_non_float_string
def test_met_should_not_accept_non_float_string(self):
sport = Sport()
sport.met = "22.5kg"
try:
self.ddbb.session.add(sport)
self.ddbb.session.flush()
except(ValueError, StatementError):
pass
else:
self.fail()
开发者ID:pytrainer,项目名称:pytrainer,代码行数:10,代码来源:test_sport.py
示例17: test_id_should_not_accept_non_integer_string
def test_id_should_not_accept_non_integer_string(self):
sport = Sport()
try:
sport.id = "test"
self.ddbb.session.add(sport)
self.ddbb.session.flush()
except (IntegrityError, DataError, OperationalError):
pass
else:
self.fail()
开发者ID:pytrainer,项目名称:pytrainer,代码行数:10,代码来源:test_sport.py
示例18: test_weight_should_not_accept_non_float_string
def test_weight_should_not_accept_non_float_string(self):
sport = Sport()
sport.weight = "22.5kg"
try:
self.ddbb.session.add(sport)
self.ddbb.session.flush()
except StatementError:
pass
else:
self.fail()
开发者ID:pytrainer,项目名称:pytrainer,代码行数:10,代码来源:test_sport.py
示例19: test_weight_should_not_accept_none
def test_weight_should_not_accept_none(self):
sport = Sport()
sport.weight = None
try:
self.ddbb.session.add(sport)
self.ddbb.session.flush()
except (IntegrityError, OperationalError):
pass
else:
self.fail()
开发者ID:pytrainer,项目名称:pytrainer,代码行数:10,代码来源:test_sport.py
示例20: test_color_should_not_accept_none
def test_color_should_not_accept_none(self):
sport = Sport()
sport.color = None
try:
self.ddbb.session.add(sport)
self.ddbb.session.commit()
except StatementError:
pass
else:
self.fail()
开发者ID:pytrainer,项目名称:pytrainer,代码行数:10,代码来源:test_sport.py
注:本文中的pytrainer.core.sport.Sport类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论