Python:unittest未运行

2024-09-29 00:19:10 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在开发一个transpiler,想试用TDD,但测试似乎没有运行。运行python test_transpiler.py之后,我得到:

15

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK

代码是:

import unittest
import transpiler

class TranspilerTDD:
    def test_adds_encoding(self):
        source = ""
        result = transpile(source);
        expected = "#coding: utf-8\n"
        self.assertEqual(result, expected)

if __name__ == '__main__':
    unittest.main()

其中transpiletranspiler中的一个函数(我确信它正在工作)。你知道吗

怎么了?你知道吗


Tags: inpytestimportselfsourcemaintests