X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/blobdiff_plain/f4f44cf730870773ff87242037bf7fd5f6acd8cd..5c2512abe5fa4f633afa94c742f3cd6bbf24c401:/test/src/testing/implementation/micropython/digitalio.py diff --git a/test/src/testing/implementation/micropython/digitalio.py b/test/src/testing/implementation/micropython/digitalio.py new file mode 100644 index 0000000..05f7e42 --- /dev/null +++ b/test/src/testing/implementation/micropython/digitalio.py @@ -0,0 +1,21 @@ +""" + Tests which require an embedded platform (with actual hardware bindings) + but which are not architecture-specific. +""" +import unittest +import digitalio +from testing.board import default_pin + +class TestDigitalInOut(unittest.TestCase): + + + def test_context_manager(self): + """Deinitialisation is triggered by __exit__() and should dispose machine.pin reference""" + dio = digitalio.DigitalInOut(default_pin) + self.assertIsNotNone(dio._pin) + with dio: + pass + self.assertIsNone(dio._pin) + +def main(): + unittest.main()