-
Notifications
You must be signed in to change notification settings - Fork 200
/
Copy pathtest_install.py
38 lines (30 loc) · 918 Bytes
/
test_install.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# -*- coding: utf-8 -*-
#
# IceCream - Never use print() to debug again
#
# Ansgar Grunseid
# grunseid.com
#
# License: MIT
#
import unittest
from install_test_import import runMe
from test_icecream import (captureStandardStreams, disableColoring,
parseOutputIntoPairs)
import icecream
class TestIceCreamInstall(unittest.TestCase):
def testInstall(self):
icecream.install()
with disableColoring(), captureStandardStreams() as (out, err):
runMe()
assert parseOutputIntoPairs(out, err, 1)[0][0] == ('x', '3')
icecream.uninstall() # Clean up builtins.
def testUninstall(self):
try:
icecream.uninstall()
except AttributeError: # Already uninstalled.
pass
# NameError: global name 'ic' is not defined.
with self.assertRaises(NameError):
runMe()