<commit_before># encoding: utf-8
import inspect
from django.test import SimpleTestCase
from dimagi.utils.modules import to_function


class ModulesTests(SimpleTestCase):

    def test_to_function_simple(self):
        fn = to_function('dimagi.utils.modules.to_function', failhard=True)
        self.assertIsNotNone(fn)
        self.assertTrue(inspect.isfunction(fn))

    def test_to_function_unicode(self):
        fn = to_function(u'dimagi.utils.modules.to_function', failhard=True)
        self.assertIsNotNone(fn)
        self.assertTrue(inspect.isfunction(fn))

    def test_to_function_package_level(self):
        fn = to_function(u'dimagi.utils.tests.ModulesTests', failhard=True)
        self.assertIsNotNone(fn)
        self.assertTrue(inspect.isfunction(fn))


<commit_msg>better test asserts<commit_after># encoding: utf-8
from django.test import SimpleTestCase
from dimagi.utils.modules import to_function


class ModulesTests(SimpleTestCase):

    def test_to_function_simple(self):
        fn = to_function('dimagi.utils.modules.to_function', failhard=True)
        self.assertIsNotNone(fn)
        self.assertEqual(fn, to_function)

    def test_to_function_unicode(self):
        fn = to_function(u'dimagi.utils.modules.to_function', failhard=True)
        self.assertIsNotNone(fn)
        self.assertEqual(fn, to_function)

    def test_to_function_package_level(self):
        cls = to_function(u'dimagi.utils.tests.ModulesTests', failhard=True)
        self.assertIsNotNone(cls)
        self.assertEqual(cls, ModulesTests)



{'fraction_non_alphanumeric': 0.0970873786407767, 'fraction_numerical': 0.0012944983818770227, 'mean_word_length': 4.0688524590163935, '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': '1667179', 'n_tokens_mistral': 488, 'n_tokens_neox': 477, 'n_words': 75}