<commit_before>from unittest import expectedFailure

from ..utils import TranspileTestCase


class WhileLoopTests(TranspileTestCase):
    def test_while(self):
        self.assertCodeExecution("""
            i = 0
            total = 0
            while i < 10:
                i += 1
                total += i
                print(i, total)
            print('Done.')
            """)

    def test_break(self):
        self.assertCodeExecution(
            code="""
                i = 0
                while i < 10:
                    i = i + 1
                    print(i, i % 5)
                    if i % 5 == 0:
                        break
                    print("after")
                print("Done")
            """)

    def test_continue(self):
        self.assertCodeExecution(
            code="""
                i = 0
                while i < 10:
                    i = i + 1
                    print(i, i % 5)
                    if i % 5 == 0:
                        continue
                    print("after")
                print("Done")
            """)

    def test_nested(self):
        self.assertCodeExecution(
            code="""
                i = 1
                j = 10
                while i < j:
                    k = 0
                    while k < i:
                        print(i, j)
                        k = k + 1
                    print("While done")
                    i = i + 1
                print("Done")
            """)

    def test_while_forever(self):
        self.assertCodeExecution(
            code="""
                i = 0
                while 1:
                    print("Loop", i)
                    i = i + 1
                    if i == 10:
                        break
                print("Done")
            """)

    @expectedFailure
    def test_while_forever_with_if_not(self):
        self.assertCodeExecution(
            code="""
                i = 0
                while 1:
                    print("Loop", i)
                    i = i + 1
                    if not i < 10:
                        break
                print("Done")
            """)

    @expectedFailure
    def test_while_else(self):
        self.assertCodeExecution(
            code="""
                i = 1
                j = 4
                while i < j:
                    print(i)
                    i = i + 1
                else:
                    print("Else")
                print("Done")
            """)

    @expectedFailure<commit_msg>missed with last checkin<commit_after>from unittest import expectedFailure

from ..utils import TranspileTestCase


class WhileLoopTests(TranspileTestCase):
    def test_while(self):
        self.assertCodeExecution("""
            i = 0
            total = 0
            while i < 10:
                i += 1
                total += i
                print(i, total)
            print('Done.')
            """)

    def test_break(self):
        self.assertCodeExecution(
            code="""
                i = 0
                while i < 10:
                    i = i + 1
                    print(i, i % 5)
                    if i % 5 == 0:
                        break
                    print("after")
                print("Done")
            """)

    def test_continue(self):
        self.assertCodeExecution(
            code="""
                i = 0
                while i < 10:
                    i = i + 1
                    print(i, i % 5)
                    if i % 5 == 0:
                        continue
                    print("after")
                print("Done")
            """)

    def test_nested(self):
        self.assertCodeExecution(
            code="""
                i = 1
                j = 10
                while i < j:
                    k = 0
                    while k < i:
                        print(i, j)
                        k = k + 1
                    print("While done")
                    i = i + 1
                print("Done")
            """)

    def test_while_forever(self):
        self.assertCodeExecution(
            code="""
                i = 0
                while 1:
                    print("Loop", i)
                    i = i + 1
                    if i == 10:
                        break
                print("Done")
            """)

    @expectedFailure
    def test_while_forever_with_if_not(self):
        self.assertCodeExecution(
            code="""
                i = 0
                while 1:
                    print("Loop", i)
                    i = i + 1
                    if not i < 10:
                        break
                print("Done")
            """)

    @expectedFailure
    def test_while_not_forever(self):
        self.assertCodeExecution(
            code="""
                while not 0:
                    print("Loop")
                    break
                print("Done")
            """)

    @expectedFailure
    def test_while_else(self):
        self.assertCodeExecution(
            code="""
                i = 1
                j = 4
                while i < j:
                    print(i)
                    i = i + 1
                else:
                    print("Else")
                print("Done")
            """)

    @expectedFailure
{'fraction_non_alphanumeric': 0.09037955655768508, 'fraction_numerical': 0.01446824502066892, 'mean_word_length': 0.7327473958333334, 'pattern_counts': {'":': 0, '<': 17, '<?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': '6621969', 'n_tokens_mistral': 1433, 'n_tokens_neox': 1226, 'n_words': 325}