Example #1
0
def render(render_object):
    """Render a great expectations object to documentation.

    RENDER_OBJECT: path to a GE object to render
    """
    with open(render_object, "r") as infile:
        raw = json.load(infile)

    if "results" in raw:
        model = ProfilingResultsPageRenderer.render(raw)
    else:
        model = ExpectationSuitePageRenderer.render(raw)
    print(DefaultJinjaPageView.render(model))
Example #2
0
def test_render_profiled_fixture_expectation_suite(
        titanic_dataset_profiler_expectations):
    rendered_json = ExpectationSuitePageRenderer.render(
        titanic_dataset_profiler_expectations)
    rendered_page = DefaultJinjaPageView.render(rendered_json)

    with open(
            './tests/render/output/test_render_profiled_fixture_expectation_suite.html',
            'w') as f:
        f.write(rendered_page)

    assert rendered_page[:15] == "<!DOCTYPE html>"
    assert rendered_page[-7:] == "</html>"
Example #3
0
def test_render_profiled_fixture_expectation_suite_with_distribution(
        titanic_dataset_profiler_expectations_with_distribution):
    # Tests sparkline
    rendered_json = ExpectationSuitePageRenderer.render(
        titanic_dataset_profiler_expectations_with_distribution)
    rendered_page = DefaultJinjaPageView.render(rendered_json)

    with open(
            './tests/render/output/titanic_dataset_profiler_expectation_suite_with_distribution.html',
            'wb') as f:
        f.write(rendered_page.encode("utf-8"))

    assert rendered_page[:15] == "<!DOCTYPE html>"
    assert rendered_page[-7:] == "</html>"
def test_render_expectation_suite_for_Markdown(expectation_suite_to_render_with_notes):
    expectation_suite_page_renderer = ExpectationSuitePageRenderer()
    rendered_document_content_list = expectation_suite_page_renderer.render(
        expectation_suite_to_render_with_notes
    )
    md_str = DefaultMarkdownPageView().render(rendered_document_content_list)
    md_str = " ".join(md_str)
    md_str = md_str.replace(" ", "").replace("\t", "").replace("\n", "")
    assert (
        md_str
        == r"""
   # Validation Results
## Overview
### Info
 |  |  |
 | ------------  | ------------ |
Expectation Suite Name  | default
Great Expectations Version  | 0.13.0-test
### Notes
    This Expectation suite currently contains 5 total Expectations across 5 columns.
## infinities
  * is a required field.
  * ***
## irrationals
  * distinct values must belong to this set: \* **1st** **2nd**.
  * ***
## naturals
  * is a required field.
  * ***
## nulls
  * is a required field.
  * ***
## testings
  * values must be unique.
    #### Notes:
      Example notes about this expectation. **Markdown** `Supported`.

      Second example note **with** *Markdown*
  * ***
-----------------------------------------------------------
Powered by [Great Expectations](https://greatexpectations.io/)
    """.replace(
            " ", ""
        )
        .replace("\t", "")
        .replace("\n", "")
    )