<commit_before>from unittest import TestCase, main

from fastpt import v2 as fpt

class BasicTest(TestCase):

    def setUp(self):
        @fpt.Template
        class tpl:
            @fpt.expose
            def __call__():
                yield 'Hello,'
                yield name
                yield '\n'
        self.tpl = tpl

    def test_basic(self):
        rsp = self.tpl(fpt.Context(name='Rick')).render()
        assert rsp == 'Hello,Rick\n', rsp

class FunctionTest(TestCase):
    
    def setUp(self):
        @fpt.Template
        class tpl:
            @fpt.expose
            def evenness(n):
                if n % 2 == 0: yield 'even'
                else: yield 'odd'

            @fpt.expose
            def __call__():
                for i in range(2):
                    yield i
                    yield ' is '
                    yield evenness(i)
                    yield '\n'
        self.tpl = tpl

    def test_basic(self):
        rsp = self.tpl(fpt.Context(name='Rick')).render()
        assert rsp == '0 is even\n1 is odd\n', rsp

class ImportTest(TestCase):
    def setUp(self):
        @fpt.Template
        class lib:
            @fpt.expose
            def evenness(n):
                if n % 2 == 0: yield 'even'
                else: yield 'odd'
        @fpt.Template
        class tpl:
            @fpt.expose
            def __call__():
                simple_function = lib(_frame[0])
                for i in range(2):
                    yield i
                    yield ' is '
                    yield simple_function.evenness(i)
                    yield '\n'
        self.tpl = tpl

    def test_import(self):<commit_msg>Import test works<commit_after>from unittest import TestCase, main

from fastpt import v2 as fpt

class BasicTest(TestCase):

    def setUp(self):
        @fpt.Template
        class tpl:
            @fpt.expose
            def __call__():
                yield 'Hello,'
                yield name
                yield '\n'
        self.tpl = tpl

    def test_basic(self):
        rsp = self.tpl(fpt.Context(name='Rick')).render()
        assert rsp == 'Hello,Rick\n', rsp

class FunctionTest(TestCase):
    
    def setUp(self):
        @fpt.Template
        class tpl:
            @fpt.expose
            def evenness(n):
                if n % 2 == 0: yield 'even'
                else: yield 'odd'
            @fpt.expose
            def __call__():
                for i in range(2):
                    yield i
                    yield ' is '
                    yield evenness(i)
                    yield '\n'
        self.tpl = tpl

    def test_basic(self):
        rsp = self.tpl(fpt.Context(name='Rick')).render()
        assert rsp == '0 is even\n1 is odd\n', rsp

class ImportTest(TestCase):
    def setUp(self):
        @fpt.Template
        class lib:
            @fpt.expose
            def evenness(n):
                if n % 2 == 0: yield 'even'
                else: yield 'odd'
        @fpt.Template
        class tpl:
            @fpt.expose
            def __call__():
                simple_function = lib(_frame[0])
                for i in range(2):
                    yield i
                    yield ' is '
                    yield simple_function.evenness(i)
                    yield evenness(i)
                    yield '\n'
        self.tpl = tpl

    def test_import(self):
{'fraction_non_alphanumeric': 0.09748892171344166, 'fraction_numerical': 0.005908419497784343, 'mean_word_length': 1.1760925449871464, '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': '5570307', 'n_tokens_mistral': 1013, 'n_tokens_neox': 966, 'n_words': 259}