Skip to content
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

[ENHANCEMENT] Enhance data doc to show data asset name in overview block #1952

Merged
merged 5 commits into from
Oct 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion great_expectations/render/renderer/page_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ def _render_validation_header(cls, validation_results):
expectation_suite_path = (
os.path.join(*expectation_suite_path_components) + ".html"
)
data_asset_name = (
validation_results.meta["batch_kwargs"].get("data_asset_name")
)
if success:
success = "Succeeded"
html_success_icon = (
Expand Down Expand Up @@ -262,9 +265,11 @@ def _render_validation_header(cls, validation_results):
**{
"content_block_type": "string_template",
"string_template": {
"template": "${suite_title} ${expectation_suite_name}\n${status_title} ${html_success_icon} ${success}",
"template": "${suite_title} ${expectation_suite_name}\n ${data_asset} ${data_asset_name}\n ${status_title} ${html_success_icon} ${success}",
"params": {
"suite_title": "Expectation Suite:",
"data_asset": "Data asset:",
"data_asset_name": data_asset_name,
"status_title": "Status:",
"expectation_suite_name": expectation_suite_name,
"success": success,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@
"subheader": {
"content_block_type": "string_template",
"string_template": {
"template": "${suite_title} ${expectation_suite_name}\n${status_title} ${html_success_icon} ${success}",
"template": "${suite_title} ${expectation_suite_name}\n ${data_asset} ${data_asset_name}\n ${status_title} ${html_success_icon} ${success}",
"params": {
"suite_title": "Expectation Suite:",
"data_asset": "Data asset:",
"data_asset_name": null,
"status_title": "Status:",
"expectation_suite_name": "default",
"success": "Failed",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@
"subheader": {
"content_block_type": "string_template",
"string_template": {
"template": "${suite_title} ${expectation_suite_name}\n${status_title} ${html_success_icon} ${success}",
"template": "${suite_title} ${expectation_suite_name}\n ${data_asset} ${data_asset_name}\n ${status_title} ${html_success_icon} ${success}",
"params": {
"suite_title": "Expectation Suite:",
"data_asset": "Data asset:",
"data_asset_name": null,
"status_title": "Status:",
"expectation_suite_name": "default",
"success": "Failed",
Expand Down Expand Up @@ -4715,4 +4717,4 @@
"batch_kwargs": {
"ge_batch_id": "f499679e-6c5e-11ea-8d20-acde48001122"
}
}
}
4 changes: 4 additions & 0 deletions tests/render/test_default_markdown_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def test_snapshot_render_section_page_with_fixture_data(validation_operator_resu

## Overview
### **Expectation Suite:** **basic.warning**
**Data asset:** **None**
**Status:** **Failed**


Expand Down Expand Up @@ -293,6 +294,7 @@ def test_snapshot_render_section_page_with_fixture_data(validation_operator_resu

## Overview
### **Expectation Suite:** **basic.warning**
**Data asset:** **None**
**Status:** **Failed**


Expand Down Expand Up @@ -498,6 +500,7 @@ def test_render_section_page_with_fixture_data_multiple_validations(

## Overview
### **Expectation Suite:** **basic.warning**
**Dataasset:** **None**
**Status:** **Failed**


Expand Down Expand Up @@ -665,6 +668,7 @@ def test_render_section_page_with_fixture_data_multiple_validations(

## Overview
### **Expectation Suite:** **basic.warning**
**Dataasset:** **None**
**Status:** **Failed**


Expand Down
23 changes: 13 additions & 10 deletions tests/render/test_page_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,11 @@ def test_ValidationResultsPageRenderer_render_validation_header(
"subheader": {
"content_block_type": "string_template",
"string_template": {
"template": "${suite_title} ${expectation_suite_name}\n${status_title} ${html_success_icon} ${success}",
"template": "${suite_title} ${expectation_suite_name}\n ${data_asset} ${data_asset_name}\n ${status_title} ${html_success_icon} ${success}",
"params": {
"suite_title": "Expectation Suite:",
"data_asset": "Data asset:",
"data_asset_name": None,
"status_title": "Status:",
"expectation_suite_name": "default",
"success": "Failed",
Expand All @@ -236,8 +238,8 @@ def test_ValidationResultsPageRenderer_render_validation_header(
},
},
}

# print(validation_header)
import pprint
pprint.pprint(validation_header)
assert validation_header == expected_validation_header


Expand Down Expand Up @@ -512,10 +514,11 @@ def test_snapshot_ValidationResultsPageRenderer_render_with_run_info_at_end(
rendered_validation_results = validation_results_page_renderer.render(
titanic_profiled_evrs_1
).to_json_dict()
print(rendered_validation_results)
# with open(file_relative_path(__file__, "./fixtures/ValidationResultsPageRenderer_render_with_run_info_at_end.json"), "w") as f:
# json.dump(rendered_validation_results, f, indent=2)

import pprint
pprint.pprint(rendered_validation_results['sections'])
with open(file_relative_path(__file__, "./fixtures/ValidationResultsPageRenderer_render_with_run_info_at_end_nc.json"), "w") as f:
json.dump(rendered_validation_results, f, indent=2)
# pprint.pprint(ValidationResultsPageRenderer_render_with_run_info_at_end)
assert (
rendered_validation_results
== ValidationResultsPageRenderer_render_with_run_info_at_end
Expand All @@ -532,9 +535,9 @@ def test_snapshot_ValidationResultsPageRenderer_render_with_run_info_at_start(
rendered_validation_results = validation_results_page_renderer.render(
titanic_profiled_evrs_1
).to_json_dict()
print(rendered_validation_results)
# with open(file_relative_path(__file__, "./fixtures/ValidationResultsPageRenderer_render_with_run_info_at_start.json"), "w") as f:
# json.dump(rendered_validation_results, f, indent=2)
# print(rendered_validation_results)
with open(file_relative_path(__file__, "./fixtures/ValidationResultsPageRenderer_render_with_run_info_at_start_nc.json"), "w") as f:
json.dump(rendered_validation_results, f, indent=2)

assert (
rendered_validation_results
Expand Down