(self)
| 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: |
nothing calls this directly
no test coverage detected