-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtest_neopixel.py
More file actions
55 lines (39 loc) · 1.19 KB
/
Copy pathtest_neopixel.py
File metadata and controls
55 lines (39 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""Unittest of NeoPixel"""
from nose2.tools import params
import unittest
# custom imports
from led_helper import NeoPixel
from machine import Pin
class TestNeoPixel(unittest.TestCase):
def setUp(self) -> None:
pass
def tearDown(self) -> None:
pass
def test__init__(self) -> None:
"""Test __init__ function"""
pixel_pin = Pin(12, Pin.OUT)
pixel = NeoPixel(pin=pixel_pin, n=34)
self.assertIsInstance(pixel._pin, Pin)
self.assertEqual(pixel._amount, 34)
@unittest.skip("Not yet implemented")
@params(
(None),
('Sauerkraut')
)
def test_fill(self, pixel) -> None:
"""Test setting the value of all pixels to the pixel value"""
pass
def test__len__(self) -> None:
"""Test getting the number of LEDs"""
pixel_pin = Pin(32, Pin.OUT)
pixels = 42
pixel = NeoPixel(pin=pixel_pin, n=pixels)
amount_of_pixels = len(pixel)
self.assertEqual(amount_of_pixels, pixels)
@unittest.skip("Not yet implemented")
def test_write(self) -> None:
pass
if __name__ == '__main__':
unittest.main()