X-Git-Url: https://git.ayoreis.com/hackapet/Adafruit_Blinka.git/blobdiff_plain/e86b7edcdb912e9a6b304ffd391c07b18bde6380..38566e3a72507341517804c374e71e3bd4c82934:/test/src/testing/adafruit_blinka.py diff --git a/test/src/testing/adafruit_blinka.py b/test/src/testing/adafruit_blinka.py index 91a2c84..f27abb5 100644 --- a/test/src/testing/adafruit_blinka.py +++ b/test/src/testing/adafruit_blinka.py @@ -36,4 +36,17 @@ class TestEnum(unittest.TestCase): def test_str(self): """A str() call on an Enum performs the same as repr()""" - self.assertEqual(str(self.Cls.one), repr(self.Cls.one)) \ No newline at end of file + self.assertEqual(str(self.Cls.one), repr(self.Cls.one)) + +class TestDigitalInOut(unittest.TestCase): + + + def test_context_manager(self): + import digitalio + from testing.board import default_pin + """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)