Exemple #1
0
    def test_listing_classes_with_filter(self):
        test_module = pynsive.import_module('pynsive_test.test_classes')

        def subclasses_only(test_type):
            same = test_type is not test_module.PynsiveTestingClass
            is_subclass = issubclass(
                test_type, test_module.PynsiveTestingClass)
            return not same and is_subclass

        classes = pynsive.list_classes('pynsive_test', subclasses_only)
        self.assertEqual(len(classes), 1)
    def test_listing_classes_with_filter(self):
        test_module = pynsive.import_module('pynsive_test.test_classes')

        def subclasses_only(test_type):
            same = test_type is not test_module.PynsiveTestingClass
            is_subclass = issubclass(test_type,
                                     test_module.PynsiveTestingClass)
            return not same and is_subclass

        classes = pynsive.list_classes('pynsive_test', subclasses_only)
        self.assertEqual(len(classes), 1)
Exemple #3
0
def _find_cfg_classes(module):
    def configuration_objects_only(cls):
        return issubclass(cls, ConfigurationPart)

    return pynsive.list_classes(module, configuration_objects_only)
Exemple #4
0
def _find_cfg_classes(module):
    def configuration_objects_only(cls):
        return issubclass(cls, ConfigurationPart)

    return pynsive.list_classes(module, configuration_objects_only)
Exemple #5
0
 def test_listing_classes(self):
     classes = pynsive.list_classes('pynsive_test.test_classes')
     self.assertEqual(len(classes), 2)
Exemple #6
0
 def test_discovering_classes(self):
     classes = pynsive.list_classes('pynsive_test.test_classes')
     self.assertEqual(2, len(classes))