⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testtester.py

📁 开源游戏代码
💻 PY
字号:
# $Id: testtester.py,v 1.2 2002/02/18 10:49:39 marijn Exp $# Tester programs with the airtraffic program.# Copyright (C) 2000,1,2  Marijn Vriens <marijn@sanity.dhs.org>## This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2 of the License, or# (at your option) any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USAimport unittestdef suite():    suite = unittest.TestSuite()    suite.addTest(testTester("testTrue"))    suite.addTest(testTester("testFalse"))    suite.addTest(testTester("testAssertEqual"))    suite.addTest(testTester("testFail"))    suite.addTest(testTester("testFailIf"))    suite.addTest(testTester("testFailUnless"))    suite.addTest(testTester("testExceptionRaise"))    suite.addTest(testTester("testExceptionNoRaise"))    return suiteclass testTester(unittest.TestCase):    def testTrue(self):        assert(1 == 1)    def testFalse(self):        assert(1 != 2)    def testAssertEqual(self):        self.assertEqual(1, 1)    def testFail(self):        v = 3        if v != 3: self.fail()    def testFailIf(self):        self.failIf(1 != 1)    def testFailUnless(self):        self.failUnless(1 == 1)    def testExceptionRaise(self):        try:            p = v        except NameError:            pass        else:            fail("This should raise an exception")    def testExceptionNoRaise(self):        v = 3        try:            p = v        except NameError:            fail("This should not raise an exception")# $Log: testtester.py,v $# Revision 1.2  2002/02/18 10:49:39  marijn# Updated copyright information## Revision 1.1  2001/12/11 20:49:08  marijn# Simple working testing framework in place.#

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -