Exemplo n.º 1
0
 def test_order(self):
     self.assertEqual(
         tutil.transform_exp_sources(od([('func', 'abc'), ('func2', 'abc')])),
         { 'a': ['func', 'func2'],
           'b': ['func', 'func2'],
           'c': ['func', 'func2'],
           '+depths': {'func': 0, 'func2': 1} })
Exemplo n.º 2
0
 def test_copy_depth(self):
     def f1():
         raise NotImplementedError
     self.assertEqual(
         tutil.transform_exp_sources(
             {'+depths': {f1: 0, 'f2': 0}, f1: 'a', 'f2': 'b'}),
         { 'a': ['f1'] , 'b': ['f2'], '+depths': {'f1': 0, 'f2': 0} })
Exemplo n.º 3
0
 def test_func_name(self):
     def f1():
         raise NotImplementedError
     self.assertEqual(
         tutil.transform_exp_sources({f1: 'abc', 'func2': 'def'}),
         { 'a': ['f1'], 'b': ['f1'], 'c': ['f1'],
           'd': ['func2'], 'e': ['func2'], 'f': ['func2'],
           '+depths': {'f1': 0, 'func2': 1} })
Exemplo n.º 4
0
 def test_implicit_func(self):
     def f1():
         raise NotImplementedError
     self.assertEqual(
         tutil.transform_exp_sources({0: 'abc', 'func2': 'def'}, subject=f1),
         { 'a': ['f1'], 'b': ['f1'], 'c': ['f1'],
           'd': ['func2'], 'e': ['func2'], 'f': ['func2'],
           '+depths': {'f1': 0, 'func2': 1} })
Exemplo n.º 5
0
 def test_order(self):
     self.assertEqual(
         tutil.transform_exp_sources(od([('func', 'abc'),
                                         ('func2', 'abc')])), {
                                             'a': ['func', 'func2'],
                                             'b': ['func', 'func2'],
                                             'c': ['func', 'func2'],
                                             '+depths': {
                                                 'func': 0,
                                                 'func2': 1
                                             }
                                         })
Exemplo n.º 6
0
 def test_conv(self):
     self.assertEqual(
         tutil.transform_exp_sources({
             1: 'abc',
             2: 'def'
         }), {
             'a': ['_1'],
             'b': ['_1'],
             'c': ['_1'],
             'd': ['_2'],
             'e': ['_2'],
             'f': ['_2'],
             '+depths': {
                 '_1': 0,
                 '_2': 1
             }
         })
Exemplo n.º 7
0
 def test_tf(self):
     self.assertEqual(
         tutil.transform_exp_sources({
             'func': 'abc',
             'func2': 'def'
         }), {
             'a': ['func'],
             'b': ['func'],
             'c': ['func'],
             'd': ['func2'],
             'e': ['func2'],
             'f': ['func2'],
             '+depths': {
                 'func': 0,
                 'func2': 1
             }
         })
Exemplo n.º 8
0
    def test_depth_list(self):
        def f1():
            raise NotImplementedError

        self.assertEqual(
            tutil.transform_exp_sources({
                '+depths': ['f2', f1],
                f1: 'a',
                'f2': 'b'
            }), {
                'a': ['f1'],
                'b': ['f2'],
                '+depths': {
                    'f2': 0,
                    'f1': 1
                }
            })
Exemplo n.º 9
0
 def test_implicit(self):
     self.assertEqual(
         tutil.transform_exp_sources({
             0: 'abc',
             'func1': 'def'
         },
                                     subject='func2'), {
                                         'a': ['func2'],
                                         'b': ['func2'],
                                         'c': ['func2'],
                                         'd': ['func1'],
                                         'e': ['func1'],
                                         'f': ['func1'],
                                         '+depths': {
                                             'func2': 0,
                                             'func1': 1
                                         }
                                     })
Exemplo n.º 10
0
    def test_implicit_func(self):
        def f1():
            raise NotImplementedError

        self.assertEqual(
            tutil.transform_exp_sources({
                0: 'abc',
                'func2': 'def'
            }, subject=f1), {
                'a': ['f1'],
                'b': ['f1'],
                'c': ['f1'],
                'd': ['func2'],
                'e': ['func2'],
                'f': ['func2'],
                '+depths': {
                    'f1': 0,
                    'func2': 1
                }
            })
Exemplo n.º 11
0
    def test_func_name(self):
        def f1():
            raise NotImplementedError

        self.assertEqual(
            tutil.transform_exp_sources({
                f1: 'abc',
                'func2': 'def'
            }), {
                'a': ['f1'],
                'b': ['f1'],
                'c': ['f1'],
                'd': ['func2'],
                'e': ['func2'],
                'f': ['func2'],
                '+depths': {
                    'f1': 0,
                    'func2': 1
                }
            })
Exemplo n.º 12
0
 def test_empty(self):
     self.assertEqual(tutil.transform_exp_sources({}), {'+depths': {}})
Exemplo n.º 13
0
 def test_empty(self):
     self.assertEqual(tutil.transform_exp_sources({}), {'+depths': {}})
Exemplo n.º 14
0
 def test_implicit_missing(self):
     with self.assertRaises(ValueError):
         tutil.transform_exp_sources({0: 'abc', 'func2': 'def'})
Exemplo n.º 15
0
 def test_conv(self):
     self.assertEqual(
         tutil.transform_exp_sources({1: 'abc', 2: 'def'}),
         { 'a': ['_1'], 'b': ['_1'], 'c': ['_1'],
           'd': ['_2'], 'e': ['_2'], 'f': ['_2'],
           '+depths': {'_1': 0, '_2': 1} })
Exemplo n.º 16
0
 def test_implicit_missing(self):
     with self.assertRaises(ValueError):
         tutil.transform_exp_sources({0: 'abc', 'func2': 'def'})
Exemplo n.º 17
0
 def test_implicit(self):
     self.assertEqual(
         tutil.transform_exp_sources({0: 'abc', 'func1': 'def'}, subject='func2'),
         { 'a': ['func2'], 'b': ['func2'], 'c': ['func2'],
           'd': ['func1'], 'e': ['func1'], 'f': ['func1'],
           '+depths': {'func2': 0, 'func1': 1} })
Exemplo n.º 18
0
 def test_tf(self):
     self.assertEqual(
         tutil.transform_exp_sources({'func': 'abc', 'func2': 'def'}),
         { 'a': ['func'], 'b': ['func'], 'c': ['func'],
           'd': ['func2'], 'e': ['func2'], 'f': ['func2'],
           '+depths': {'func': 0, 'func2': 1} })