Exemple #1
0
class Mountain:
    def __init__(self):
        self.stream = WritelnDecorator(sys.stdout)
        self.tests = path_to_enlightenment.koans()
        self.lesson = Sensei(self.stream)
        self.optional_tests = path_to_enlightenment.koans("optional_koans.txt")

    def walk_the_path(self, args=None):
        """Run the koans tests with a custom runner output."""

        if args and len(args) >= 2:
            args.pop(0)
            test_names = ["koans." + test_name for test_name in args]
            self.tests = unittest.TestLoader().loadTestsFromNames(test_names)
        self.tests(self.lesson)
        self.lesson.learn()
        return self.lesson

    def walk_the_optional_path(self, args=None):
        """Run the optional koans tests with a custom runner output."""

        if args and len(args) >= 2:
            args.pop(0)
            test_names = ["optional_koans." + test_name for test_name in args]
            self.optional_tests = unittest.TestLoader().loadTestsFromNames(
                test_names)
        self.lesson.run_optional = True
        self.optional_tests(self.lesson)
        self.lesson.learn_optional()
        return self.lesson
Exemple #2
0
class Mountain:
    def __init__(self):
        self.stream = WritelnDecorator(sys.stdout)
        self.tests = path_to_enlightenment.koans()
        self.lesson = Sensei(self.stream)

    def walk_the_path(self, args=None):
        "Run the koans tests with a custom runner output."

        if args and len(args) >=2:
            args.pop(0)
            test_names = ["koans." + test_name for test_name in args]
            self.tests = unittest.TestLoader().loadTestsFromNames(test_names)
        self.tests(self.lesson)
        self.lesson.learn()
        return self.lesson
      
    def session(self, num):
      sessions = { 0:['about_asserts'], 1: [ 'about_strings', 'about_none', 'about_lists', 'about_list_assignments', 
            'about_dictionaries', 'about_string_manipulation', 'about_tuples', 'about_methods'],
        2: ['about_control_statements', 'about_true_and_false', 'about_sets', 'about_triangle_project', 
            'about_exceptions', 'about_triangle_project2',],
        3: ['about_iteration', 'about_comprehension', 'about_generators', 'about_lambdas', 'about_scoring_project',],
        4: ['about_classes', 'about_class_attributes', 'about_with_statements', 'about_dice_project',],
        5: ['about_inheritance', 'about_multiple_inheritance', 'about_scope', 'about_modules', 'about_packages',],
        6: ['about_numpy_array_creation', 'about_numpy_array_operations', 'about_numpy_array_views', 'about_numpy_equations', ], 
        7: ['about_monkey_patching', 'about_method_bindings', 'about_decorating_with_functions', 'about_decorating_with_classes',]
        + ['about_attribute_access', 'about_deleting_objects', 'about_proxy_object_project', 'about_extra_credit',]
      }
      
      return self.walk_the_path([''] + sessions[num])
class Mountain:
    def __init__(self):
        self.stream = WritelnDecorator(sys.stdout)
        self.tests = path_to_enlightenment.koans()
        self.lesson = Sensei(self.stream)
    
    def walk_the_path(self, args=None):
        "Run the koans tests with a custom runner output."
        
        if args and len(args) >=2:
            self.tests = unittest.TestLoader().loadTestsFromName("koans." + args[1])

        self.tests(self.lesson)
        self.lesson.learn()
        return self.lesson
class Mountain:
    def __init__(self):
        self.stream = WritelnDecorator(sys.stdout)
        self.tests = path_to_enlightenment.koans()
        self.lesson = Sensei(self.stream)

    def walk_the_path(self, args=None):
        """'Run the koans tests with a custom runner output.'"""
    #    if args and len(args) >= 2:
    #        print "This is the best"
    #        args.pop(0)
    #        test_names = ["koans." + test_name for test_name in args]
    #        self.tests = unittest.TestLoader().loadTestsFromNames(test_names)
        self.tests(self.lesson)
        self.lesson.learn()
        return self.lesson
class Mountain:
    def __init__(self):
        self.stream = WritelnDecorator(sys.stdout)
        self.tests = path_to_enlightenment.koans()
        self.lesson = Sensei(self.stream)

    def walk_the_path(self, args=None):
        """'Run the koans tests with a custom runner output.'"""
        #    if args and len(args) >= 2:
        #        print "This is the best"
        #        args.pop(0)
        #        test_names = ["koans." + test_name for test_name in args]
        #        self.tests = unittest.TestLoader().loadTestsFromNames(test_names)
        self.tests(self.lesson)
        self.lesson.learn()
        return self.lesson
Exemple #6
0
class Mountain:
    def __init__(self):
        self.stream = WritelnDecorator(sys.stdout)
        self.tests = path_to_enlightenment.koans()
        self.lesson = Sensei(self.stream)

    def walk_the_path(self, args=None):
        "Run the koans tests with a custom runner output."

        if args and len(args) >= 2:
            self.tests = unittest.TestLoader().loadTestsFromName("koans." +
                                                                 args[1])

        self.tests(self.lesson)
        self.lesson.learn()
        return self.lesson
Exemple #7
0
 def __init__(self):
     self.stream = WritelnDecorator(sys.stdout)
     self.tests = path_to_enlightenment.koans()
     self.lesson = Sensei(self.stream)
Exemple #8
0
 def __init__(self):
     self.stream = WritelnDecorator(sys.stdout)
     self.tests = path_to_enlightenment.koans()
     self.lesson = Sensei(self.stream)
     self.optional_tests = path_to_enlightenment.koans("optional_koans.txt")
Exemple #9
0
 def __init__(self):
     self.stream = WritelnDecorator(sys.stdout)
     self.suite = path_to_enlightenment.koans()
     self.lesson = Sensei(self.stream)
Exemple #10
0
class Mountain:
    def __init__(self):
        self.stream = WritelnDecorator(sys.stdout)
        self.tests = path_to_enlightenment.koans()
        self.lesson = Sensei(self.stream)

    def walk_the_path(self, args=None):
        "Run the koans tests with a custom runner output."

        if args and len(args) >= 2:
            args.pop(0)
            test_names = ["koans." + test_name for test_name in args]
            self.tests = unittest.TestLoader().loadTestsFromNames(test_names)
        self.tests(self.lesson)
        self.lesson.learn()
        return self.lesson

    def session(self, num):
        sessions = {
            0: ['about_asserts'],
            1: [
                'about_strings', 'about_none', 'about_lists',
                'about_list_assignments', 'about_dictionaries',
                'about_string_manipulation', 'about_tuples', 'about_methods'
            ],
            2: [
                'about_control_statements',
                'about_true_and_false',
                'about_sets',
                'about_triangle_project',
                'about_exceptions',
                'about_triangle_project2',
            ],
            3: [
                'about_iteration',
                'about_comprehension',
                'about_generators',
                'about_lambdas',
                'about_scoring_project',
            ],
            4: [
                'about_classes',
                'about_class_attributes',
                'about_with_statements',
                'about_dice_project',
            ],
            5: [
                'about_inheritance',
                'about_multiple_inheritance',
                'about_scope',
                'about_modules',
                'about_packages',
            ],
            6: [
                'about_numpy_array_creation',
                'about_numpy_array_operations',
                'about_numpy_array_views',
                'about_numpy_equations',
            ],
            7: [
                'about_monkey_patching',
                'about_method_bindings',
                'about_decorating_with_functions',
                'about_decorating_with_classes',
            ] + [
                'about_attribute_access',
                'about_deleting_objects',
                'about_proxy_object_project',
                'about_extra_credit',
            ]
        }

        return self.walk_the_path([''] + sessions[num])