是否有任何JavaScript測試框架提供了與Python的doctest大致等價的東西? function add(a, b) {
/**
Returns the sum of `a` and `b`:
> add(1, 3)
4
Add coerces types to numeric values where possible:
我有一個文檔測試,其中I測試浮子轉換: >>> float('fish')
在Python < 2.7,這導致: ValueError: invalid literal for float(): fish
在Python 2.7結果是 ValueError: could not convert string to float: fish
我可以在我的doctest中將這兩個結果都接受嗎
我正處於使用python作爲軟件QA工具的學習階段。 我寫了下一個簡單的測試,以便在文本文件數字矩陣中查找字母'a'。 問題是即使期望等於我所得到的,測試也會失敗。 這是爲什麼?你能告訴我我做錯了什麼嗎? 測試腳本: fin = open("abc.txt", "r")
arr_fin = []
for line in fin:
arr_fin.append(line.split