-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(Pipelines) : Smart Data Frame Pipeline (Sourcery refactored) #740
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,8 +74,7 @@ def config(self, llm): | |
|
||
@pytest.fixture | ||
def context(self, sample_df, config): | ||
pipeline_context = PipelineContext([sample_df], config) | ||
return pipeline_context | ||
return PipelineContext([sample_df], config) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
@pytest.fixture | ||
def logger(self): | ||
|
@@ -127,15 +126,16 @@ def mock_intermediate_values(key : str): | |
return SkillsManager() | ||
elif key == "code_manager": | ||
return mock_code_manager | ||
|
||
context.get_intermediate_value = Mock(side_effect=mock_intermediate_values) | ||
|
||
assert isinstance(code_execution, CodeExecution) | ||
|
||
result = None | ||
try: | ||
result = code_execution.execute(input="Test Code", context=context, logger=logger) | ||
except Exception as e: | ||
assert result == None | ||
assert result is None | ||
Comment on lines
+129
to
+138
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
def test_code_execution_successful_at_retry(self, context, logger): | ||
# Test Flow : Code Execution Successful with no exceptions | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,8 +74,7 @@ def config(self, llm): | |
|
||
@pytest.fixture | ||
def context(self, sample_df, config): | ||
pipeline_context = PipelineContext([sample_df], config) | ||
return pipeline_context | ||
return PipelineContext([sample_df], config) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
@pytest.fixture | ||
def logger(self): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,8 +72,7 @@ def config(self, llm): | |
|
||
@pytest.fixture | ||
def context(self, sample_df, config): | ||
pipeline_context = PipelineContext([sample_df], config) | ||
return pipeline_context | ||
return PipelineContext([sample_df], config) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
@pytest.fixture | ||
def logger(self): | ||
|
@@ -111,20 +110,20 @@ def test_result_parsing_unsuccessful_with_exceptions(self, context, logger): | |
|
||
def mock_result_parsing(*args, **kwargs): | ||
raise Exception("Unit test exception") | ||
|
||
context._query_exec_tracker = Mock() | ||
context.query_exec_tracker.execute_func = Mock(side_effect=mock_result_parsing) | ||
|
||
def mock_intermediate_values(key : str): | ||
if key == "response_parser" : | ||
return mock_response_parser | ||
|
||
context.get_intermediate_value = Mock(side_effect=mock_intermediate_values) | ||
|
||
result = None | ||
try: | ||
result = result_parsing.execute(input="Test Result", context=context, logger=logger) | ||
except Exception as e: | ||
assert result == None | ||
assert result is None | ||
Comment on lines
-114
to
+127
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
assert isinstance(result_parsing, ResultParsing) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,8 +72,7 @@ def config(self, llm): | |
|
||
@pytest.fixture | ||
def context(self, sample_df, config): | ||
pipeline_context = PipelineContext([sample_df], config) | ||
return pipeline_context | ||
return PipelineContext([sample_df], config) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
@pytest.fixture | ||
def logger(self): | ||
|
@@ -96,7 +95,7 @@ def test_result_is_none(self, context, logger): | |
|
||
assert not context.query_exec_tracker.add_step.called | ||
assert isinstance(result_validation, ResultValidation) | ||
assert result == None | ||
assert result is None | ||
Comment on lines
-99
to
+98
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
def test_result_is_not_of_dict_type(self, context, logger): | ||
# Test Flow : Code Execution Successful with no exceptions | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function
PromptGeneration.execute
refactored with the following changes:inline-immediately-returned-variable
)