<commit_before># Copyright (c) 2011 Resolver Systems Ltd.
# All Rights Reserved
#

try:
    import unittest2 as unittest
except ImportError:
    import unittest

from datetime import timedelta
from mock import call


class ResolverTestMixins(object):
    def assertCalledOnce(self, mock, *args, **kwargs):
        if mock.call_args_list == []:
            self.fail('Not called')
        self.assertEquals(mock.call_args_list, [call(*args, **kwargs)])


    def assert_decorated_with(self, fn, decorator):
        self.assertIn(decorator.__name__, fn.decorated_by)


    def assert_decorated_with(self, fn, decorator):
        self.assertIn(decorator.__name__, fn.decorated_by)


    def assert_datetime_approximately_equals(self, actual, expected, minutes_leeway=10):
        self.assertTrue(
            expected - timedelta(minutes=minutes_leeway) <= actual <= expected + timedelta(minutes=minutes_leeway),
            "%r is not within %s minutes of %r" % (actual, minutes_leeway, expected)
        )



class ResolverTestCase(unittest.TestCase, ResolverTestMixins):
    maxDiff = None



def die(exception=None):
    if exception is None:
        exception = AssertionError('die called')
    def inner_die(*_):
        raise exception
    return inner_die

def is_iterable(seq):
    return hasattr(seq, "__iter__")

<commit_msg>Allow arbitrary kwargs for die utility function.  by: <NAME><commit_after># Copyright (c) 2011 Resolver Systems Ltd.
# All Rights Reserved
#

try:
    import unittest2 as unittest
except ImportError:
    import unittest

from datetime import timedelta
from mock import call


class ResolverTestMixins(object):
    def assertCalledOnce(self, mock, *args, **kwargs):
        if mock.call_args_list == []:
            self.fail('Not called')
        self.assertEquals(mock.call_args_list, [call(*args, **kwargs)])


    def assert_decorated_with(self, fn, decorator):
        self.assertIn(decorator.__name__, fn.decorated_by)


    def assert_decorated_with(self, fn, decorator):
        self.assertIn(decorator.__name__, fn.decorated_by)


    def assert_datetime_approximately_equals(self, actual, expected, minutes_leeway=10):
        self.assertTrue(
            expected - timedelta(minutes=minutes_leeway) <= actual <= expected + timedelta(minutes=minutes_leeway),
            "%r is not within %s minutes of %r" % (actual, minutes_leeway, expected)
        )



class ResolverTestCase(unittest.TestCase, ResolverTestMixins):
    maxDiff = None



def die(exception=None):
    if exception is None:
        exception = AssertionError('die called')
    def inner_die(*_, **__):
        raise exception
    return inner_die

def is_iterable(seq):
    return hasattr(seq, "__iter__")


{'fraction_non_alphanumeric': 0.09819786686281722, 'fraction_numerical': 0.0051489518205222505, 'mean_word_length': 3.6258503401360542, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 4, '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': '631435', 'n_tokens_mistral': 847, 'n_tokens_neox': 804, 'n_words': 208}