<commit_before>from blaze.module.parser import mread

#------------------------------------------------------------------------

dummy = """
interface Dummy t:
    fun foo :: (t,a) -> a
    fun bar :: (t,a,b) -> (a,b)
    fun baz :: t -> t
    fun pop :: t -> !dirty t
"""

dummy_expected = \
{'interfaces': {'Dummy': {'defs': {'bar': {'sig': {'cod': ['a', 'b'], 'dom': ['t', ['a', 'b']]}},
          'baz': {'sig': {'cod': 't', 'dom': 't'}},
          'foo': {'sig': {'cod': 'a', 'dom': ['t', 'a']}},
          'pop': {'sig': {'cod': ('!', 'dirty'), 'dom': 't'}}},
 'name': 'Dummy',
 'params': ('t',)}}}

#------------------------------------------------------------------------

arith = """
interface Arith t:
    fun add      :: (t,t) -> t
    fun multiply :: (t,t) -> t
    fun subtract :: (t,t) -> t
    fun divide   :: (t,t) -> t
    fun mod      :: (t,t) -> t
    fun power    :: (t,t) -> t
"""

arith_expected = \
{'interfaces': {'Arith': {'defs': {'add': {'sig': {'cod': 't', 'dom': ['t', 't']}},
          'divide': {'sig': {'cod': 't', 'dom': ['t', 't']}},
          'mod': {'sig': {'cod': 't', 'dom': ['t', 't']}},
          'multiply': {'sig': {'cod': 't', 'dom': ['t', 't']}},
          'power': {'sig': {'cod': 't', 'dom': ['t', 't']}},
          'subtract': {'sig': {'cod': 't', 'dom': ['t', 't']}}},
 'name': 'Arith',
 'params': ('t',)}}}

#------------------------------------------------------------------------

def test_dummy():
    print mread(dummy)

def test_arith():
    print mread(arith)
<commit_msg>Regression test for blaze module.<commit_after>import os

import blaze
from blaze.module.parser import mopen, mread

#------------------------------------------------------------------------
# Dummy Modules
#------------------------------------------------------------------------

dummy = """
interface Dummy t:
    fun foo :: (t,a) -> a
    fun bar :: (t,a,b) -> (a,b)
    fun baz :: t -> t
    fun pop :: t -> !dirty t
"""

dummy_expected = \
{'interfaces': {'Dummy': {'defs': {'bar': {'sig': {'cod': ['a', 'b'], 'dom': ['t', ['a', 'b']]}},
          'baz': {'sig': {'cod': 't', 'dom': 't'}},
          'foo': {'sig': {'cod': 'a', 'dom': ['t', 'a']}},
          'pop': {'sig': {'cod': ('!', 'dirty'), 'dom': 't'}}},
 'name': 'Dummy',
 'params': ('t',)}}}

#------------------------------------------------------------------------

arith = """
interface Arith t:
    fun add      :: (t,t) -> t
    fun multiply :: (t,t) -> t
    fun subtract :: (t,t) -> t
    fun divide   :: (t,t) -> t
    fun mod      :: (t,t) -> t
    fun power    :: (t,t) -> t
"""

arith_expected = \
{'interfaces': {'Arith': {'defs': {'add': {'sig': {'cod': 't', 'dom': ['t', 't']}},
          'divide': {'sig': {'cod': 't', 'dom': ['t', 't']}},
          'mod': {'sig': {'cod': 't', 'dom': ['t', 't']}},
          'multiply': {'sig': {'cod': 't', 'dom': ['t', 't']}},
          'power': {'sig': {'cod': 't', 'dom': ['t', 't']}},
          'subtract': {'sig': {'cod': 't', 'dom': ['t', 't']}}},
 'name': 'Arith',
 'params': ('t',)}}}

#------------------------------------------------------------------------

def test_dummy():
    print mread(dummy)

def test_arith():
    print mread(arith)

#------------------------------------------------------------------------
# Blaze Core
#------------------------------------------------------------------------

def test_blaze_core():
    path = os.path.dirname(blaze.__file__)
    blazecore = os.path.join(path, 'module', 'blaze.mod')

    mopen(blazecore)

{'fraction_non_alphanumeric': 0.4474885844748858, 'fraction_numerical': 0.0, 'mean_word_length': 1.4982181040627227, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, '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': '1329535', 'n_tokens_mistral': 1167, 'n_tokens_neox': 1163, 'n_words': 316}