本文整理汇总了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"