<commit_before>from regression import *

__doc__ = """
>>> t = Table(bill)
>>> print pretty_html(t.render())
<tbody>
 <tr>
  <td class="table_label">
   Email:
  </td>
  <td class="table_field">
   <EMAIL>
  </td>
 </tr>
 <tr>
  <td class="table_label">
   Password:
  </td>
  <td class="table_field">
   <PASSWORD>
  </td>
 </tr>
 <tr>
  <td class="table_label">
   Name:
  </td>
  <td class="table_field">
   Bill
  </td>
 </tr>
 <tr>
  <td class="table_label">
   Orders:
  </td>
  <td class="table_field">
   Quantity: 10
  </td>
 </tr>
</tbody>

>>> t = TableCollection(User, [bill])
>>> print pretty_html(t.render().strip())
<thead>
 <tr>
  <th>
   Email:
  </th>
  <th>
   Password:
  </th>
  <th>
   Name:
  </th>
  <th>
   Orders:
  </th>
 </tr>
</thead>
<tbody>
 <tr>
  <td>
   <EMAIL>
  </td>
  <td>
   1234
  </td>
  <td>
   Bill
  </td>
  <td>
   Quantity: 10
  </td>
 </tr>
</tbody>
"""

if __name__ == '__main__':
    import doctest
    doctest.testmod()
<commit_msg>add test for value=callable feature<commit_after>from regression import *

__doc__ = """
>>> t = Table(bill)
>>> print pretty_html(t.render())
<tbody>
 <tr>
  <td class="table_label">
   Email:
  </td>
  <td class="table_field">
   <EMAIL>
  </td>
 </tr>
 <tr>
  <td class="table_label">
   Password:
  </td>
  <td class="table_field">
   <PASSWORD>
  </td>
 </tr>
 <tr>
  <td class="table_label">
   Name:
  </td>
  <td class="table_field">
   Bill
  </td>
 </tr>
 <tr>
  <td class="table_label">
   Orders:
  </td>
  <td class="table_field">
   Quantity: 10
  </td>
 </tr>
</tbody>

>>> t = TableCollection(User, [bill])
>>> print pretty_html(t.render().strip())
<thead>
 <tr>
  <th>
   Email:
  </th>
  <th>
   Password:
  </th>
  <th>
   Name:
  </th>
  <th>
   Orders:
  </th>
 </tr>
</thead>
<tbody>
 <tr>
  <td>
   <EMAIL>
  </td>
  <td>
   1234
  </td>
  <td>
   Bill
  </td>
  <td>
   Quantity: 10
  </td>
 </tr>
</tbody>

>>> t = TableCollection(User, [bill, john])
>>> t.add(Field('link', type=types.String, value=lambda item: '<a href=%d>link</a>' % item.id))
>>> print pretty_html(t.render().strip())
<thead>
 <tr>
  <th>
   Email:
  </th>
  <th>
   Password:
  </th>
  <th>
   Name:
  </th>
  <th>
   Orders:
  </th>
  <th>
   Link:
  </th>
 </tr>
</thead>
<tbody>
 <tr>
  <td>
   <EMAIL>
  </td>
  <td>
   1234
  </td>
  <td>
   Bill
  </td>
  <td>
   Quantity: 10
  </td>
  <td>
   <a href="1">
    link
   </a>
  </td>
 </tr>
 <tr>
  <td>
   <EMAIL>
  </td>
  <td>
   5678
  </td>
  <td>
   John
  </td>
  <td>
   Quantity: 5
  </td>
  <td>
   <a href="2">
    link
   </a>
  </td>
 </tr>
</tbody>
"""

if __name__ == '__main__':
    import doctest
    doctest.testmod()

{'fraction_non_alphanumeric': 0.2292134831460674, 'fraction_numerical': 0.010861423220973783, 'mean_word_length': 2.424358974358974, 'pattern_counts': {'":': 0, '<': 157, '<?xml version=': 0, '>': 190, '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}}
{'dir': 'git-commits-cleaned', 'id': '6793034', 'n_tokens_mistral': 1271, 'n_tokens_neox': 1222, 'n_words': 270}