def test_ValidationResultsColumnSectionRenderer_render_header_evr_with_unescaped_dollar_sign(
        titanic_profiled_name_column_evrs):
    evr_with_unescaped_dollar_sign = ExpectationValidationResult(
        success=True,
        result={
            'element_count': 1313,
            'missing_count': 0,
            'missing_percent': 0.0,
            'unexpected_count': 0,
            'unexpected_percent': 0.0,
            'unexpected_percent_nonmissing': 0.0,
            'partial_unexpected_list': [],
            'partial_unexpected_index_list': [],
            'partial_unexpected_counts': []
        },
        exception_info={
            'raised_exception': False,
            'exception_message': None,
            'exception_traceback': None
        },
        expectation_config=ExpectationConfiguration(
            expectation_type='expect_column_values_to_be_in_type_list',
            kwargs={
                'column':
                'Name ($)',
                'type_list':
                ['CHAR', 'StringType', 'TEXT', 'VARCHAR', 'str', 'string'],
                'result_format':
                'SUMMARY'
            }))

    remaining_evrs, content_block = ValidationResultsColumnSectionRenderer._render_header(
        validation_results=[evr_with_unescaped_dollar_sign], )

    print(content_block.to_json_dict())

    assert content_block.to_json_dict() == {
        'content_block_type': 'header',
        'styling': {
            'classes': ['col-12', 'p-0'],
            'header': {
                'classes': ['alert', 'alert-secondary']
            }
        },
        'header': {
            'content_block_type': 'string_template',
            'string_template': {
                'template': 'Name ($$)',
                'tag': 'h5',
                'styling': {
                    'classes': ['m-0']
                }
            }
        }
    }
Exemplo n.º 2
0
def test_ValidationResultsColumnSectionRenderer_render_header(titanic_profiled_name_column_evrs):
    remaining_evrs, content_block = ValidationResultsColumnSectionRenderer._render_header(
        validation_results=titanic_profiled_name_column_evrs,
    )
    print(content_block.to_json_dict())
    assert content_block.to_json_dict() == {
        'content_block_type': 'header', 'styling': {'classes': ['col-12', 'p-0'],
                                                    'header': {'classes': ['alert',
                                                                           'alert-secondary']}},
        'header': {'content_block_type': 'string_template',
                   'string_template': {'template': 'Name', 'tag': 'h5',
                                       'styling': {'classes': ['m-0']}}}}
def test_ValidationResultsColumnSectionRenderer_render_header(
        titanic_profiled_name_column_evrs):
    remaining_evrs, content_block = ValidationResultsColumnSectionRenderer._render_header(
        validation_results=titanic_profiled_name_column_evrs, )

    assert content_block == {
        'content_block_type': 'header',
        'header': 'Name',
        'styling': {
            'classes': ['col-12'],
            'header': {
                'classes': ['alert', 'alert-secondary']
            }
        }
    }
def test_ValidationResultsColumnSectionRenderer_render_header(
        titanic_profiled_name_column_evrs):
    remaining_evrs, content_blocks = ValidationResultsColumnSectionRenderer._render_header(
        validation_results=titanic_profiled_name_column_evrs,
        content_blocks=[])

    print(json.dumps(content_blocks, indent=2))

    assert content_blocks == [{
        'content_block_type': 'header',
        'header': 'Name',
        'styling': {
            'classes': ['col-12'],
            'header': {
                'classes': ['alert', 'alert-secondary']
            }
        }
    }]

    evr_with_unescaped_dollar_sign = {
        'success': True,
        'result': {
            'element_count': 1313,
            'missing_count': 0,
            'missing_percent': 0.0,
            'unexpected_count': 0,
            'unexpected_percent': 0.0,
            'unexpected_percent_nonmissing': 0.0,
            'partial_unexpected_list': [],
            'partial_unexpected_index_list': [],
            'partial_unexpected_counts': []
        },
        'exception_info': {
            'raised_exception': False,
            'exception_message': None,
            'exception_traceback': None
        },
        'expectation_config': {
            'expectation_type': 'expect_column_values_to_be_in_type_list',
            'kwargs': {
                'column':
                'Name ($)',
                'type_list':
                ['CHAR', 'StringType', 'TEXT', 'VARCHAR', 'str', 'string'],
                'result_format':
                'SUMMARY'
            }
        }
    }

    remaining_evrs, content_blocks = ValidationResultsColumnSectionRenderer._render_header(
        validation_results=[evr_with_unescaped_dollar_sign], content_blocks=[])

    print(json.dumps(content_blocks, indent=2))

    assert content_blocks == [{
        'content_block_type': 'header',
        'header': 'Name ($$)',
        'styling': {
            'classes': ['col-12'],
            'header': {
                'classes': ['alert', 'alert-secondary']
            }
        }
    }]