<commit_before>import blaze
from blaze import datashape
import numpy as np
import unittest

class TestDatashapeCreation(unittest.TestCase):

    def test_raise_on_bad_input(self):
        # Make sure it raises exceptions on a few nonsense inputs
        self.assertRaises(TypeError, blaze.dshape, None)
        self.assertRaises(TypeError, blaze.dshape, lambda x: x+1)
        # Check issue 11
        self.assertRaises(datashape.DatashapeSyntaxError, blaze.dshape, '1,')

    def test_atom_shapes(self):
        self.assertEqual(blaze.dshape('bool'), datashape.bool_)
        self.assertEqual(blaze.dshape('int8'), datashape.int8)
        self.assertEqual(blaze.dshape('int16'), datashape.int16)
        self.assertEqual(blaze.dshape('int32'), datashape.int32)
        self.assertEqual(blaze.dshape('int64'), datashape.int64)
        self.assertEqual(blaze.dshape('uint8'), datashape.uint8)
        self.assertEqual(blaze.dshape('uint16'), datashape.uint16)
        self.assertEqual(blaze.dshape('uint32'), datashape.uint32)
        self.assertEqual(blaze.dshape('uint64'), datashape.uint64)
        self.assertEqual(blaze.dshape('float32'), datashape.float32)
        self.assertEqual(blaze.dshape('float64'), datashape.float64)
        self.assertEqual(blaze.dshape('complex64'), datashape.complex64)
        self.assertEqual(blaze.dshape('complex128'), datashape.complex128)
        self.assertEqual(blaze.dshape("string"), blaze.datashape.string)
        self.assertEqual(blaze.dshape("json"), blaze.datashape.json)<commit_msg>Fix exception path<commit_after>import blaze
from blaze import datashape
import numpy as np
import unittest

class TestDatashapeCreation(unittest.TestCase):

    def test_raise_on_bad_input(self):
        # Make sure it raises exceptions on a few nonsense inputs
        self.assertRaises(TypeError, blaze.dshape, None)
        self.assertRaises(TypeError, blaze.dshape, lambda x: x+1)
        # Check issue 11
        self.assertRaises(datashape.parser.DatashapeSyntaxError, blaze.dshape, '1,')

    def test_atom_shapes(self):
        self.assertEqual(blaze.dshape('bool'), datashape.bool_)
        self.assertEqual(blaze.dshape('int8'), datashape.int8)
        self.assertEqual(blaze.dshape('int16'), datashape.int16)
        self.assertEqual(blaze.dshape('int32'), datashape.int32)
        self.assertEqual(blaze.dshape('int64'), datashape.int64)
        self.assertEqual(blaze.dshape('uint8'), datashape.uint8)
        self.assertEqual(blaze.dshape('uint16'), datashape.uint16)
        self.assertEqual(blaze.dshape('uint32'), datashape.uint32)
        self.assertEqual(blaze.dshape('uint64'), datashape.uint64)
        self.assertEqual(blaze.dshape('float32'), datashape.float32)
        self.assertEqual(blaze.dshape('float64'), datashape.float64)
        self.assertEqual(blaze.dshape('complex64'), datashape.complex64)
        self.assertEqual(blaze.dshape('complex128'), datashape.complex128)
        self.assertEqual(blaze.dshape("string"), blaze.datashape.string)
        self.assertEqual(blaze.dshape("json"), blaze.datashape.json)
{'fraction_non_alphanumeric': 0.12451235370611183, 'fraction_numerical': 0.032509752925877766, 'mean_word_length': 4.1112956810631225, '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': '3496600', 'n_tokens_mistral': 1035, 'n_tokens_neox': 981, 'n_words': 145}