# Path: hecatoncheir/DbProfilerFormatter.py
# def format_non_null_ratio(rows, nulls):
# def format_cardinality(rows, cardinality, nulls):
# def format_data_type(d1, d2):
# def format_value_freq_ratio(rows, nulls, freq):
# def get_validation_rule(column_name, rule, invalid):
# def filter_markdown2html(text):
# def filter_term2popover(html, pos, term, content, orig=None):
# def create_popover_content(term):
# def filter_glossaryterms(html, glossary_terms):
# def format_comment_tooltip(msg, maxlen=20):
# def get_default_template_path():
# def format_number(value):
# def format_minmax(minval, maxval):
# def is_column_unique(most_freq_vals):
# def format_fks(dbname, fks):
# def format_freq_values(freq_vals, row_count, nulls):
# def format_validation_item(val):
# def format_validation_items(vals):
# def filter_plain2html(s):
# def format_table_datamapping(datamapping):
# def format_column_datamapping(datamapping, column_name):
# def format_column_metadata(colmeta, tabmeta, row_count, glossary_terms,
#                            datamapping):
# def format_table_metadata(tabmeta, glossary_terms, datamapping=None):
# def to_table_html(tabdata, validation_rules=None, datamapping=None,
#                   files=None,
#                   glossary_terms=None, template_file=None, editable=False):
# def format_timestamp(ts):
# def get_template_from_file(filename, encoding='utf-8'):
# def to_index_html(data, reponame, schemas=None, tags=None,
#                   show_validation='none', comment=None,
#                   files=None, glossary_terms=None,
#                   template_file=None, editable=False, max_panels=99):
# def to_glossary_html(glossary_terms=None, template_file=None, editable=False):
# 
# Path: hecatoncheir/exception.py
# class DbProfilerException(Exception):
#     source = None
# 
#     def __init__(self, value, source=None):
#         self.value = value
#         self.source = source
# 
#     def __str__(self):
#         return self.value
# 
# class InternalError(Exception):
#     source = None
#     query = None
# 
#     def __init__(self, value, query=None, source=None):
#         self.value = value
#         self.query = query
#         self.source = source
# 
#     def __str__(self):
#         return self.value


import json
import os
import re
import sys
import unittest
from hecatoncheir import DbProfilerFormatter
from hecatoncheir.exception import DbProfilerException, InternalError
          "NUMBER",
          "22"
        ],
        "max": "200000",
        "min": "1",
        "nulls": 0,
        "validation": {}
      },
      {
        "cardinality": 200000,
        "column_name": "c2",
        "data_type": [
          "NUMBER",
          "22"
        ],
        "max": "200000",
        "min": "1",
        "nulls": 3,
        "validation": {}
      }
    ],
    "database_name": "orcl",
    "row_count": 200000,
    "schema_name": "public",
    "table_name": "t1",
    "timestamp": "2016-05-01T16:15:18.028309"
  }
]
"""


# Path: hecatoncheir/DbProfilerFormatter.py
# def format_non_null_ratio(rows, nulls):
# def format_cardinality(rows, cardinality, nulls):
# def format_data_type(d1, d2):
# def format_value_freq_ratio(rows, nulls, freq):
# def get_validation_rule(column_name, rule, invalid):
# def filter_markdown2html(text):
# def filter_term2popover(html, pos, term, content, orig=None):
# def create_popover_content(term):
# def filter_glossaryterms(html, glossary_terms):
# def format_comment_tooltip(msg, maxlen=20):
# def get_default_template_path():
# def format_number(value):
# def format_minmax(minval, maxval):
# def is_column_unique(most_freq_vals):
# def format_fks(dbname, fks):
# def format_freq_values(freq_vals, row_count, nulls):
# def format_validation_item(val):
# def format_validation_items(vals):
# def filter_plain2html(s):
# def format_table_datamapping(datamapping):
# def format_column_datamapping(datamapping, column_name):
# def format_column_metadata(colmeta, tabmeta, row_count, glossary_terms,
#                            datamapping):
# def format_table_metadata(tabmeta, glossary_terms, datamapping=None):
# def to_table_html(tabdata, validation_rules=None, datamapping=None,
#                   files=None,
#                   glossary_terms=None, template_file=None, editable=False):
# def format_timestamp(ts):
# def get_template_from_file(filename, encoding='utf-8'):
# def to_index_html(data, reponame, schemas=None, tags=None,
#                   show_validation='none', comment=None,
#                   files=None, glossary_terms=None,
#                   template_file=None, editable=False, max_panels=99):
# def to_glossary_html(glossary_terms=None, template_file=None, editable=False):
# 
# Path: hecatoncheir/exception.py
# class DbProfilerException(Exception):
#     source = None
# 
#     def __init__(self, value, source=None):
#         self.value = value
#         self.source = source
# 
#     def __str__(self):
#         return self.value
# 
# class InternalError(Exception):
#     source = None
#     query = None
# 
#     def __init__(self, value, query=None, source=None):
#         self.value = value
#         self.query = query
#         self.source = source
# 
#     def __str__(self):
#         return self.value


# Path: tests/testDbProfilerFormatter.py
import json
import os
import re
import sys
import unittest
from hecatoncheir import DbProfilerFormatter
from hecatoncheir.exception import DbProfilerException, InternalError

          "NUMBER",
          "22"
        ],
        "max": "200000",
        "min": "1",
        "nulls": 0,
        "validation": {}
      },
      {
        "cardinality": 200000,
        "column_name": "c2",
        "data_type": [
          "NUMBER",
          "22"
        ],
        "max": "200000",
        "min": "1",
        "nulls": 3,
        "validation": {}
      }
    ],
    "database_name": "orcl",
    "row_count": 200000,
    "schema_name": "public",
    "table_name": "t1",
    "timestamp": "2016-05-01T16:15:18.028309"
  }
]
"""


        with self.assertRaises(DbProfilerException) as cm: