修改前后 diff
--- a/app.py
+++ b/app.py
@@ -1,2 +1,5 @@
+def normalize_sku(value):
+ return value.strip().lower()
+
def clean(value):
- return value.strip().lower()
+ return normalize_sku(value)
--- a/consumer.py
+++ b/consumer.py
@@ -1,4 +1,4 @@
-from app import clean
+from app import normalize_sku
def label(value):
- return 'sku:' + clean(value)
+ return 'sku:' + normalize_sku(value)
真实测试记录
before exit=1\ntest_app (unittest.loader._FailedTest.test_app) ... ERROR
======================================================================
ERROR: test_app (unittest.loader._FailedTest.test_app)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_app
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/unittest/loader.py", line 426, in _find_test_path
module = self._get_module_from_name(name)
File "/Library/Frameworks/Python.framework/Versions/3.14/lib/python3.14/unittest/loader.py", line 367, in _get_module_from_name
__import__(name)
~~~~~~~~~~^^^^^^
File "/Users/lorin/my-clone/quickrout/public/downloads/tutorials-batch50b-20261014/practical/aider-multi-file-rename/before/test_app.py", line 2, in <module>
from app import clean, normalize_sku
ImportError: cannot import name 'normalize_sku' from 'app' (/Users/lorin/my-clone/quickrout/public/downloads/tutorials-batch50b-20261014/practical/aider-multi-file-rename/before/app.py)
----------------------------------------------------------------------
Ran 1 test in 0.000s
FAILED (errors=1)
\nfixed exit=0\ntest_contract (test_app.LessonTest.test_contract) ... ok
----------------------------------------------------------------------
Ran 1 test in 0.000s
OK
标准库测试真实运行;参考代码人工编写,未执行 Aider 或付费模型。