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


Python Commons.get_calc_from_start_or_end方法代码示例

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


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

示例1: test_get_calc_from_start_or_end

# 需要导入模块: from inc.Commons import Commons [as 别名]
# 或者: from inc.Commons.Commons import get_calc_from_start_or_end [as 别名]
 def test_get_calc_from_start_or_end(self):
     string1 = "$12*17"
     assert Commons.get_calc_from_start_or_end(string1) == "12*17", "Failed to get calculation from end"
     string2 = "cos(tan(12+t+15))"
     assert Commons.get_calc_from_start_or_end(string2) == "cos(tan(12+", "Failed to get calculation from start"
     string3 = "hello"
     assert Commons.get_calc_from_start_or_end(string3) is None, "Did not return None when no calculation found"
     string4 = "£13.50"
     assert Commons.get_calc_from_start_or_end(string4) == "13.50", "Failed to get number from end"
     string5 = "23f234"
     assert Commons.get_calc_from_start_or_end(string5) == "23", "Function should prioritise calculation at start"
     string6 = "tasty pie"
     assert Commons.get_calc_from_start_or_end(string6) == " pie", "Bit weird, but this should work too"
开发者ID:joshcoales,项目名称:Hallo,代码行数:15,代码来源:testCommons.py


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