Python 3.2.3rc2 (default, Mar 21 2012, 06:59:51) [GCC 4.6.3] on linux2 Type "copyright", "credits" or "license()" for more information. >>> new_file = open('new_file.txt', 'w') >>> new_file.write('this\n') 5 >>> new_file.write('that\n') 5 >>> new_file.write('other thing\n') 12 >>> new_file.close() >>> new_file = open('new_file.txt', 'r') >>> for line in new_file: print(line) this that other thing >>> x = ['this\n', 'that\n', 'other thing\n'] >>> x ['this\n', 'that\n', 'other thing\n'] >>> new_file.close() >>> new_file = open('new_file.txt', 'r') >>> for line in new_file: print(line == x[1]) False True False >>> stuff = 'STUFF' >>> stuff 'STUFF' >>> stuff.lower() 'stuff' >>> stuf.upper() Traceback (most recent call last): File "", line 1, in stuf.upper() NameError: name 'stuf' is not defined >>> stuff.upper() 'STUFF' >>> def some_squares(x, y) return (x**2, y**2) SyntaxError: invalid syntax >>> def some_squares(x, y): return (x**2, y**2) >>> some_squares(2, 3) (4, 9) >>> x2, y2 = some_squares(2, 3) >>> x2 4 >>> y2 9 >>> ================================ RESTART ================================ >>> Traceback (most recent call last): File "/home/sukaeto/test1/july11_tests.py", line 1, in from july11 import * ImportError: No module named july11 >>> ================================ RESTART ================================ >>> E ====================================================================== ERROR: test_square_list (__main__.TestJuly11) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/sukaeto/test1/july11_tests.py", line 8, in test_square_list square_list([2, 3, 4, 5, 6, 7]), NameError: global name 'square_list' is not defined ---------------------------------------------------------------------- Ran 1 test in 0.070s FAILED (errors=1) >>> ================================ RESTART ================================ >>> F ====================================================================== FAIL: test_square_list (__main__.TestJuly11) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/sukaeto/test1/july11_tests.py", line 9, in test_square_list [4, 9, 16, 25, 36, 49]) AssertionError: None != [4, 9, 16, 25, 36, 49] ---------------------------------------------------------------------- Ran 1 test in 0.016s FAILED (failures=1) >>> ================================ RESTART ================================ >>> F ====================================================================== FAIL: test_square_list (__main__.TestJuly11) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/sukaeto/test1/july11_tests.py", line 9, in test_square_list [4, 9, 16, 25, 36, 49]) AssertionError: None != [4, 9, 16, 25, 36, 49] ---------------------------------------------------------------------- Ran 1 test in 0.022s FAILED (failures=1) >>> ================================ RESTART ================================ >>> F ====================================================================== FAIL: test_square_list (__main__.TestJuly11) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/sukaeto/test1/july11_tests.py", line 9, in test_square_list [4, 9, 16, 25, 36, 49]) AssertionError: 4 != [4, 9, 16, 25, 36, 49] ---------------------------------------------------------------------- Ran 1 test in 0.017s FAILED (failures=1) >>> ================================ RESTART ================================ >>> E ====================================================================== ERROR: test_square_list (__main__.TestJuly11) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/sukaeto/test1/july11_tests.py", line 8, in test_square_list square_list([2, 3, 4, 5, 6, 7]), File "/home/sukaeto/test1/july11.py", line 7, in square_list num_list += num ** 2 TypeError: 'int' object is not iterable ---------------------------------------------------------------------- Ran 1 test in 0.017s FAILED (errors=1) >>> ================================ RESTART ================================ >>> F ====================================================================== FAIL: test_square_list (__main__.TestJuly11) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/sukaeto/test1/july11_tests.py", line 9, in test_square_list [4, 9, 16, 25, 36, 49]) AssertionError: None != [4, 9, 16, 25, 36, 49] ---------------------------------------------------------------------- Ran 1 test in 0.021s FAILED (failures=1) >>> ================================ RESTART ================================ >>> E ====================================================================== ERROR: test_square_list (__main__.TestJuly11) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/sukaeto/test1/july11_tests.py", line 12, in test_square_list self.assertEqual(squre_list([10]), [100]) NameError: global name 'squre_list' is not defined ---------------------------------------------------------------------- Ran 1 test in 0.018s FAILED (errors=1) >>> ================================ RESTART ================================ >>> . ---------------------------------------------------------------------- Ran 1 test in 0.016s OK >>> ================================ RESTART ================================ >>> F ====================================================================== FAIL: test_square_list (__main__.TestJuly11) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/sukaeto/test1/july11_tests.py", line 9, in test_square_list [4, 9, 16, 25, 36, 49]) AssertionError: Lists differ: [2, 3, 4, 5, 6, 7] != [4, 9, 16, 25, 36, 49] First differing element 0: 2 4 - [2, 3, 4, 5, 6, 7] + [4, 9, 16, 25, 36, 49] ---------------------------------------------------------------------- Ran 1 test in 0.018s FAILED (failures=1) >>> ================================ RESTART ================================ >>> . ---------------------------------------------------------------------- Ran 1 test in 0.018s OK >>> ================================ RESTART ================================ >>> . ---------------------------------------------------------------------- Ran 1 test in 0.018s OK >>> ================================ RESTART ================================ >>> Traceback (most recent call last): File "/home/sukaeto/test1/july11_tests.py", line 1, in from july11 import * File "/home/sukaeto/test1/july11.py", line 9 num_list += [nums[index]]**2] ^ SyntaxError: invalid syntax >>> ================================ RESTART ================================ >>> E ====================================================================== ERROR: test_square_list (__main__.TestJuly11) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/sukaeto/test1/july11_tests.py", line 14, in test_square_list self.assertEqual(square_list(['a', 'b', 'c']), None) File "/home/sukaeto/test1/july11.py", line 9, in square_list num_list += [nums[index]**2] TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int' ---------------------------------------------------------------------- Ran 1 test in 0.018s FAILED (errors=1) >>> ================================ RESTART ================================ >>> E ====================================================================== ERROR: test_square_list (__main__.TestJuly11) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python3.2/unittest/case.py", line 557, in assertRaises callableObj(*args, **kwargs) TypeError: 'list' object is not callable During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/sukaeto/test1/july11_tests.py", line 14, in test_square_list self.assertRaises(square_list, ['a', 'b', 'c'], TypeError) File "/usr/lib/python3.2/unittest/case.py", line 557, in assertRaises callableObj(*args, **kwargs) File "/usr/lib/python3.2/unittest/case.py", line 140, in __exit__ if not issubclass(exc_type, self.expected): TypeError: issubclass() arg 2 must be a class or tuple of classes ---------------------------------------------------------------------- Ran 1 test in 0.041s FAILED (errors=1) >>> ================================ RESTART ================================ >>> . ---------------------------------------------------------------------- Ran 1 test in 0.018s OK >>> ================================ RESTART ================================ >>> . ---------------------------------------------------------------------- Ran 1 test in 0.021s OK >>> ================================ RESTART ================================ >>> E. ====================================================================== ERROR: test_dot_product (__main__.TestJuly11) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/sukaeto/test1/july11_tests.py", line 18, in test_dot_product self.assertEqual(dot_product([2, 3], [4, 5]), [8, 15]) NameError: global name 'dot_product' is not defined ---------------------------------------------------------------------- Ran 2 tests in 0.027s FAILED (errors=1) >>> ================================ RESTART ================================ >>> F. ====================================================================== FAIL: test_dot_product (__main__.TestJuly11) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/sukaeto/test1/july11_tests.py", line 18, in test_dot_product self.assertEqual(dot_product([2, 3], [4, 5]), [8, 15]) AssertionError: None != [8, 15] ---------------------------------------------------------------------- Ran 2 tests in 0.030s FAILED (failures=1) >>> ================================ RESTART ================================ >>> E. ====================================================================== ERROR: test_dot_product (__main__.TestJuly11) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/sukaeto/test1/july11_tests.py", line 18, in test_dot_product self.assertEqual(dot_product([2, 3], [4, 5]), [8, 15]) File "/home/sukaeto/test1/july11.py", line 17, in dot_product product += vec1[num] * vec2[num] TypeError: 'int' object is not iterable ---------------------------------------------------------------------- Ran 2 tests in 0.028s FAILED (errors=1) >>> ================================ RESTART ================================ >>> F. ====================================================================== FAIL: test_dot_product (__main__.TestJuly11) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/sukaeto/test1/july11_tests.py", line 18, in test_dot_product self.assertEqual(dot_product([2, 3], [4, 5]), [8, 15]) AssertionError: None != [8, 15] ---------------------------------------------------------------------- Ran 2 tests in 0.034s FAILED (failures=1) >>> ================================ RESTART ================================ >>> .. ---------------------------------------------------------------------- Ran 2 tests in 0.029s OK >>>