本文整理汇总了Python中apps.web.models.CompetitionPhase类的典型用法代码示例。如果您正苦于以下问题:Python CompetitionPhase类的具体用法?Python CompetitionPhase怎么用?Python CompetitionPhase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CompetitionPhase类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_format_values
def test_format_values(self):
x = 0.12834956
self.assertEqual("0.1", CompetitionPhase.format_value(x, "1"))
self.assertEqual("0.13", CompetitionPhase.format_value(x, "2"))
self.assertEqual("0.128", CompetitionPhase.format_value(x, "3"))
self.assertEqual("0.1283", CompetitionPhase.format_value(x, "4"))
self.assertEqual("0.12835", CompetitionPhase.format_value(x, "5"))
self.assertEqual("0.13", CompetitionPhase.format_value(x))
self.assertEqual("0.1", CompetitionPhase.format_value(x, "0"))
self.assertEqual("0.1283495600",
CompetitionPhase.format_value(x, "20"))
self.assertEqual("0.1", CompetitionPhase.format_value(x, "-2"))
self.assertEqual("0.1", CompetitionPhase.format_value(x, "2.13"))
self.assertEqual("0.1", CompetitionPhase.format_value(x, "2fooo"))
self.assertEqual("0.1", CompetitionPhase.format_value(x, ""))
self.assertEqual("0.1", CompetitionPhase.format_value(x, None))
示例2: test_rank_values_14
def test_rank_values_14(self):
ids = {"a", "b", "d", "f", "e"}
input = {"a": 4.0, "b": 2.0, "d": 5.0, "f": 3.0, "e": 1.0}
expected = {"a": 2, "b": 4, "d": 1, "f": 3, "e": 5}
self.validate(ids, expected, CompetitionPhase.rank_values(
ids, input, sort_ascending=False))
示例3: test_rank_values_12
def test_rank_values_12(self):
ids = {"a", "b", "d", "f", "e"}
input = {"a": 4.0, "b": 2.0, "d": 5.0, "f": 3.0, "e": 1.0}
expected = {"a": 4, "b": 2, "d": 5, "f": 3, "e": 1}
self.validate(ids, expected, CompetitionPhase.rank_values(ids, input))
示例4: test_rank_values_10
def test_rank_values_10(self):
ids = {"a", "b", "d", "f", "e"}
input = {"e": 1.0, "a": 1.001}
expected = {"a": 2, "b": 3, "d": 3, "f": 3, "e": 1}
self.validate(ids, expected,
CompetitionPhase.rank_values(ids, input, sort_ascending=True))
示例5: test_rank_values_3
def test_rank_values_3(self):
ids = {"a", "b", "d", "f", "e"}
input = {"d": 1.0}
expected = {"a": 2, "b": 2, "d": 1, "f": 2, "e": 2}
self.validate(ids, expected, CompetitionPhase.rank_values(ids, input))
示例6: test_rank_values_2
def test_rank_values_2(self):
ids = {"a", "b", "d", "f", "e"}
input = {}
expected = {"a": 1, "b": 1, "d": 1, "f": 1, "e": 1}
self.validate(ids, expected, CompetitionPhase.rank_values(
ids, input, sort_ascending=False))