Giter Club home page Giter Club logo

pygrader's Introduction

PyGrader

Repository demonstrating how python can be used to auto-grade homework assignments. Does not contain any specific assignments or their tests, but does contain the basic building blocks used. Basic functionality is complete, advanced funcitonality is planned

Planned functionality:

Will implement a sandbox
Will implement a parser to fix submissions that don't use if __name__ == "__main__":

===

How to use:

auto_grader.auto_grader is the base auto_grader class. It has all of the built in functionality to run the majority of desired tests. It is a subclass of unittest.TestCase so normal unit testing methods (such as self.assertEqual()) will work in this class.

Grader is asked to subclass this with their own desired functionality. If capturing printed statements is desired then just use the context manager autograder.capture() like so

    def test_my_func(self):
        my_func = my_subclass.black_magic(func_name)
        
        with self.capture() as (out, err):
            map(self.assertEqual,
                map(my_func,
                    arglist),
                out)

If this doesn't do exactly you want then just override capture with the desired functionality. When implementing your test functions you can just do

    def test_some_func(self, args):
        some_func = my_subclass.black_magic(func_name)
        map(self.assertEqual,
            map(some_func,
                arglist),
            expected_value_list)

To actually run your tests just call

    test_assignment(subclass, good_names, student_name,
                    module_name, mod_path, grade_path)

With all of the appropriate arguments. Loops are ideal. For example:

    for submission in submissions:
        test_assignment(subclass, my_names, submission[0],
                        submission[1], submission[2], submission[3])

Where submission has all of the data you need and submissions contains every piece of data

pygrader's People

Contributors

dannnno avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

kiwi4py

pygrader's Issues

Testing

I need to work out how to implement unit tests of something that is a unit test. I suppose this should be possible, but it's going to take some thinking.

Current implementation doesn't work

The way things are right now it won't work with Python's builtin unittest module... I think.

I need to either change it so that I don't use instances of the class, or write my own unittesting framework. We'll see...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.