77import turu .core .mock
88from pydantic import BaseModel
99from turu .core .exception import TuruRowTypeNotSupportedError
10- from turu .core .record import RecordCursor , record_as_csv
10+ from turu .core .record import RecordCursor , record_to_csv
1111from typing_extensions import Never
1212
1313
@@ -17,30 +17,30 @@ class RowPydantic(BaseModel):
1717
1818
1919class TestRecord :
20- def test_record_as_csv_execute_tuple (
20+ def test_record_to_csv_execute_tuple (
2121 self , mock_connection : turu .core .mock .MockConnection
2222 ):
2323 expected = [(i , f"name{ i } " ) for i in range (5 )]
2424 mock_connection .inject_response (None , expected )
2525
2626 with tempfile .NamedTemporaryFile () as file :
2727 with pytest .raises (TuruRowTypeNotSupportedError ):
28- with record_as_csv (
28+ with record_to_csv (
2929 file .name ,
3030 mock_connection .execute ("select 1 as ID, 'taro' as NAME" ),
3131 ) as cursor :
3232 assert cursor .fetchall () == expected
3333
3434 assert Path (file .name ).read_text () == ""
3535
36- def test_record_as_csv_execute_tuple_without_header (
36+ def test_record_to_csv_execute_tuple_without_header (
3737 self , mock_connection : turu .core .mock .MockConnection
3838 ):
3939 expected = [(i , f"name{ i } " ) for i in range (5 )]
4040 mock_connection .inject_response (None , expected )
4141
4242 with tempfile .NamedTemporaryFile () as file :
43- with record_as_csv (
43+ with record_to_csv (
4444 file .name ,
4545 mock_connection .execute ("select 1, 'taro" ),
4646 header = False ,
@@ -60,14 +60,14 @@ def test_record_as_csv_execute_tuple_without_header(
6060 ).lstrip ()
6161 )
6262
63- def test_record_as_csv_execute_map (
63+ def test_record_to_csv_execute_map (
6464 self , mock_connection : turu .core .mock .MockConnection
6565 ):
6666 expected = [RowPydantic (id = i , name = f"name{ i } " ) for i in range (5 )]
6767 mock_connection .inject_response (RowPydantic , expected )
6868
6969 with tempfile .NamedTemporaryFile () as file :
70- with record_as_csv (
70+ with record_to_csv (
7171 file .name ,
7272 mock_connection .execute_map (RowPydantic , "select 1, 'name" ),
7373 ) as cursor :
@@ -87,14 +87,14 @@ def test_record_as_csv_execute_map(
8787 ).lstrip ()
8888 )
8989
90- def test_record_as_csv_execute_map_without_header_options (
90+ def test_record_to_csv_execute_map_without_header_options (
9191 self , mock_connection : turu .core .mock .MockConnection
9292 ):
9393 expected = [RowPydantic (id = i , name = f"name{ i } " ) for i in range (5 )]
9494 mock_connection .inject_response (RowPydantic , expected )
9595
9696 with tempfile .NamedTemporaryFile () as file :
97- with record_as_csv (
97+ with record_to_csv (
9898 file .name ,
9999 mock_connection .execute_map (RowPydantic , "select 1, 'name" ),
100100 header = False ,
@@ -114,14 +114,14 @@ def test_record_as_csv_execute_map_without_header_options(
114114 ).lstrip ()
115115 )
116116
117- def test_record_as_csv_execute_map_with_limit_options (
117+ def test_record_to_csv_execute_map_with_limit_options (
118118 self , mock_connection : turu .core .mock .MockConnection
119119 ):
120120 expected = [RowPydantic (id = i , name = f"name{ i } " ) for i in range (5 )]
121121 mock_connection .inject_response (RowPydantic , expected )
122122
123123 with tempfile .NamedTemporaryFile () as file :
124- with record_as_csv (
124+ with record_to_csv (
125125 file .name ,
126126 mock_connection .execute_map (RowPydantic , "select 1, 'name" ),
127127 limit = 3 ,
@@ -141,7 +141,7 @@ def test_record_as_csv_execute_map_with_limit_options(
141141 )
142142
143143 @pytest .mark .parametrize ("enable" , ["true" , True ])
144- def test_record_as_csv_execute_map_with_enable_options (
144+ def test_record_to_csv_execute_map_with_enable_options (
145145 self ,
146146 mock_connection : turu .core .mock .MockConnection ,
147147 enable : Literal ["true" , True ],
@@ -150,7 +150,7 @@ def test_record_as_csv_execute_map_with_enable_options(
150150 mock_connection .inject_response (RowPydantic , expected )
151151
152152 with tempfile .NamedTemporaryFile () as file :
153- with record_as_csv (
153+ with record_to_csv (
154154 file .name ,
155155 mock_connection .execute_map (RowPydantic , "select 1, 'name" ),
156156 enable = enable ,
@@ -173,7 +173,7 @@ def test_record_as_csv_execute_map_with_enable_options(
173173 )
174174
175175 @pytest .mark .parametrize ("enable" , ["false" , False , None ])
176- def test_record_as_csv_execute_map_with_disable_options (
176+ def test_record_to_csv_execute_map_with_disable_options (
177177 self ,
178178 mock_connection : turu .core .mock .MockConnection ,
179179 enable : Literal ["false" , False , None ],
@@ -182,7 +182,7 @@ def test_record_as_csv_execute_map_with_disable_options(
182182 mock_connection .inject_response (RowPydantic , expected )
183183
184184 with tempfile .NamedTemporaryFile () as file :
185- with record_as_csv (
185+ with record_to_csv (
186186 file .name ,
187187 mock_connection .execute_map (RowPydantic , "select 1, 'name" ),
188188 enable = enable ,
@@ -191,7 +191,7 @@ def test_record_as_csv_execute_map_with_disable_options(
191191
192192 assert Path (file .name ).read_text () == ""
193193
194- def test_record_as_csv_use_custom_method (self ):
194+ def test_record_to_csv_use_custom_method (self ):
195195 class CustomCursor (turu .core .mock .MockCursor [Never , Any ]):
196196 def custom_method (self , value : int ) -> None :
197197 pass
@@ -204,7 +204,7 @@ def custom_method(self, value: int) -> None:
204204 pass
205205
206206 with tempfile .NamedTemporaryFile () as file :
207- with record_as_csv (
207+ with record_to_csv (
208208 file .name ,
209209 CustomConnection ().cursor (),
210210 ) as cursor :
0 commit comments