Skip to content

Commit

Permalink
Update lesson_2_test.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ikostan authored Jun 26, 2024
1 parent 5a984f9 commit cb842bb
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/lesson_2_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import unittest
from unittest.mock import MagicMock
from lessons.lesson_2.main import ( # pylint: disable=import-error
led
LED
)


Expand All @@ -19,20 +19,20 @@ def test_led_on(self):
Mock the led.value() function and return 1 always
"""

led.value = MagicMock()
led.on()
led.value.return_value = 1
self.assertEqual(led.value(), 1)
LED.value = MagicMock()
LED.on()
LED.value.return_value = 1
self.assertEqual(LED.value(), 1)

def test_led_off(self):
"""
Mock the led.value() function and return 0 always
"""

led.value = MagicMock()
led.off()
led.value.return_value = 0
self.assertEqual(led.value(), 0)
LED.value = MagicMock()
LED.off()
LED.value.return_value = 0
self.assertEqual(LED.value(), 0)


if __name__ == '__main__':
Expand Down

0 comments on commit cb842bb

Please sign in to comment.