Skip to content

Commit 4351410

Browse files
committed
Added the unit test for column_queue
1 parent 0ddca9d commit 4351410

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import unittest
2+
import pytest
3+
import pyarrow as pa
4+
from databricks_sql_connector_core.sql.utils import ColumnQueue
5+
6+
7+
class TestColumnQueueSuite:
8+
@pytest.fixture(scope="function")
9+
def setup(self):
10+
columnar_table = [[0, 3, 6, 9], [1, 4, 7, 10], [2, 5, 8, 11]]
11+
column_names = [f"col_{i}" for i in range(len(columnar_table))]
12+
return ColumnQueue(columnar_table, column_names)
13+
14+
def test_fetchmany_respects_n_rows(self, setup):
15+
column_queue = setup
16+
assert column_queue.next_n_rows(2) == [[0, 3], [1, 4], [2, 5]]
17+
assert column_queue.next_n_rows(2) == [[6, 9], [7, 10], [8, 11]]
18+
19+
def test_fetch_remaining_rows_respects_n_rows(self, setup):
20+
column_queue = setup
21+
assert column_queue.next_n_rows(2) == [[0, 3], [1, 4], [2, 5]]
22+
assert column_queue.remaining_rows() == [[6, 9], [7, 10], [8, 11]]
23+
24+

0 commit comments

Comments
 (0)