X-Git-Url: https://git.ayoreis.com/hackapet/Adafruit_Blinka.git/blobdiff_plain/5c2512abe5fa4f633afa94c742f3cd6bbf24c401..a8ed516cc3b6c4cdd7a346f897aa1a520071a239:/test/src/testing/adafruit_blinka.py?ds=inline 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)