Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gaogaotiantian committed Nov 8, 2024
1 parent 6182b2a commit 5617db0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/test_objprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import io
import json
import re
import sys
from unittest.mock import patch

from objprint import op
Expand Down Expand Up @@ -340,9 +341,10 @@ def test_exec_return_value(self):
self.assertEqual("[1, 2, 3]\n[1, 2, 3]\n", output)

with io.StringIO() as buf, redirect_stdout(buf):
exec("from objprint import op")
exec("b = op([1,2,3])")
exec("print(b)")
locals = sys._getframe(1).f_locals
exec("from objprint import op", globals(), locals)
exec("b = op([1,2,3])", globals(), locals)
exec("print(b)", globals(), locals)
output = buf.getvalue()
self.assertEqual("[1, 2, 3]\n[1, 2, 3]\n", output)

Expand Down

0 comments on commit 5617db0

Please sign in to comment.