Exemple #1
0
    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])
Exemple #2
0
 def contains_code(self):
     return not all([(line.strip().startswith("#") or line.strip() == '') for line in self.code.splitlines()])
Exemple #3
0
 def contains_code(self):
     return not all([(line.strip().startswith("#") or line.strip() == '')
                     for line in self.code.splitlines()])
Exemple #4
0
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])
Exemple #5
0
    def test_returns_a_list_with_user_objects(self):
        callables = inspect_returning_callables(function_calling_a_method)

        assert all(map(is_user_object, callables))
Exemple #6
0
    def test_returns_a_list_with_function_objects(self):
        callables = inspect_returning_callables(function_calling_two_different_functions)

        assert all(map(is_function, callables))