<commit_before>import unittest
import sys
import ctypes

import blaze
from blaze.bkernel import BlazeFuncDeprecated
from blaze.datashape import double, complex128 as c128
from blaze.datadescriptor import (execute_expr_single, dd_as_py)
from blaze.py2help import izip

if ctypes.sizeof(ctypes.c_void_p) == 4:
    c_intptr_t = ctypes.c_int32
else:
    c_intptr_t = ctypes.c_int64

class TestBlazeKernelTreeCKernel(unittest.TestCase):
    def test_binary_kerneltree_single(self):
        # Create some simple blaze funcs, using Numba
        def _add(a,b):
            return a + b

        def _mul(a,b):
            return a * b
        add = BlazeFuncDeprecated('add',[('f8(f8,f8)', _add),
                               ('c16(c16,c16)', _add)])
        mul = BlazeFuncDeprecated('mul', {(double,)*3: _mul,
                                (c128,)*3: _mul})
        # Array data and expression
        af = blaze.array([[1,2,3], [4,5,6]],dshape=double)
        bf = blaze.array([2,3,4],dshape=double)
        cf = add(af,bf)
        df = mul(cf,cf)
        ubck = df._data.kerneltree.make_unbound_ckernel(strided=False)

        # Allocate the result, and run the kernel across the arguments
        result = blaze.zeros(df.dshape)
        args = [arg.arr._data for arg in df._data.args]
        ck = ubck.bind(result._data, args)
        execute_expr_single(result._data, args,<commit_msg>Update kerneltree ckernel eval test<commit_after>import unittest
import sys
import ctypes

import blaze
from blaze.bkernel import BlazeFuncDeprecated
from blaze.datashape import double, complex128 as c128
from blaze.datadescriptor import (execute_expr_single, dd_as_py)
from blaze.py2help import izip

if ctypes.sizeof(ctypes.c_void_p) == 4:
    c_intptr_t = ctypes.c_int32
else:
    c_intptr_t = ctypes.c_int64

class TestBlazeKernelTreeCKernel(unittest.TestCase):
    def test_binary_kerneltree_single(self):
        # Create some simple blaze funcs, using Numba
        def _add(a,b):
            return a + b

        def _mul(a,b):
            return a * b
        add = BlazeFuncDeprecated('add',[('f8(f8,f8)', _add),
                               ('c16(c16,c16)', _add)])
        mul = BlazeFuncDeprecated('mul', {(double,)*3: _mul,
                                (c128,)*3: _mul})
        # Array data and expression
        af = blaze.array([[1,2,3], [4,5,6]],dshape=double)
        bf = blaze.array([2,3,4],dshape=double)
        cf = add(af,bf)
        df = mul(cf,cf)
        ubck = df._data.kerneltree.make_unbound_ckernel(strided=False)

        # Allocate the result, and run the kernel across the arguments
        result = blaze.zeros(df.dshape)
        args = [arr._data for arr in df._data.args]
        ck = ubck.bind(result._data, args)
        execute_expr_single(result._data, args,
{'fraction_non_alphanumeric': 0.10908440629470673, 'fraction_numerical': 0.02503576537911302, 'mean_word_length': 2.680263157894737, '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': '7315567', 'n_tokens_mistral': 993, 'n_tokens_neox': 949, 'n_words': 215}