MCPcopy Index your code
hub / github.com/MagicStack/asyncpg / test_copy_from_query_with_args

Method test_copy_from_query_with_args

tests/test_copy.py:146–169  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

144 )
145
146 async def test_copy_from_query_with_args(self):
147 f = io.BytesIO()
148
149 res = await self.con.copy_from_query('''
150 SELECT
151 i,
152 i * 10,
153 $2::text
154 FROM
155 generate_series(1, 5) AS i
156 WHERE
157 i = $1
158 ''', 3, None, output=f)
159
160 self.assertEqual(res, 'COPY 1')
161
162 output = f.getvalue().decode().split('\n')
163 self.assertEqual(
164 output,
165 [
166 '3\t30\t\\N',
167 ''
168 ]
169 )
170
171 async def test_copy_from_query_to_path(self):
172 with tempfile.NamedTemporaryFile() as f:

Callers

nothing calls this directly

Calls 1

copy_from_queryMethod · 0.45

Tested by

no test coverage detected