コード例 #1
0
ファイル: test_ext_tools.py プロジェクト: mbentz80/jzigbeercp
    def check_assign_variable_types(self):
        try:
            from numpy.numerix import arange, Float32, Float64
        except:
            # skip this test if numpy.numerix not installed
            return

        import types
        a = arange(10,typecode = Float32)
        b = arange(5,typecode = Float64)
        c = 5
        arg_list = ['a','b','c']
        actual = ext_tools.assign_variable_types(arg_list,locals())
        #desired = {'a':(Float32,1),'b':(Float32,1),'i':(Int32,0)}

        ad = array_converter()
        ad.name, ad.var_type, ad.dims = 'a', Float32, 1
        bd = array_converter()
        bd.name, bd.var_type, bd.dims = 'b', Float64, 1

        cd = c_spec.int_converter()
        cd.name, cd.var_type = 'c', types.IntType
        desired = [ad,bd,cd]
        expr = ""
        print_assert_equal(expr,actual,desired)
コード例 #2
0
ファイル: test_ext_tools.py プロジェクト: apetcho/weave
    def test_assign_variable_types(self):
        a = arange(10, dtype=float32)
        b = arange(5, dtype=float64)
        c = 5
        arg_list = ['a','b','c']
        actual = ext_tools.assign_variable_types(arg_list,locals())

        ad = array_converter()
        ad.name, ad.var_type, ad.dims = 'a', float32, 1
        bd = array_converter()
        bd.name, bd.var_type, bd.dims = 'b', float64, 1

        cd = c_spec.int_converter()
        cd.name, cd.var_type = 'c', types.IntType
        desired = [ad,bd,cd]
        assert_equal(actual,desired)
コード例 #3
0
    def test_assign_variable_types(self):
        a = arange(10, dtype=float32)
        b = arange(5, dtype=float64)
        c = 5
        arg_list = ['a','b','c']
        actual = ext_tools.assign_variable_types(arg_list,locals())

        ad = array_converter()
        ad.name, ad.var_type, ad.dims = 'a', float32, 1
        bd = array_converter()
        bd.name, bd.var_type, bd.dims = 'b', float64, 1

        cd = c_spec.long_converter()
        cd.name, cd.var_type = 'c', int
        desired = [ad,bd,cd]
        assert_equal(actual,desired)
コード例 #4
0
 def test_type_match_string(self):
     s = standard_array_spec.array_converter()
     assert_(not s.type_match('string'))
コード例 #5
0
 def test_type_match_array(self):
     s = standard_array_spec.array_converter()
     assert_(s.type_match(arange(4)))
コード例 #6
0
 def test_type_match_int(self):
     s = standard_array_spec.array_converter()
     assert_(not s.type_match(5))
コード例 #7
0
 def check_type_match_array(self):
     s = standard_array_spec.array_converter()
     assert(s.type_match(arange(4)))
コード例 #8
0
 def check_type_match_int(self):
     s = standard_array_spec.array_converter()
     assert(not s.type_match(5))
コード例 #9
0
 def check_type_match_string(self):
     s = standard_array_spec.array_converter()
     assert( not s.type_match('string') )
コード例 #10
0
 def test_type_match_int(self):
     s = standard_array_spec.array_converter()
     assert_(not s.type_match(5))