rileyshahar / aga

aga grades assignments
MIT License
8 stars 2 forks source link

Add injection support #51

Closed FlickerSoul closed 1 year ago

FlickerSoul commented 2 years ago

usage

cli command

aga gen problem.py --inject ./supporting.py

supporting.py

def prize_fn(*args, **kwargs):
    pass

problem.py

from aga import problem, prize, test_case
from aga.injection import prize_fn  # the prize_fn in the supporting will be injected 

@test_case(1, aga_expect=1)
@prize(prize_fn)  # and can be used here
@problem()
def test(a: int) -> int:
    return a * a

assert test(10) == 100
FlickerSoul commented 2 years ago

will add tests later

FlickerSoul commented 2 years ago

Should be ready :)