<jupyter_start><jupyter_text>Test This set of tests is manually executed today.  These tests will be migrated to py.test and this notebook will be removed.<jupyter_code>import add_parent_to_path<jupyter_output><empty_output><jupyter_text>Badly formed array<jupyter_code>from ipy_table import *
array = [[0, 1, 2], [3, 4]]
try:
    t = IpyTable(array)
except ValueError:
    print 'Pass'
else:
    print 'Fail'<jupyter_output>Pass<jupyter_text>Row range checking<jupyter_code>array = [[0, 1], [2, 3]]
t = IpyTable(array)
try:
    t.set_cell_style(2, 0, color='red')
except ValueError, error_text:
    print 'Pass (%s)' % error_text
else:
    print 'Fail'<jupyter_output>Pass (Bad row (2).  Expected row in range 0 to 1.)<jupyter_text>Unknown Theme<jupyter_code>array = [[0, 1], [2, 3]]
t = IpyTable(array)
try:
    t.apply_theme("monty")
except ValueError, error_text:
    print 'Pass (%s)' % error_text
else:
    print 'Fail'<jupyter_output>Pass (Unknown theme "monty". Expected one of ['basic', 'basic_left', 'basic_both'].)<jupyter_text>Random Styles<jupyter_code>import random
from random import randint
import string 
import ipy_table as ipt

width = randint(1,6)
height = randint(1,6)
array = [[None for column in range(width)] for row in range(height)]
for row in range(height):
    for column in range(width):
        array[row][column] = random.choice([
            random.random()*1000000,
            ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(randint(1,14))), 
            randint(0, 1000000)])
make_table(array)
for i in range(20):
    row = randint(0, height-1)
    column = randint(0, width-1)
    style = random.choice(['color', 'bold', 'thick_border', 'no_border'])
    if style == 'color':
        set_cell_style(row, column, color=random.choice(['red', 'blue', 'green']))
    elif style == 'bold':
        set_cell_style(row, column, bold=True)
    elif style == 'thick_border':
        set_cell_style(row, column, thick_border=random.choice(['left', 'right', 'top', 'bottom']))
    elif style == 'no_border':
        set_cell_style(row, column, no_border=random.choice(['left', 'right', 'top', 'bottom']))
        
ipt.render()<jupyter_output><empty_output><jupyter_text>thick_border value checking<jupyter_code>array = [[0, 1], [2, 3]]
t = IpyTable(array)
try:
    t.set_cell_style(0, 0, thick_border=True)
except TypeError, error_text:
    print 'Pass (%s)' % error_text
else:
    print 'Fail'
try:
    t.set_cell_style(0, 0, thick_border='left + bottom')
except ValueError, error_text:
    print 'Pass (%s)' % error_text
else:
    print 'Fail'<jupyter_output>Pass (thick_border must be a string of comma separated border names (e.g. "left,right"). Valid border names: set(['top', 'right', 'bottom', 'all', 'left']))<jupyter_text>no_border value checking<jupyter_code>array = [[0, 1], [2, 3]]
t = IpyTable(array)
try:
    t.set_cell_style(0, 0, no_border=True)
except TypeError, error_text:
    print 'Pass (%s)' % error_text
else:
    print 'Fail'
try:
    t.set_cell_style(0, 0, no_border='left + bottom')
except ValueError, error_text:
    print 'Pass (%s)' % error_text
else:
    print 'Fail'<jupyter_output>Pass (no_border must be a string of comma separated border names (e.g. "left,right"). Valid border names: set(['top', 'right', 'bottom', 'all', 'left']))<jupyter_text>Unicode Support<jupyter_code>a=make_table([(u'Unicode Characters: \xe9\u03a0\u03a3', 1),('test2',2)])
a._repr_html_()
a
apply_theme('basic')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1521118721461187, 'fraction_numerical': 0.02054794520547945, 'mean_word_length': 4.930626057529611, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '252260', 'license': 'BSD-3-Clause-Clear', 'n_tokens_mistral': 1300, 'n_tokens_neox': 1260, 'n_words': 318, 'path': 'notebooks/ipy_table-Test.ipynb', 'repo_name': 'epmoyer/ipy_table', 'size': '3504'}