MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / result_one

Function result_one

test/typing/plain_files/engine/engine_result.py:33–56  ·  view source on GitHub ↗
(res: Result[int, str])

Source from the content-addressed store, hash-verified

31
32
33def result_one(res: Result[int, str]) -> None:
34 assert_type(res.one(), Row[int, str])
35 assert_type(res.one_or_none(), Row[int, str] | None)
36 assert_type(res.fetchone(), Row[int, str] | None)
37 assert_type(res.first(), Row[int, str] | None)
38 assert_type(res.all(), Sequence[Row[int, str]])
39 assert_type(res.fetchmany(), Sequence[Row[int, str]])
40 assert_type(res.fetchall(), Sequence[Row[int, str]])
41 assert_type(next(res), Row[int, str])
42 for rf in res:
43 assert_type(rf, Row[int, str])
44 for rp in res.partitions():
45 assert_type(rp, Sequence[Row[int, str]])
46
47 res_s = assert_type(res.scalars(), ScalarResult[int])
48 res_s = assert_type(res.scalars(0), ScalarResult[int])
49 assert_type(res_s.one(), int)
50 assert_type(res.scalars(1), ScalarResult[Any])
51 assert_type(res.mappings(), MappingResult)
52 assert_type(res.freeze(), FrozenResult[int, str])
53
54 assert_type(res.scalar_one(), int)
55 assert_type(res.scalar_one_or_none(), int | None)
56 assert_type(res.scalar(), int | None)

Callers

nothing calls this directly

Calls 14

oneMethod · 0.45
one_or_noneMethod · 0.45
fetchoneMethod · 0.45
firstMethod · 0.45
allMethod · 0.45
fetchmanyMethod · 0.45
fetchallMethod · 0.45
partitionsMethod · 0.45
scalarsMethod · 0.45
mappingsMethod · 0.45
freezeMethod · 0.45
scalar_oneMethod · 0.45

Tested by

no test coverage detected