難度 ✩✩
《Arduino首次接觸就上手》的進階教學 追憶鳥山明:OLED螢幕上的經典重現
-
前言 已逝的鳥山明畫家,曾畫出許多知名的漫畫作品,如《怪博士與機器娃娃》和《七龍珠》…等,而這些作 [...]
〈《Arduino首次接觸就上手》的進階教學 追憶鳥山明:OLED螢幕上的經典重現〉這篇文章最早發佈於《CAVEDU教育團隊技術部落格》。
1 天前
import pytest def test1(): b = 'Apple' assert b != 'Hello' # PASS a = 1 assert a == 0 # FAIL 1 print('--------') # 上一行錯誤後,從這一行開始就不會被執行 assert b != 'Apple' # FAIL 2 def test2(): b = 'Apple' assert b != 'Hello' # PASS a = 1 #assert a == 0 # FAIL
[pytest] markers = AAAonly: test cases only for AAA. BBBonly: test cases only for BBB.
@pytest.mark.AAAonly def test1(): b = 'Apple' assert b != 'Hello' # PASS a = 1 assert a == 0 # FAIL 1 print('--------') # 上一行錯誤後,從這一行開始就不會被執行 assert b != 'Apple' # FAIL 2 @pytest.mark.BBBonly def test2(): b = 'Apple' assert b != 'Hello' # PASS a = 1 #assert a == 0 # FAIL
@pytest.mark.skip(reason='太累了,不想測!') def test0(): c = 0 assert c != 0
@pytest.mark.parametrize("num", [0, 1]) def test3(num): assert num == 0 # check number
@pytest.mark.parametrize("index, value, unit", [ ( 1, 0.1, 'V'), ( 2, 1.0, 'A'), ]) def test4(index, value, unit): print('') print(f'Index = {index}, Set {value}{unit}')
@pytest.mark.parametrize("num", [0, 1]) @pytest.mark.parametrize("word", ['Apple', 'Hello']) def test5(num, word): assert num == 0 # check number assert word != 'Hello' # check word
27 = 01 10 11b 十進位轉二進位 (2a+b) b __1__0__1____ / 01 10 11 1________ (2x 0 + 1) x 1 = 1 10 11 0_____ (2x 11 + 1) x 1 = 111 > 10 10 11 10 01___ (2x 100 + 1) x 1 = 1001 < 1011 10從上面算是可以看出整數 27 開根號可得整數 5 餘 2,這方法比泰勒展開簡單多了,效能又好。