예제 #1
0
파일: views.py 프로젝트: mpk3/Mathics
from django.contrib import auth
from django.contrib.auth.models import User

from django.core.mail import send_mail

from mathics.core.definitions import Definitions
from mathics.core.evaluation import Evaluation, Message, Result, Output

from mathics.web.models import Query, Worksheet, get_session_evaluation
from mathics.web.forms import LoginForm, SaveForm
from mathics.doc import documentation
from mathics.doc.doc import DocPart, DocChapter, DocSection

from string import Template

documentation.load_pymathics_doc()

if settings.DEBUG:
    JSON_CONTENT_TYPE = 'text/html'
else:
    JSON_CONTENT_TYPE = 'application/json'


class JsonResponse(HttpResponse):
    def __init__(self, result={}):
        response = json.dumps(result)
        super(JsonResponse, self).__init__(response,
                                           content_type=JSON_CONTENT_TYPE)


def require_ajax_login(func):
예제 #2
0
파일: test.py 프로젝트: stephenoba/Mathics
def main():
    from mathics.doc import documentation as main_mathics_documentation
    global definitions
    global documentation
    definitions = Definitions(add_builtin=True)
    documentation = main_mathics_documentation

    parser = ArgumentParser(description="Mathics test suite.", add_help=False)
    parser.add_argument("--help",
                        "-h",
                        help="show this help message and exit",
                        action="help")
    parser.add_argument("--version",
                        "-v",
                        action="version",
                        version="%(prog)s " + mathics.__version__)
    parser.add_argument("--section",
                        "-s",
                        dest="section",
                        metavar="SECTION",
                        help="only test SECTION")
    parser.add_argument('--pymathics',
                        '-l',
                        dest="pymathics",
                        action="store_true",
                        help="also checks pymathics modules.")

    parser.add_argument(
        "--output",
        "-o",
        dest="output",
        action="store_true",
        help="generate TeX and XML output data",
    )
    parser.add_argument(
        "--tex",
        "-t",
        dest="tex",
        action="store_true",
        help="generate TeX documentation file",
    )
    parser.add_argument("--quiet",
                        "-q",
                        dest="quiet",
                        action="store_true",
                        help="hide passed tests")
    parser.add_argument("--stop-on-failure",
                        action="store_true",
                        help="stop on failure")
    parser.add_argument(
        "--skip",
        metavar="N",
        dest="skip",
        type=int,
        default=0,
        help="skip the first N tests",
    )
    args = parser.parse_args()

    print("This needs to be gone over")
    return
    if args.tex:
        write_latex()
    elif args.section:
        test_section(args.section, stop_on_failure=args.stop_on_failure)
    else:
        documentation.load_pymathics_doc()
        if args.section:
            test_section(args.section, stop_on_failure=args.stop_on_failure)
        else:
            start_at = args.skip + 1
            test_all(quiet=args.quiet,
                     generate_output=args.output,
                     stop_on_failure=args.stop_on_failure,
                     start_at=start_at)