1
我想使用我熟悉的开发环境离线Codewars Python katas。然而,所提供的测试使用了与Python的Unittest完全不同的语法。我无法在任何地方找到测试框架的源代码。Codewars Python TDD离线
我已经试过codewars客户端NPM包(https://github.com/shime/codewars),但它混淆了我很深。我也看了codewars-cli亚军,但看起来更难以理解,并涉及到Docker。
这是令人沮丧,因为我真的只是想练习一些基本的编码,但我结束了其试图了解JSON和依赖性和包管理只是为了得到一个基本的TDD环境中正常运行。
任何人都可以请告知如何简单地使人们有可能用在Python katas本地提供的测试?下面的例子:
test.describe("Basic tests")
test.it("A resistor under 1000 ohms and with only three bands")
test.assert_equals(decode_resistor_colors("yellow violet black"), "47 ohms, 20%")
test.it("A resistor between 1000 and 999999 ohms, with a gold fourth band")
test.assert_equals(decode_resistor_colors("yellow violet red gold"), "4.7k ohms, 5%")
test.it("A resistor of 1000000 ohms or above, with a silver fourth band")
test.assert_equals(decode_resistor_colors("brown black green silver"), "1M ohms, 10%")
你可以自己实现这些函数,把它们放在一个名为test.py的文件中并导入它。 topcoder也有seri/gettc,我比shime/codewars有更好的时间。偶尔,我必须修复测试代码中的小错误,或者在使用gettc时由于多个可接受的答案而进行手动验证 – jonatan