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