<commit_before># -*- coding: utf-8 -*-
"""
@author: <NAME> <<EMAIL>>
"""
import unittest
from copy import copy

from tempy.widgets import TempyTable, TempyList, TempyPage
from tempy.tags import Table, Tr, Td, Ul, Ol, Li, Html, Head, Body, Thead, Tfoot

from tempy.exceptions import WidgetDataError, WidgetError


class TestTempyTable(unittest.TestCase):

    def setUp(self):
        self.data = [[x*y for x in range(1, 11)] for y in range(15)]

    def verify_content(self, table):
        # Check table content
        self.assertTrue(0 in table.body[0][4])
        self.assertTrue(1 in table.body[1][0])
        self.assertTrue(2 in table.body[1][1])
        self.assertTrue(16 in table.body[8][1])

    def test_empty_creation(self):
        table = TempyTable()
        self.assertFalse(table.body)
        # Future non-regression, TempyTable should remain a Table Tag
        self.assertIsInstance(table, Table)

    def test_skeleton_creation(self):
        table = TempyTable(rows=15, cols=10)
        self.assertTrue(table.body)
        # Check table sizes
        self.assertEqual(len(table.body), 15)
        self.assertEqual(len(table.body[0]), 10)

    def test_caption(self):
        table = TempyTable(caption='Test Table')
        self.assertTrue('Test Table' in table.caption)

    def test_init_from_data(self):
        table = TempyTable(data=self.data)
        self.assertEqual(len(table.body), 15)
        self.assertEqual(len(table.body[0]), 10)
        self.verify_content(table)

    def test_init_from_data_full(self):
        table = TempyTable(data=self.data, head=True, foot=True)
        self.assertEqual(len(table.body), 13)
        self.assertIsInstance(table.header, Thead)
        self.assertIsInstance(table.footer, Tfoot)

    def test_populate(self):
        # test no_resize
        table = TempyTable().populate(self.data)
        # Check table sizes
        self.assertEqual(len(table.body), 15)<commit_msg>Update test_widgets.py<commit_after># -*- coding: utf-8 -*-
"""
@author: <NAME> <<EMAIL>>
"""
import unittest
from copy import copy

from tempy.widgets import TempyTable, TempyList, TempyPage
from tempy.tags import Table, Tr, Td, Ul, Ol, Li, Html, Head, Body, Thead, Tfoot

from tempy.exceptions import WidgetDataError, WidgetError


class TestTempyTable(unittest.TestCase):

    def setUp(self):
        self.data = [[x*y for x in range(1, 11)] for y in range(15)]

    def verify_content(self, table):
        # Check table content
        self.assertTrue(0 in table.body[0][4])
        self.assertTrue(1 in table.body[1][0])
        self.assertTrue(2 in table.body[1][1])
        self.assertTrue(16 in table.body[8][1])

    def test_empty_creation(self):
        table = TempyTable()
        self.assertFalse(table.body.childs)
        self.assertTrue(table.body)
        # Future non-regression, TempyTable should remain a Table Tag
        self.assertIsInstance(table, Table)

    def test_skeleton_creation(self):
        table = TempyTable(rows=15, cols=10)
        self.assertTrue(table.body)
        # Check table sizes
        self.assertEqual(len(table.body), 15)
        self.assertEqual(len(table.body[0]), 10)

    def test_caption(self):
        table = TempyTable(caption='Test Table')
        self.assertTrue('Test Table' in table.caption)

    def test_init_from_data(self):
        table = TempyTable(data=self.data)
        self.assertEqual(len(table.body), 15)
        self.assertEqual(len(table.body[0]), 10)
        self.verify_content(table)

    def test_init_from_data_full(self):
        table = TempyTable(data=self.data, head=True, foot=True)
        self.assertEqual(len(table.body), 13)
        self.assertIsInstance(table.header, Thead)
        self.assertIsInstance(table.footer, Tfoot)

    def test_populate(self):
        # test no_resize
        table = TempyTable().populate(self.data)
        # Check table sizes
        self.assertEqual(len(table.body), 15)
{'fraction_non_alphanumeric': 0.1206896551724138, 'fraction_numerical': 0.018762677484787018, 'mean_word_length': 3.071207430340557, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1963991', 'n_tokens_mistral': 1290, 'n_tokens_neox': 1242, 'n_words': 279}