def test_dict(self): with capture() as c: puts({ 'key': 'value', 'nonetype': None, 'nested': {'deep': 'value'}, }) self.assertEqual(len(c.getvalue().splitlines()), 3)
def main(): try: sys.path.append(os.getcwd()) imp.load_source('manage_file', os.path.join(os.getcwd(), 'manage.py')) except IOError as exc: return puts(cli.red(exc)) from manage_file import manager manager.main()
def main(): try: sys.path.append(os.getcwd()) imp.load_source('manager', os.path.join(os.getcwd(), 'manage.py')) except IOError: return puts(cli.red('No such file manage.py')) from manager import manager manager.main()
def test_false(self): with capture() as c: puts(False) self.assertEqual(c.getvalue(), 'FAILED\n')
def test_true(self): with capture() as c: puts(True) self.assertEqual(c.getvalue(), 'OK\n')
def test_list_strip_carriage_returns(self): with capture() as c: puts(['first line\n', 'second line\n']) self.assertEqual(len(c.getvalue().splitlines()), 2)
def test_empty(self): with capture() as c: puts('') self.assertEqual(c.getvalue(), '\n')
def test_none(self): with capture() as c: puts(None) self.assertEqual(c.getvalue(), '')