]> Repositories - Adafruit_Blinka-hackapet.git/blob - test/src/testing/implementation/micropython/digitalio.py
05f7e42b3c42ae0ef5bb3fc1fcb6f21528d253ff
[Adafruit_Blinka-hackapet.git] / test / src / 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__() and should dispose machine.pin reference"""
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()