<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ## 問題 You want to skip or mark selected tests as an anticipated failure in your unit tests. ## 解決方案 The unittest module has decorators that can be applied to selected test methods tocontrol their handling. For example: import unittestimport osimport platform class Tests(unittest.TestCase):def test_0(self):self.assertTrue(True) @unittest.skip(‘skipped test')def test_1(self): > self.fail(‘should have failed!') @unittest.skipIf(os.name=='posix', ‘Not supported on Unix')def test_2(self): > import winreg @unittest.skipUnless(platform.system() == ‘Darwin', ‘Mac specific test')def test_3(self): > self.assertTrue(True) @unittest.expectedFailuredef test_4(self): > self.assertEqual(2+2, 5) if __name__ == ‘__main__':unittest.main() If you run this code on a Mac, you’ll get this output: > > bash % python3 testsample.py -vtest_0 (__main__.Tests) ... oktest_1 (__main__.Tests) ... skipped ‘skipped test'test_2 (__main__.Tests) ... skipped ‘Not supported on Unix'test_3 (__main__.Tests) ... oktest_4 (__main__.Tests) ... expected failure > Ran 5 tests in 0.002s > OK (skipped=2, expected failures=1) ## 討論 The skip() decorator can be used to skip over a test that you don’t want to run at all.skipIf() and skipUnless() can be a useful way to write tests that only apply to certainplatforms or Python versions, or which have other dependencies. Use the @expectedFailure decorator to mark tests that are known failures, but for which you don’t wantthe test framework to report more information.The decorators for skipping methods can also be applied to entire testing classes. Forexample: @unittest.skipUnless(platform.system() == ‘Darwin', ‘Mac specific tests')class DarwinTests(unittest.TestCase): > ...
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看