修改前后 diff
--- a/app.py
+++ b/app.py
@@ -1,4 +1,2 @@
-import math
-
def normalize(value):
- return value.lower()
+ return value.strip().lower()
真实测试记录
before exit=1\ntest_contract (test_app.LessonTest.test_contract) ... FAIL
======================================================================
FAIL: test_contract (test_app.LessonTest.test_contract)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/lorin/my-clone/quickrout/public/downloads/tutorials-batch50b-20261014/practical/aider-lint-test-loop/before/test_app.py", line 6, in test_contract
self.assertEqual(normalize(' SKU-A '), 'sku-a')
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: ' sku-a ' != 'sku-a'
- sku-a
? -- -
+ sku-a
----------------------------------------------------------------------
Ran 1 test in 0.000s
FAILED (failures=1)
\nfixed exit=0\ntest_contract (test_app.LessonTest.test_contract) ... /Users/lorin/my-clone/quickrout/public/downloads/tutorials-batch50b-20261014/practical/aider-lint-test-loop/fixed/test_app.py:9: ResourceWarning: unclosed file <_io.TextIOWrapper name='app.py' mode='r' encoding='utf-8'>
tree = ast.parse(open('app.py', encoding='utf-8').read())
ResourceWarning: Enable tracemalloc to get the object allocation traceback
ok
----------------------------------------------------------------------
Ran 1 test in 0.004s
OK
标准库测试真实运行;参考代码人工编写,未执行 Aider 或付费模型。