diff --git a/tests/test_jasinta.py b/tests/test_jasinta.py --- a/tests/test_jasinta.py +++ b/tests/test_jasinta.py @@ -1,22 +1,18 @@ from unittest import TestCase -from unittest.mock import MagicMock +from unittest.mock import patch from pyjsparser import parse from jasinta import interpret -import std as jasinta_std class TestBasicAddition(TestCase): - def setUp(self): - self.mock_print = MagicMock() - jasinta_std.lib["document"]["write"] = self.mock_print - - def test_interpret(self): + @patch("builtins.print") + def test_interpret(self, mock_print): s = """var a=3; var b=1; var c=a+b; document.write(c);""" interpret(parse(s)) - self.mock_print.assert_called_with(4.0) + mock_print.assert_called_with(4)