Skip to content

Commit e3dadbc

Browse files
authored
coverage 100% (#80)
1 parent e9d5356 commit e3dadbc

10 files changed

Lines changed: 1314 additions & 2098 deletions

File tree

.coverage

12 KB
Binary file not shown.

coverage.xml

Lines changed: 846 additions & 615 deletions
Large diffs are not rendered by default.

internal/codegen/drivers/asyncpg.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ func AsyncpgBuildQueryResults(body *builders.IndentStringBuilder) string {
2727
fmt.Sprintf("self._cursor: asyncpg.cursor.CursorFactory[%s] | None = None", AsyncpgResult),
2828
fmt.Sprintf("self._iterator: asyncpg.cursor.CursorIterator[%s] | None = None", AsyncpgResult),
2929
}, AsyncpgResult)
30+
body.WriteQueryResultsAwaitFunction([]string{
31+
"result = await self._conn.fetch(self._sql, *self._args)",
32+
"return [self._decode_hook(row) for row in result]",
33+
})
34+
body.NewLine()
3035
body.WriteIndentedLine(1, "async def __anext__(self) -> T:")
3136
body.WriteQueryResultsAnextDocstringAsyncpg()
3237
body.WriteIndentedLine(2, "if self._cursor is None or self._iterator is None:")
@@ -39,10 +44,6 @@ func AsyncpgBuildQueryResults(body *builders.IndentStringBuilder) string {
3944
body.WriteIndentedLine(3, "self._iterator = None")
4045
body.WriteIndentedLine(3, "raise")
4146
body.WriteIndentedLine(2, "return self._decode_hook(record)")
42-
body.WriteQueryResultsAwaitFunction([]string{
43-
"result = await self._conn.fetch(self._sql, *self._args)",
44-
"return [self._decode_hook(row) for row in result]",
45-
})
4647
return "QueryResults"
4748
}
4849

ruff.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ line-length = 120
55
# https://docs.astral.sh/ruff/rules/
66
select = ["ALL"]
77
ignore = [
8-
"D203",
9-
"D213",
8+
"COM812", # Missing trailing comma (interferes with the formatter)
109
]
1110

1211

test/driver_asyncpg/attrs/test_attrs_classes.py

Lines changed: 65 additions & 256 deletions
Large diffs are not rendered by default.

test/driver_asyncpg/attrs/test_attrs_functions.py

Lines changed: 85 additions & 189 deletions
Large diffs are not rendered by default.

test/driver_asyncpg/dataclass/test_dataclass_classes.py

Lines changed: 71 additions & 259 deletions
Large diffs are not rendered by default.

test/driver_asyncpg/dataclass/test_dataclass_functions.py

Lines changed: 88 additions & 256 deletions
Large diffs are not rendered by default.

test/driver_asyncpg/msgspec/test_msgspec_classes.py

Lines changed: 70 additions & 259 deletions
Large diffs are not rendered by default.

test/driver_asyncpg/msgspec/test_msgspec_functions.py

Lines changed: 83 additions & 258 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)