wenwen
wenwen

探索網路世界和進入區塊鏈的過程或許很平凡,但我就是想分享給大家,若能幫助到有需要幫助的人,那就更好了。 有幫到你的話,記得按下方拍手圖,不需花你任何金錢,免費註冊Liker ID,就可對我化讚為賞:https://button.like.co/willie5068

018第11章 TESTING YOUR CODE

進度多寡不重要,重要的是要有持續的進度。

💛20230118晨讀感言:

💔學習設置測試用例的語法需要一些時間來適應,但一旦你設置了測試用例,就可以直接為你的函數添加更多的單元測試。

💔至此,python 的基礎語法已經告一段落了,接下來就是 進入本書 第二階段:實作,本書有 三個 project 要實作,所以,每日晨讀內容進度將會 視 對程式的理解和實作進度 而有所不同。

💛晨讀摘要:

💚211 Unit Tests and Test Cases: A _unit test_ verifies that one specific aspect of a function’s behavior is correct. A _test case_ is a collection of unit tests that together prove that a function behaves as it’s supposed to, within the full range of situations you expect it to handle. A good test case considers all the possible kinds of input a function could receive and includes tests to represent each of these situations.

💚211 To write a test case for a function, import the unittest module and the function you want to test. Then create a class that inherits from unittest.TestCase, and write a series of methods to test different aspects of your function’s behavior.

from :《python crash course》

CC BY-NC-ND 2.0 版权声明

喜欢我的文章吗?
别忘了给点支持与赞赏,让我知道创作的路上有你陪伴。

加载中…
加载中…

发布评论