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
def test(self): self.assertEqual(run("5 9 2 8\n9 4 7 3\n3 8 6 5"), '9')
def test_1212(self): self.assertEqual(run('1212'), '6')
def test_12131415(self): self.assertEqual(run('12131415'), '4')
def test_123123(self): self.assertEqual(run('123123'), '12')
def test_123425(self): self.assertEqual(run('123425'), '4')
def test_1221(self): self.assertEqual(run('1221'), '0')