| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import os | 6 import os |
| 7 import shutil | 7 import shutil |
| 8 import sys |
| 8 import tempfile | 9 import tempfile |
| 9 import unittest | 10 import unittest |
| 10 | 11 |
| 11 import test_env # pylint: disable=W0403,W0611 | 12 sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname( |
| 12 import sys | 13 os.path.abspath(__file__))))) |
| 13 from slave import field_composer | 14 |
| 15 from recipe_engine import field_composer |
| 14 | 16 |
| 15 | 17 |
| 16 # Functors are compared by reference. | 18 # Functors are compared by reference. |
| 17 BEAUTY_LAMBDA = lambda x, y: x + y + 1 | 19 BEAUTY_LAMBDA = lambda x, y: x + y + 1 |
| 18 | 20 |
| 19 | 21 |
| 20 class TestFieldComposer(unittest.TestCase): | 22 class TestFieldComposer(unittest.TestCase): |
| 21 | 23 |
| 22 def setUp(self): | 24 def setUp(self): |
| 23 super(TestFieldComposer, self).setUp() | 25 super(TestFieldComposer, self).setUp() |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 def test_compose_with_sneaky_bad_registry(self): | 73 def test_compose_with_sneaky_bad_registry(self): |
| 72 """RegistryConflict must be raised when functors clash.""" | 74 """RegistryConflict must be raised when functors clash.""" |
| 73 second_fc = field_composer.FieldComposer( | 75 second_fc = field_composer.FieldComposer( |
| 74 {}, {'beauty': {'combine': lambda x, y: 0}}) | 76 {}, {'beauty': {'combine': lambda x, y: 0}}) |
| 75 with self.assertRaises(field_composer.RegistryConflict): | 77 with self.assertRaises(field_composer.RegistryConflict): |
| 76 self.fc.compose(second_fc) | 78 self.fc.compose(second_fc) |
| 77 | 79 |
| 78 | 80 |
| 79 if __name__ == '__main__': | 81 if __name__ == '__main__': |
| 80 unittest.main() | 82 unittest.main() |
| OLD | NEW |