File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -62,3 +62,46 @@ async def test_cursor_fetch_last(
62
62
last_res = await test_cursor .fetch_last ()
63
63
64
64
assert all_res .result ()[- 1 ] == last_res .result ()[0 ]
65
+
66
+
67
+ @pytest .mark .anyio
68
+ async def test_cursor_fetch_absolute (
69
+ test_cursor : Cursor ,
70
+ number_database_records : int ,
71
+ ) -> None :
72
+ """Test cursor fetch Absolute."""
73
+ all_res = await test_cursor .fetch (
74
+ fetch_number = number_database_records ,
75
+ )
76
+
77
+ first_record = await test_cursor .fetch_absolute (
78
+ absolute_number = 1 ,
79
+ )
80
+ last_record = await test_cursor .fetch_absolute (
81
+ absolute_number = - 1 ,
82
+ )
83
+
84
+ assert all_res .result ()[0 ] == first_record .result ()[0 ]
85
+ assert all_res .result ()[- 1 ] == last_record .result ()[0 ]
86
+
87
+
88
+ @pytest .mark .anyio
89
+ async def test_cursor_fetch_relative (
90
+ test_cursor : Cursor ,
91
+ number_database_records : int ,
92
+ ) -> None :
93
+ """Test cursor fetch Relative."""
94
+ first_absolute = await test_cursor .fetch_relative (
95
+ relative_number = 1 ,
96
+ )
97
+
98
+ assert first_absolute .result ()
99
+
100
+ await test_cursor .fetch (
101
+ fetch_number = number_database_records ,
102
+ )
103
+ records = await test_cursor .fetch_relative (
104
+ relative_number = 1 ,
105
+ )
106
+
107
+ assert not (records .result ())
You can’t perform that action at this time.
0 commit comments