Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Commit 00cf238

Browse files
author
Vandy Liu
committed
Added init tests
1 parent d200b1b commit 00cf238

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

src/microbit/test/test_init.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import time
2+
3+
import pytest
4+
from unittest import mock
5+
6+
from .. import *
7+
from ..__model.microbit_model import MicrobitModel
8+
9+
# tests methods in __init__.py
10+
11+
12+
class TestShim(object):
13+
def test_sleep(self):
14+
milliseconds = 100
15+
MicrobitModel.sleep = mock.Mock()
16+
sleep(milliseconds)
17+
MicrobitModel.sleep.assert_called_with(milliseconds)
18+
19+
def test_running_time(self):
20+
MicrobitModel.running_time = mock.Mock()
21+
running_time()
22+
MicrobitModel.running_time.assert_called_once()
23+
24+
def test_temperature(self):
25+
MicrobitModel.temperature = mock.Mock()
26+
temperature()
27+
MicrobitModel.temperature.asser_called_once()

0 commit comments

Comments
 (0)