标签:else lin break comment port put sim select cti
# # Finish the delta debug function ddmin # import re def test(s): print s, len(s),repr(s) if re.search("<SELECT[^>]*>", s) >= 0: print (s, len(s),"FAIL") return "FAIL" else: return "PASS" def ddmin(s): assert test(s) == "FAIL" n = 2 # Initial granularity while len(s) >= 2: start = 0 subset_length = len(s) / n some_complement_is_failing = False while start < len(s): complement = s[:start] + s[start + subset_length:] if test(complement) == "FAIL": s = complement n = max(n - 1, 2) some_complement_is_failing = True break start += subset_length if not some_complement_is_failing: # YOUR CODE HERE if len(s) == n: break n = min(n * 2, len(s)) return s # UNCOMMENT TO TEST html_input = ‘<SELECT>foo</SELECT>‘ print ddmin(html_input)
标签:else lin break comment port put sim select cti
原文地址:https://www.cnblogs.com/catgatp/p/11166568.html