Ejemplo n.º 1
0
 def test_not_class(self):
     t, m, starter = process_starter.get_class(
         'tests.test_process_starter.main_function')
     self.assertEqual(t, types.FunctionType)
     self.assertIsInstance(m, types.FunctionType)
     self.assertNotIsInstance(m, class_types)
     self.assertIsNone(starter)
Ejemplo n.º 2
0
 def _construct_trees_from_context(self):
     trees = dict()
     for tree_name, context_entry in self.CONTEXT.iteritems():
         _, tree_klass, _ = get_class(context_entry.tree_classname)
         tree = tree_klass(*context_entry.enclosed_processes,
                           full_name=tree_name,
                           mx_name=context_entry.mx_name,
                           mx_page=context_entry.mx_page)
         trees[tree_name] = tree
     return trees
Ejemplo n.º 3
0
    def test_starter_method(self):
        t, m, starter = process_starter.get_class('tests.test_process_starter.NewClass.starter_method')
        self.assertIn(t, class_types)
        self.assertIsInstance(m, class_types)
        self.assertEqual(starter, 'starter_method')

        self.assertIsInstance(getattr(m(), starter), types.MethodType)
        if PY2:
            self.assertIsInstance(getattr(m, starter), types.MethodType)
        if PY3:
            self.assertIsInstance(getattr(m, starter), types.FunctionType)
Ejemplo n.º 4
0
    def test_starter_method(self):
        t, m, starter = process_starter.get_class(
            'tests.test_process_starter.NewClass.starter_method')
        self.assertIn(t, class_types)
        self.assertIsInstance(m, class_types)
        self.assertEqual(starter, 'starter_method')

        self.assertIsInstance(getattr(m(), starter), types.MethodType)
        if PY2:
            self.assertIsInstance(getattr(m, starter), types.MethodType)
        if PY3:
            self.assertIsInstance(getattr(m, starter), types.FunctionType)
Ejemplo n.º 5
0
 def test_not_class(self):
     t, m, starter = process_starter.get_class('tests.test_process_starter.main_function')
     self.assertEqual(t, types.FunctionType)
     self.assertIsInstance(m, types.FunctionType)
     self.assertNotIsInstance(m, class_types)
     self.assertIsNone(starter)
Ejemplo n.º 6
0
 def test_old_class_method(self):
     t, m, starter = process_starter.get_class('tests.test_process_starter.OldClass.starter_method')
     self.assertIn(t, class_types)
     self.assertIsInstance(m, class_types)
     self.assertEqual(starter, 'starter_method')
Ejemplo n.º 7
0
 def test_type_new_class(self):
     t, m, starter = process_starter.get_class('tests.test_process_starter.NewClass')
     self.assertIn(t, class_types)
     self.assertIsInstance(m, class_types)
     self.assertIsNone(starter)
Ejemplo n.º 8
0
 def test_old_class_method(self):
     t, m, starter = process_starter.get_class(
         'tests.test_process_starter.OldClass.starter_method')
     self.assertIn(t, class_types)
     self.assertIsInstance(m, class_types)
     self.assertEqual(starter, 'starter_method')
Ejemplo n.º 9
0
 def test_type_new_class(self):
     t, m, starter = process_starter.get_class(
         'tests.test_process_starter.NewClass')
     self.assertIn(t, class_types)
     self.assertIsInstance(m, class_types)
     self.assertIsNone(starter)