<commit_before>from metafunctions.util import node, star
from metafunctions.tests.util import BaseTestCase


class TestUnit(BaseTestCase):
    def test_simple_star(self):
        @node
        def f(*args):
            return args

        cmp = (a | b) | star(f)
        self.assertEqual(cmp('_'), ('_', 'a', 'b'))

    def test_str_repr(self):
        @node
        def f(*args):
            return args

        @star
        @node
        def g(*x):
            return x

        @node
        @star
        def h(*x):
            return x

        cmp = (a | b) | star(f)
        star_a = star(a)

        self.assertEqual(str(cmp), '(a | b | star(f))')
        self.assertEqual(str(star_a), 'star(a)')
        self.assertEqual(str(g), 'star(g)')
        self.assertEqual(str(h), 'h')

@node<commit_msg>Add more expected star str<commit_after>from metafunctions.util import node, star
from metafunctions.tests.util import BaseTestCase


class TestUnit(BaseTestCase):
    def test_simple_star(self):
        @node
        def f(*args):
            return args

        cmp = (a | b) | star(f)
        self.assertEqual(cmp('_'), ('_', 'a', 'b'))

    def test_str_repr(self):
        @node
        def f(*args):
            return args

        @star
        @node
        def g(*x):
            return x

        @node
        @star
        def h(*x):
            return x

        cmp = (a | b) | star(f)
        star_a = star(a)
        merge_star = star(a+b)
        chain_star = star(a|b)

        self.assertEqual(str(cmp), '(a | b | star(f))')
        self.assertEqual(str(star_a), 'star(a)')
        self.assertEqual(str(g), 'star(g)')
        self.assertEqual(str(h), 'h')
        self.assertEqual(str(merge_star), 'star(a + b)')
        self.assertEqual(str(h), 'star(a | b)')



@node
{'fraction_non_alphanumeric': 0.1457174638487208, 'fraction_numerical': 0.0, 'mean_word_length': 1.8600953895071541, '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': '3288663', 'n_tokens_mistral': 601, 'n_tokens_neox': 588, 'n_words': 135}