23 lines
731 B
Python
23 lines
731 B
Python
# -*- coding: utf-8 -*-
|
|
"""将 test_auth_system_properties.py 中所有 max_examples 统一设为指定值"""
|
|
import re
|
|
import sys
|
|
import collections
|
|
|
|
target = int(sys.argv[1]) if len(sys.argv) > 1 else 5
|
|
filepath = "tests/test_auth_system_properties.py"
|
|
|
|
with open(filepath, "r", encoding="utf-8") as f:
|
|
content = f.read()
|
|
|
|
counts_before = collections.Counter(re.findall(r"max_examples=(\d+)", content))
|
|
print(f"替换前: {dict(counts_before)}")
|
|
|
|
new_content = re.sub(r"max_examples=\d+", f"max_examples={target}", content)
|
|
|
|
with open(filepath, "w", encoding="utf-8") as f:
|
|
f.write(new_content)
|
|
|
|
counts_after = collections.Counter(re.findall(r"max_examples=(\d+)", new_content))
|
|
print(f"替换后: {dict(counts_after)}")
|