feat: indie status page MVP -- FastAPI + SQLite
- 8 DB models (services, incidents, monitors, subscribers, etc.) - Full CRUD API for services, incidents, monitors - Public status page with live data - Incident detail page with timeline - API key authentication - Uptime monitoring scheduler - 13 tests passing - TECHNICAL_DESIGN.md with full spec
This commit is contained in:
commit
902133edd3
4655 changed files with 1342691 additions and 0 deletions
|
|
@ -0,0 +1,60 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
|
||||
from mypy.test.helpers import assert_string_arrays_equal
|
||||
from mypyc.codegen.emit import Emitter, EmitterContext, ReturnHandler
|
||||
from mypyc.codegen.emitwrapper import generate_arg_check
|
||||
from mypyc.ir.rtypes import int_rprimitive, list_rprimitive
|
||||
from mypyc.namegen import NameGenerator
|
||||
|
||||
|
||||
class TestArgCheck(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.context = EmitterContext(NameGenerator([["mod"]]), True)
|
||||
|
||||
def test_check_list(self) -> None:
|
||||
emitter = Emitter(self.context)
|
||||
generate_arg_check("x", list_rprimitive, emitter, ReturnHandler("NULL"))
|
||||
lines = emitter.fragments
|
||||
self.assert_lines(
|
||||
[
|
||||
"PyObject *arg_x;",
|
||||
"if (likely(PyList_Check(obj_x)))",
|
||||
" arg_x = obj_x;",
|
||||
"else {",
|
||||
' CPy_TypeError("list", obj_x);',
|
||||
" return NULL;",
|
||||
"}",
|
||||
],
|
||||
lines,
|
||||
)
|
||||
|
||||
def test_check_int(self) -> None:
|
||||
emitter = Emitter(self.context)
|
||||
generate_arg_check("x", int_rprimitive, emitter, ReturnHandler("NULL"))
|
||||
generate_arg_check("y", int_rprimitive, emitter, ReturnHandler("NULL"), optional=True)
|
||||
lines = emitter.fragments
|
||||
self.assert_lines(
|
||||
[
|
||||
"CPyTagged arg_x;",
|
||||
"if (likely(PyLong_Check(obj_x)))",
|
||||
" arg_x = CPyTagged_BorrowFromObject(obj_x);",
|
||||
"else {",
|
||||
' CPy_TypeError("int", obj_x); return NULL;',
|
||||
"}",
|
||||
"CPyTagged arg_y;",
|
||||
"if (obj_y == NULL) {",
|
||||
" arg_y = CPY_INT_TAG;",
|
||||
"} else if (likely(PyLong_Check(obj_y)))",
|
||||
" arg_y = CPyTagged_BorrowFromObject(obj_y);",
|
||||
"else {",
|
||||
' CPy_TypeError("int", obj_y); return NULL;',
|
||||
"}",
|
||||
],
|
||||
lines,
|
||||
)
|
||||
|
||||
def assert_lines(self, expected: list[str], actual: list[str]) -> None:
|
||||
actual = [line.rstrip("\n") for line in actual]
|
||||
assert_string_arrays_equal(expected, actual, "Invalid output")
|
||||
Loading…
Add table
Add a link
Reference in a new issue