(self, container, item_name, msg=None)
| 195 | return service |
| 196 | |
| 197 | def assertNamedItemInContainer(self, container, item_name, msg=None): |
| 198 | def _is_string(obj): |
| 199 | if sys.version_info >= (3,): |
| 200 | return isinstance(obj, str) |
| 201 | else: |
| 202 | return isinstance(obj, basestring) |
| 203 | for item in container: |
| 204 | if _is_string(item): |
| 205 | if item == item_name: |
| 206 | return |
| 207 | elif item.name == item_name: |
| 208 | return |
| 209 | elif hasattr(item, 'snapshot') and item.snapshot == item_name: |
| 210 | return |
| 211 | |
| 212 | |
| 213 | standardMsg = '{0} not found in {1}'.format( |
| 214 | repr(item_name), repr(container)) |
| 215 | self.fail(self._formatMessage(msg, standardMsg)) |
| 216 | |
| 217 | def assertNamedItemNotInContainer(self, container, item_name, msg=None): |
| 218 | for item in container: |
no outgoing calls
no test coverage detected