| OLD | NEW |
| 1 # Copyright (c) 2010 Google Inc. All rights reserved. | 1 # Copyright (c) 2010 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 test = _TestObject() | 64 test = _TestObject() |
| 65 add_one = test.memoized_add_one | 65 add_one = test.memoized_add_one |
| 66 self.assertEqual(add_one(4), 5) | 66 self.assertEqual(add_one(4), 5) |
| 67 self.assertEqual(test.call_count, 1) | 67 self.assertEqual(test.call_count, 1) |
| 68 | 68 |
| 69 def test_non_hashable_args(self): | 69 def test_non_hashable_args(self): |
| 70 test = _TestObject() | 70 test = _TestObject() |
| 71 try: | 71 try: |
| 72 test.memoized_add_one([]) | 72 test.memoized_add_one([]) |
| 73 self.fail('Expected TypeError.') | 73 self.fail('Expected TypeError.') |
| 74 except TypeError as e: | 74 except TypeError as error: |
| 75 self.assertEqual( | 75 self.assertEqual( |
| 76 e.message, | 76 error.message, |
| 77 'Cannot call memoized function memoized_add_one with ' | 77 'Cannot call memoized function memoized_add_one with ' |
| 78 'unhashable arguments: unhashable type: \'list\'') | 78 'unhashable arguments: unhashable type: \'list\'') |
| OLD | NEW |