<commit_before>'''
The chai test class.
'''

try:
  import unittest2
  unittest = unittest2
except ImportError:
  import unittest

from exception import *
from mock import Mock
from stub import stub
from collections import deque
from comparators import *

class Chai(unittest.TestCase):
  '''
  Base class for all tests
  '''

  # Load in the comparators
  equals = Equals
  instance_of = InstanceOf
  any_of = Any
  all_of = All
  not_of = Not

  def setUp(self):
    super(Chai,self).setUp()

    # Setup stub tracking
    self.stubs = deque()

    # Setup mock tracking
    self.mocks = deque()
    

  # Because cAmElCaSe sucks
  setup = setUp

  def tearDown(self):
    super(Chai,self).tearDown()

    # Docs insist that this will be called no matter what happens in runTest(),
    # so this should be a safe spot to unstub everything
    exception = None
    while len(self.stubs):
        stub = self.stubs.popleft()<commit_msg>Alias all the assertCamelCase methods to assert_sane_case<commit_after>'''
The chai test class.
'''

try:
  import unittest2
  unittest = unittest2
except ImportError:
  import unittest

import re

from exception import *
from mock import Mock
from stub import stub
from collections import deque
from comparators import *

class Chai(unittest.TestCase):
  '''
  Base class for all tests
  '''

  # When initializing, alias all the cAmElCaSe methods to more helpful ones
  def __init__(self, *args, **kwargs):
    super(Chai,self).__init__(*args, **kwargs)
    for attr in dir(self):
      if attr.startswith('assert') and attr!='assert_':
        pieces = ['assert'] + re.findall('[A-Z][a-z]+', attr[5:])
        name = '_'.join( [s.lower() for s in pieces] )
        setattr(self, name, getattr(self,attr))

  # Load in the comparators
  equals = Equals
  instance_of = InstanceOf
  any_of = Any
  all_of = All
  not_of = Not

  def setUp(self):
    super(Chai,self).setUp()

    # Setup stub tracking
    self.stubs = deque()

    # Setup mock tracking
    self.mocks = deque()
    

  # Because cAmElCaSe sucks
  setup = setUp

  def tearDown(self):
    super(Chai,self).tearDown()

    # Docs insist that this will be called no matter what happens in runTest(),
    # so this should be a safe spot to unstub everything
    exception = None
    while len(self.stubs):
        stub = self.stubs.popleft()
{'fraction_non_alphanumeric': 0.09607173356105893, 'fraction_numerical': 0.002134927412467976, 'mean_word_length': 3.1839285714285714, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7157449', 'n_tokens_mistral': 765, 'n_tokens_neox': 752, 'n_words': 252}