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


Python Expression.evaluate方法代码示例

本文整理汇总了Python中brabbel.expression.Expression.evaluate方法的典型用法代码示例。如果您正苦于以下问题:Python Expression.evaluate方法的具体用法?Python Expression.evaluate怎么用?Python Expression.evaluate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在brabbel.expression.Expression的用法示例。


在下文中一共展示了Expression.evaluate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_5

# 需要导入模块: from brabbel.expression import Expression [as 别名]
# 或者: from brabbel.expression.Expression import evaluate [as 别名]
    def test_5(self):
        import datetime

        expression = Expression("len($xxx) le 9")
        values = {"xxx": u"abcdefghi"}
        result = expression.evaluate(values)
        self.assertEqual(result, True)
开发者ID:ringo-framework,项目名称:brabbel,代码行数:9,代码来源:test_expressions.py

示例2: test_4

# 需要导入模块: from brabbel.expression import Expression [as 别名]
# 或者: from brabbel.expression.Expression import evaluate [as 别名]
    def test_4(self):
        import datetime

        expression = Expression(
            "( ( ( $ap_ausb eq '1' ) and ( $pp_phase in ['1','2'] ) ) or ( ( $ap_ausb eq '3' ) and ( $pp_phase in ['3','4'] ) ) or ( ( $ap_ausb in ['2','4'] ) or ( not bool($ap_ausb) ) ) )"
        )
        values = {
            "ap_austritt": u"1",
            "pp_phase_s": u"",
            "ap_q1": u"Rechtsanwalt und Notarfachangestellte",
            "ap_geschlecht": u"0",
            "ap_austritt_ja": u"ja",
            "programm_info": "",
            "bericht_state_id": 2,
            "pp_austritt_ca": datetime.date(2014, 3, 14),
            "ap_ausb": u"1",
            "pp_phase": u"",
            "pp_ga": [u"2", u""],
            "ap_austritt_date": datetime.date(2014, 3, 14),
            "proj_kommentar": u"",
            "proj_fkz": u"09.00101.13",
            "ap_bj1": u"",
            "ap_bj2": u"",
            "ap_bj3": u"",
            "pp_beginn": u"seit",
            "updated": datetime.datetime(2014, 10, 23, 12, 41, 39),
            "_roles": "",
            "ap_quer": u"1",
            "ap_quali": u"1",
            "pp_gesamtst": u"275",
            "form_info": "",
            "pp_kinder": [u"1", u""],
            "created": datetime.datetime(2014, 9, 23, 14, 5, 30),
            "projekt": None,
            "ausbildungsformat": None,
            "pp_eintritt_ps": datetime.date(2014, 1, 6),
            "logo_einbindung": None,
            "pp_eintritt_vb": None,
            "ap_code": u"A.CB257",
            "ap_q2": u"",
            "ap_austritt_s": u"",
            "ap_mhg": u"0",
            "ap_q3": u"",
        }
        result = expression.evaluate(values)
        self.assertEqual(result, False)
开发者ID:ringo-framework,项目名称:brabbel,代码行数:48,代码来源:test_expressions.py

示例3: test_8

# 需要导入模块: from brabbel.expression import Expression [as 别名]
# 或者: from brabbel.expression.Expression import evaluate [as 别名]
 def test_8(self):
     expression = Expression("bool($x) and ($x == 1)")
     result = expression.evaluate({"x": 0})
     self.assertEqual(result, False)
开发者ID:ringo-framework,项目名称:brabbel,代码行数:6,代码来源:test_expressions.py

示例4: test_boolvar

# 需要导入模块: from brabbel.expression import Expression [as 别名]
# 或者: from brabbel.expression.Expression import evaluate [as 别名]
 def test_boolvar(self):
     expression = Expression("bool($float)")
     result = expression.evaluate({"float": 1})
     self.assertEqual(result, True)
开发者ID:ringo-framework,项目名称:brabbel,代码行数:6,代码来源:test_expressions.py

示例5: test_6

# 需要导入模块: from brabbel.expression import Expression [as 别名]
# 或者: from brabbel.expression.Expression import evaluate [as 别名]
 def test_6(self):
     expression = Expression("( 'LOP-PM' in ['admins'] ) or ( 'False' == 'True' )")
     result = expression.evaluate({})
     self.assertEqual(result, False)
开发者ID:ringo-framework,项目名称:brabbel,代码行数:6,代码来源:test_expressions.py

示例6: test_mul

# 需要导入模块: from brabbel.expression import Expression [as 别名]
# 或者: from brabbel.expression.Expression import evaluate [as 别名]
 def test_mul(self):
     expression = Expression("7 * 7")
     result = expression.evaluate()
     self.assertEqual(result, 49.0)
开发者ID:ringo-framework,项目名称:brabbel,代码行数:6,代码来源:test_expressions.py

示例7: test_boolempty

# 需要导入模块: from brabbel.expression import Expression [as 别名]
# 或者: from brabbel.expression.Expression import evaluate [as 别名]
 def test_boolempty(self):
     expression = Expression("bool($string)")
     result = expression.evaluate({"string": ""})
     self.assertEqual(result, False)
开发者ID:ringo-framework,项目名称:brabbel,代码行数:6,代码来源:test_expressions.py

示例8: test_nottrue

# 需要导入模块: from brabbel.expression import Expression [as 别名]
# 或者: from brabbel.expression.Expression import evaluate [as 别名]
 def test_nottrue(self):
     expression = Expression("not True")
     result = expression.evaluate()
     self.assertEqual(result, False)
开发者ID:ringo-framework,项目名称:brabbel,代码行数:6,代码来源:test_expressions.py

示例9: test_plusplus

# 需要导入模块: from brabbel.expression import Expression [as 别名]
# 或者: from brabbel.expression.Expression import evaluate [as 别名]
 def test_plusplus(self):
     expression = Expression("1 + 1 + 1")
     result = expression.evaluate()
     self.assertEqual(result, 3.0)
开发者ID:ringo-framework,项目名称:brabbel,代码行数:6,代码来源:test_expressions.py

示例10: test_1

# 需要导入模块: from brabbel.expression import Expression [as 别名]
# 或者: from brabbel.expression.Expression import evaluate [as 别名]
 def test_1(self):
     expression = Expression(
         "( 'antragsteller' in       ['institutionen_einsicht', 'user', 'antragsteller']   ) == False"
     )
     result = expression.evaluate()
     self.assertEqual(result, False)
开发者ID:ringo-framework,项目名称:brabbel,代码行数:8,代码来源:test_expressions.py

示例11: test_variable

# 需要导入模块: from brabbel.expression import Expression [as 别名]
# 或者: from brabbel.expression.Expression import evaluate [as 别名]
 def test_variable(self):
     expression = Expression("$string")
     result = expression.evaluate({"string": "string"})
     self.assertEqual(result, "string")
开发者ID:ringo-framework,项目名称:brabbel,代码行数:6,代码来源:test_expressions.py

示例12: test_equal

# 需要导入模块: from brabbel.expression import Expression [as 别名]
# 或者: from brabbel.expression.Expression import evaluate [as 别名]
 def test_equal(self):
     expression = Expression("timedelta($a) == timedelta($b)")
     result = expression.evaluate({"a": "01:30:00", "b": "00:90:00"})
     self.assertEqual(result, True)
开发者ID:ringo-framework,项目名称:brabbel,代码行数:6,代码来源:test_expressions.py

示例13: test_sum_smaller

# 需要导入模块: from brabbel.expression import Expression [as 别名]
# 或者: from brabbel.expression.Expression import evaluate [as 别名]
 def test_sum_smaller(self):
     expression = Expression("(timedelta($a) +  timedelta($b)) < timedelta($c)")
     result = expression.evaluate({"a": "04:00:00", "b": "05:00:00", "c": "08:00:00"})
     self.assertEqual(result, False)
开发者ID:ringo-framework,项目名称:brabbel,代码行数:6,代码来源:test_expressions.py

示例14: test_smaller

# 需要导入模块: from brabbel.expression import Expression [as 别名]
# 或者: from brabbel.expression.Expression import evaluate [as 别名]
    def test_smaller(self):
        import datetime

        expression = Expression("$a > timedelta($b)")
        result = expression.evaluate({"a": datetime.timedelta(seconds=100), "b": "00:00:120"})
        self.assertEqual(result, False)
开发者ID:ringo-framework,项目名称:brabbel,代码行数:8,代码来源:test_expressions.py

示例15: test_len4ticks

# 需要导入模块: from brabbel.expression import Expression [as 别名]
# 或者: from brabbel.expression.Expression import evaluate [as 别名]
 def test_len4ticks(self):
     expression = Expression("len($a)")
     result = expression.evaluate({"a": "''''"})
     self.assertEqual(result, 4)
开发者ID:ringo-framework,项目名称:brabbel,代码行数:6,代码来源:test_expressions.py


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