예제 #1
0
from extra import Service, HTTPRequest, HTTPResponse, on, server, run


class HelloWorld(Service):
    @on(GET="{any}")
    def helloWorld(self, request: HTTPRequest, any: str) -> HTTPResponse:
        return request.respond(b"Hello, World !", b"text/plain")


run(HelloWorld)
# NOTE: You can start this with `uvicorn helloworld:app`
# app = server(HelloWorld)

# Otherwise executing the module directly makes it work
# if __name__ == "__main__":
#     run(app)

# EOF
예제 #2
0
 def test(self):
     self.assertEqual(run("5 9 2 8\n9 4 7 3\n3 8 6 5"), '9')
예제 #3
0
 def test_1212(self):
     self.assertEqual(run('1212'), '6')
예제 #4
0
 def test_12131415(self):
     self.assertEqual(run('12131415'), '4')
예제 #5
0
 def test_123123(self):
     self.assertEqual(run('123123'), '12')
예제 #6
0
 def test_123425(self):
     self.assertEqual(run('123425'), '4')
예제 #7
0
 def test_1221(self):
     self.assertEqual(run('1221'), '0')