]> Repositories - Adafruit_Blinka-hackapet.git/blob - python/testing/implementation/micropython/digitalio.py
Initialisations to None help with code completion editors. Context-manager signature...
[Adafruit_Blinka-hackapet.git] / python / testing / implementation / micropython / digitalio.py
1 """
2     Tests which require an embedded platform (with actual hardware bindings)
3     but which are not architecture-specific.
4 """
5 import unittest
6 import digitalio
7 from testing.board import default_pin
8
9 class TestDigitalInOut(unittest.TestCase):
10
11
12     def test_context_manager(self):
13         """Deinitialisation is triggered by __exit__()"""
14         dio = digitalio.DigitalInOut(default_pin)
15         self.assertIsNotNone(dio._pin)
16         with dio:
17             pass
18         self.assertIsNone(dio._pin)
19
20 def main():
21     unittest.main()