<commit_before>from pyxform.tests_v1.pyxform_test_case import PyxformTestCase


class TestLoop(PyxformTestCase):
    def test_loop(self):
        self.assertPyxformXform(
            name="test_loop",
            md="""
                | survey |              |           |                |        |
                |        |     type     |    name   | bind:relevant  | label  |
                |        | begin repeat | for-block |                | Oh HAI |
                |        | string       | input     | (${done}='no') | HI HI  |
                |        | string       | done      |                | DONE?  |
                |        | end repeat   |           |                |        |
                """,
            instance__contains=[
                '<for-block jr:template="">',
                '</for-block>',
                ],
            model__contains=[
                """<bind nodeset="/test_loop/for-block/input" """
                """relevant="( /test_loop/for-block/done ='no')" """
                """type="string"/>"""
                ],
            xml__contains=[
                '<group ref="/test_loop/for-block">',
                '<label>Oh HAI</label>',
                '</group>',
            ],
        )<commit_msg>Update test_for_loop to use relative path<commit_after>from pyxform.tests_v1.pyxform_test_case import PyxformTestCase


class TestLoop(PyxformTestCase):
    def test_loop(self):
        self.assertPyxformXform(
            name="test_loop",
            md="""
                | survey |              |           |                |        |
                |        |     type     |    name   | bind:relevant  | label  |
                |        | begin repeat | for-block |                | Oh HAI |
                |        | string       | input     | (${done}='no') | HI HI  |
                |        | string       | done      |                | DONE?  |
                |        | end repeat   |           |                |        |
                """,
            instance__contains=[
                '<for-block jr:template="">',
                '</for-block>',
                ],
            model__contains=[
                """<bind nodeset="/test_loop/for-block/input" """
                """relevant="( current()/../done ='no')" """
                """type="string"/>"""
                ],
            xml__contains=[
                '<group ref="/test_loop/for-block">',
                '<label>Oh HAI</label>',
                '</group>',
            ],
        )
{'fraction_non_alphanumeric': 0.1346456692913386, 'fraction_numerical': 0.0007874015748031496, 'mean_word_length': 0.9191842900302115, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '952307', 'n_tokens_mistral': 683, 'n_tokens_neox': 649, 'n_words': 101}