def test_handles_methods_with_strangely_named_self(self): callables = inspect_returning_callables(function_calling_methods_with_strangely_named_self) assert_length(callables, 2) assert all(map(is_user_object, callables)) assert_equal_sets(['strange_method', 'another_strange_method'], [obj.calls[0].definition.name for obj in callables])
def contains_code(self): return not all([(line.strip().startswith("#") or line.strip() == '') for line in self.code.splitlines()])
def assert_generator_object(expected_input, expected_yields, obj): assert_instance(obj, GeneratorObject) assert obj.is_activated() assert_call_arguments(expected_input, obj.args) assert_collection_of_serialized(expected_yields, [c.output for c in obj.calls]) assert all([not c.raised_exception() for c in obj.calls])
def test_returns_a_list_with_user_objects(self): callables = inspect_returning_callables(function_calling_a_method) assert all(map(is_user_object, callables))
def test_returns_a_list_with_function_objects(self): callables = inspect_returning_callables(function_calling_two_different_functions) assert all(map(is_function, callables))