当前位置: 首页>>代码示例>>Python>>正文


Python models.CompetitionPhase类代码示例

本文整理汇总了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))
开发者ID:avinava07,项目名称:codalab,代码行数:19,代码来源:tests.py

示例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))
开发者ID:avinava07,项目名称:codalab,代码行数:6,代码来源:tests.py

示例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))
开发者ID:avinava07,项目名称:codalab,代码行数:5,代码来源:tests.py

示例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))
开发者ID:avinava07,项目名称:codalab,代码行数:6,代码来源:tests.py

示例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))
开发者ID:avinava07,项目名称:codalab,代码行数:5,代码来源:tests.py

示例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))
开发者ID:avinava07,项目名称:codalab,代码行数:6,代码来源:tests.py


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