MCPcopy Create free account
hub / github.com/MaaXYZ/MaaFramework / test_wait_freezes

Function test_wait_freezes

test/python/pipeline_test.py:1125–1163  ·  view source on GitHub ↗

测试 wait_freezes 参数解析

(context: Context)

Source from the content-addressed store, hash-verified

1123
1124
1125def test_wait_freezes(context: Context):
1126 """测试 wait_freezes 参数解析"""
1127 print("\n=== test_wait_freezes ===")
1128
1129 new_ctx = context.clone()
1130
1131 # 简单数值格式
1132 new_ctx.override_pipeline(
1133 {"WaitFreezesSimple": {"pre_wait_freezes": 500, "post_wait_freezes": 1000}}
1134 )
1135
1136 obj = new_ctx.get_node_object("WaitFreezesSimple")
1137 assert_eq(obj.pre_wait_freezes.time, 500, "pre_wait_freezes.time")
1138 assert_eq(obj.post_wait_freezes.time, 1000, "post_wait_freezes.time")
1139
1140 # 对象格式
1141 new_ctx.override_pipeline(
1142 {
1143 "WaitFreezesObject": {
1144 "pre_wait_freezes": {
1145 "time": 800,
1146 "target": [100, 100, 200, 200],
1147 "threshold": 0.98,
1148 "method": 3,
1149 "rate_limit": 500,
1150 "timeout": 10000,
1151 }
1152 }
1153 }
1154 )
1155
1156 obj = new_ctx.get_node_object("WaitFreezesObject")
1157 assert_eq(obj.pre_wait_freezes.time, 800, "pre_wait_freezes.time")
1158 assert_eq(obj.pre_wait_freezes.threshold, 0.98, "threshold")
1159 assert_eq(obj.pre_wait_freezes.method, 3, "method")
1160 assert_eq(obj.pre_wait_freezes.rate_limit, 500, "rate_limit")
1161 assert_eq(obj.pre_wait_freezes.timeout, 10000, "timeout")
1162
1163 print(" PASS: wait_freezes")
1164
1165
1166# ============================================================================

Callers 1

analyzeMethod · 0.85

Calls 4

assert_eqFunction · 0.85
cloneMethod · 0.45
override_pipelineMethod · 0.45
get_node_objectMethod · 0.45

Tested by

no test coverage detected