real-ladybug 0.0.1.dev1__cp312-cp312-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of real-ladybug might be problematic. Click here for more details.

Files changed (114) hide show
  1. real_ladybug/__init__.py +83 -0
  2. real_ladybug/_lbug.cp312-win_amd64.pyd +0 -0
  3. real_ladybug/_lbug.exp +0 -0
  4. real_ladybug/_lbug.lib +0 -0
  5. real_ladybug/async_connection.py +226 -0
  6. real_ladybug/connection.py +323 -0
  7. real_ladybug/constants.py +7 -0
  8. real_ladybug/database.py +307 -0
  9. real_ladybug/prepared_statement.py +51 -0
  10. real_ladybug/py.typed +0 -0
  11. real_ladybug/query_result.py +511 -0
  12. real_ladybug/torch_geometric_feature_store.py +185 -0
  13. real_ladybug/torch_geometric_graph_store.py +131 -0
  14. real_ladybug/torch_geometric_result_converter.py +282 -0
  15. real_ladybug/types.py +39 -0
  16. real_ladybug-0.0.1.dev1.dist-info/METADATA +88 -0
  17. real_ladybug-0.0.1.dev1.dist-info/RECORD +114 -0
  18. real_ladybug-0.0.1.dev1.dist-info/WHEEL +5 -0
  19. real_ladybug-0.0.1.dev1.dist-info/licenses/LICENSE +21 -0
  20. real_ladybug-0.0.1.dev1.dist-info/top_level.txt +3 -0
  21. real_ladybug-0.0.1.dev1.dist-info/zip-safe +1 -0
  22. real_ladybug-source/scripts/antlr4/hash.py +2 -0
  23. real_ladybug-source/scripts/antlr4/keywordhandler.py +47 -0
  24. real_ladybug-source/scripts/collect-extensions.py +68 -0
  25. real_ladybug-source/scripts/collect-single-file-header.py +126 -0
  26. real_ladybug-source/scripts/export-dbs.py +101 -0
  27. real_ladybug-source/scripts/export-import-test.py +345 -0
  28. real_ladybug-source/scripts/extension/purge-beta.py +34 -0
  29. real_ladybug-source/scripts/generate-cpp-docs/collect_files.py +122 -0
  30. real_ladybug-source/scripts/generate-tinysnb.py +34 -0
  31. real_ladybug-source/scripts/get-clangd-diagnostics.py +233 -0
  32. real_ladybug-source/scripts/migrate-lbug-db.py +308 -0
  33. real_ladybug-source/scripts/multiplatform-test-helper/collect-results.py +71 -0
  34. real_ladybug-source/scripts/multiplatform-test-helper/notify-discord.py +68 -0
  35. real_ladybug-source/scripts/pip-package/package_tar.py +90 -0
  36. real_ladybug-source/scripts/pip-package/setup.py +130 -0
  37. real_ladybug-source/scripts/run-clang-format.py +408 -0
  38. real_ladybug-source/scripts/setup-extension-repo.py +67 -0
  39. real_ladybug-source/scripts/test-simsimd-dispatch.py +45 -0
  40. real_ladybug-source/scripts/update-nightly-build-version.py +81 -0
  41. real_ladybug-source/third_party/brotli/scripts/dictionary/step-01-download-rfc.py +16 -0
  42. real_ladybug-source/third_party/brotli/scripts/dictionary/step-02-rfc-to-bin.py +34 -0
  43. real_ladybug-source/third_party/brotli/scripts/dictionary/step-03-validate-bin.py +35 -0
  44. real_ladybug-source/third_party/brotli/scripts/dictionary/step-04-generate-java-literals.py +85 -0
  45. real_ladybug-source/third_party/pybind11/tools/codespell_ignore_lines_from_errors.py +35 -0
  46. real_ladybug-source/third_party/pybind11/tools/libsize.py +36 -0
  47. real_ladybug-source/third_party/pybind11/tools/make_changelog.py +63 -0
  48. real_ladybug-source/tools/python_api/build/real_ladybug/__init__.py +83 -0
  49. real_ladybug-source/tools/python_api/build/real_ladybug/async_connection.py +226 -0
  50. real_ladybug-source/tools/python_api/build/real_ladybug/connection.py +323 -0
  51. real_ladybug-source/tools/python_api/build/real_ladybug/constants.py +7 -0
  52. real_ladybug-source/tools/python_api/build/real_ladybug/database.py +307 -0
  53. real_ladybug-source/tools/python_api/build/real_ladybug/prepared_statement.py +51 -0
  54. real_ladybug-source/tools/python_api/build/real_ladybug/py.typed +0 -0
  55. real_ladybug-source/tools/python_api/build/real_ladybug/query_result.py +511 -0
  56. real_ladybug-source/tools/python_api/build/real_ladybug/torch_geometric_feature_store.py +185 -0
  57. real_ladybug-source/tools/python_api/build/real_ladybug/torch_geometric_graph_store.py +131 -0
  58. real_ladybug-source/tools/python_api/build/real_ladybug/torch_geometric_result_converter.py +282 -0
  59. real_ladybug-source/tools/python_api/build/real_ladybug/types.py +39 -0
  60. real_ladybug-source/tools/python_api/src_py/__init__.py +83 -0
  61. real_ladybug-source/tools/python_api/src_py/async_connection.py +226 -0
  62. real_ladybug-source/tools/python_api/src_py/connection.py +323 -0
  63. real_ladybug-source/tools/python_api/src_py/constants.py +7 -0
  64. real_ladybug-source/tools/python_api/src_py/database.py +307 -0
  65. real_ladybug-source/tools/python_api/src_py/prepared_statement.py +51 -0
  66. real_ladybug-source/tools/python_api/src_py/py.typed +0 -0
  67. real_ladybug-source/tools/python_api/src_py/query_result.py +511 -0
  68. real_ladybug-source/tools/python_api/src_py/torch_geometric_feature_store.py +185 -0
  69. real_ladybug-source/tools/python_api/src_py/torch_geometric_graph_store.py +131 -0
  70. real_ladybug-source/tools/python_api/src_py/torch_geometric_result_converter.py +282 -0
  71. real_ladybug-source/tools/python_api/src_py/types.py +39 -0
  72. real_ladybug-source/tools/python_api/test/conftest.py +230 -0
  73. real_ladybug-source/tools/python_api/test/disabled_test_extension.py +73 -0
  74. real_ladybug-source/tools/python_api/test/ground_truth.py +430 -0
  75. real_ladybug-source/tools/python_api/test/test_arrow.py +694 -0
  76. real_ladybug-source/tools/python_api/test/test_async_connection.py +159 -0
  77. real_ladybug-source/tools/python_api/test/test_blob_parameter.py +145 -0
  78. real_ladybug-source/tools/python_api/test/test_connection.py +49 -0
  79. real_ladybug-source/tools/python_api/test/test_database.py +234 -0
  80. real_ladybug-source/tools/python_api/test/test_datatype.py +372 -0
  81. real_ladybug-source/tools/python_api/test/test_df.py +564 -0
  82. real_ladybug-source/tools/python_api/test/test_dict.py +112 -0
  83. real_ladybug-source/tools/python_api/test/test_exception.py +54 -0
  84. real_ladybug-source/tools/python_api/test/test_fsm.py +227 -0
  85. real_ladybug-source/tools/python_api/test/test_get_header.py +49 -0
  86. real_ladybug-source/tools/python_api/test/test_helper.py +8 -0
  87. real_ladybug-source/tools/python_api/test/test_issue.py +147 -0
  88. real_ladybug-source/tools/python_api/test/test_iteration.py +96 -0
  89. real_ladybug-source/tools/python_api/test/test_networkx.py +437 -0
  90. real_ladybug-source/tools/python_api/test/test_parameter.py +340 -0
  91. real_ladybug-source/tools/python_api/test/test_prepared_statement.py +117 -0
  92. real_ladybug-source/tools/python_api/test/test_query_result.py +54 -0
  93. real_ladybug-source/tools/python_api/test/test_query_result_close.py +44 -0
  94. real_ladybug-source/tools/python_api/test/test_scan_pandas.py +676 -0
  95. real_ladybug-source/tools/python_api/test/test_scan_pandas_pyarrow.py +714 -0
  96. real_ladybug-source/tools/python_api/test/test_scan_polars.py +165 -0
  97. real_ladybug-source/tools/python_api/test/test_scan_pyarrow.py +167 -0
  98. real_ladybug-source/tools/python_api/test/test_timeout.py +11 -0
  99. real_ladybug-source/tools/python_api/test/test_torch_geometric.py +640 -0
  100. real_ladybug-source/tools/python_api/test/test_torch_geometric_remote_backend.py +111 -0
  101. real_ladybug-source/tools/python_api/test/test_udf.py +207 -0
  102. real_ladybug-source/tools/python_api/test/test_version.py +6 -0
  103. real_ladybug-source/tools/python_api/test/test_wal.py +80 -0
  104. real_ladybug-source/tools/python_api/test/type_aliases.py +10 -0
  105. real_ladybug-source/tools/rust_api/update_version.py +47 -0
  106. real_ladybug-source/tools/shell/test/conftest.py +218 -0
  107. real_ladybug-source/tools/shell/test/test_helper.py +60 -0
  108. real_ladybug-source/tools/shell/test/test_shell_basics.py +325 -0
  109. real_ladybug-source/tools/shell/test/test_shell_commands.py +656 -0
  110. real_ladybug-source/tools/shell/test/test_shell_control_edit.py +438 -0
  111. real_ladybug-source/tools/shell/test/test_shell_control_search.py +468 -0
  112. real_ladybug-source/tools/shell/test/test_shell_esc_edit.py +232 -0
  113. real_ladybug-source/tools/shell/test/test_shell_esc_search.py +162 -0
  114. real_ladybug-source/tools/shell/test/test_shell_flags.py +645 -0
@@ -0,0 +1,468 @@
1
+ import os
2
+
3
+ import pexpect
4
+ import pytest
5
+
6
+ from conftest import ShellTest
7
+ from test_helper import KEY_ACTION, deleteIfExists
8
+
9
+
10
+ def set_up_search(test) -> None:
11
+ test.send_finished_statement('RETURN "databases rule" AS a;\r')
12
+ assert (
13
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
14
+ == 0
15
+ )
16
+ test.send_finished_statement('RETURN "lbug is cool" AS b;\r')
17
+ assert (
18
+ test.shell_process.expect_exact(["\u2502 lbug is cool \u2502", pexpect.EOF])
19
+ == 0
20
+ )
21
+ test.send_finished_statement('RETURN "the shell is fun" AS c;\r')
22
+ assert (
23
+ test.shell_process.expect_exact(["\u2502 the shell is fun \u2502", pexpect.EOF])
24
+ == 0
25
+ )
26
+ test.send_control_statement(KEY_ACTION.CTRL_R.value)
27
+
28
+
29
+ @pytest.mark.parametrize(
30
+ "key",
31
+ [
32
+ KEY_ACTION.ENTER.value,
33
+ "\n",
34
+ ],
35
+ )
36
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
37
+ def test_enter(test, key) -> None:
38
+ set_up_search(test)
39
+ test.send_statement("databases")
40
+ test.send_finished_statement(key)
41
+ assert (
42
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
43
+ == 0
44
+ )
45
+
46
+
47
+ @pytest.mark.parametrize(
48
+ "key",
49
+ [
50
+ KEY_ACTION.CTRL_R.value,
51
+ KEY_ACTION.CTRL_N.value,
52
+ ],
53
+ )
54
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
55
+ def test_search_next_once(test, key, history_path) -> None:
56
+ # test search next once
57
+ set_up_search(test)
58
+ test.send_control_statement(key)
59
+ test.send_finished_statement(KEY_ACTION.ENTER.value)
60
+ assert (
61
+ test.shell_process.expect_exact(["\u2502 the shell is fun \u2502", pexpect.EOF])
62
+ == 0
63
+ )
64
+
65
+
66
+ @pytest.mark.parametrize(
67
+ "key",
68
+ [
69
+ KEY_ACTION.CTRL_R.value,
70
+ KEY_ACTION.CTRL_N.value,
71
+ ],
72
+ )
73
+ @pytest.mark.parametrize("mode", [":multiline\n", ":singleline\n"])
74
+ def test_search_next_top(temp_db, mode, key, history_path) -> None:
75
+ # test search next until top of history
76
+ test = (
77
+ ShellTest().add_argument(temp_db).add_argument("-p").add_argument(history_path)
78
+ )
79
+ test.start()
80
+ test.send_finished_statement('RETURN "databases are really cool" AS a;\r')
81
+ test.send_finished_statement(mode)
82
+ set_up_search(test)
83
+ for _ in range(6):
84
+ test.send_control_statement(key)
85
+ test.send_finished_statement(KEY_ACTION.ENTER.value)
86
+ assert (
87
+ test.shell_process.expect_exact(
88
+ ["\u2502 databases are really cool \u2502", pexpect.EOF]
89
+ )
90
+ == 0
91
+ )
92
+ deleteIfExists(os.path.join(history_path, "history.txt"))
93
+
94
+
95
+ @pytest.mark.parametrize(
96
+ "key",
97
+ [
98
+ KEY_ACTION.CTRL_S.value,
99
+ KEY_ACTION.CTRL_P.value,
100
+ ],
101
+ )
102
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
103
+ def test_search_prev_once(test, key) -> None:
104
+ # test search prev once
105
+ set_up_search(test)
106
+ test.send_control_statement(KEY_ACTION.CTRL_R.value)
107
+ test.send_control_statement(KEY_ACTION.CTRL_R.value)
108
+ test.send_control_statement(key)
109
+ test.send_finished_statement(KEY_ACTION.ENTER.value)
110
+ assert (
111
+ test.shell_process.expect_exact(["\u2502 the shell is fun \u2502", pexpect.EOF])
112
+ == 0
113
+ )
114
+
115
+
116
+ @pytest.mark.parametrize(
117
+ "key",
118
+ [
119
+ KEY_ACTION.CTRL_S.value,
120
+ KEY_ACTION.CTRL_P.value,
121
+ ],
122
+ )
123
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
124
+ def test_search_prev_bottom(test, key) -> None:
125
+ # test search prev until bottom of history
126
+ test.send_finished_statement('RETURN "lbug is cool" AS b;\r')
127
+ assert (
128
+ test.shell_process.expect_exact(["\u2502 lbug is cool \u2502", pexpect.EOF])
129
+ == 0
130
+ )
131
+ test.send_finished_statement('RETURN "the shell is fun" AS c;\r')
132
+ assert (
133
+ test.shell_process.expect_exact(["\u2502 the shell is fun \u2502", pexpect.EOF])
134
+ == 0
135
+ )
136
+ test.send_statement('RETURN "searching history" AS d;')
137
+ # start search and move further into history
138
+ for _ in range(3):
139
+ test.send_control_statement(KEY_ACTION.CTRL_R.value)
140
+ # move back to bottom of history
141
+ for _ in range(3):
142
+ test.send_control_statement(key)
143
+ test.send_finished_statement(KEY_ACTION.ENTER.value)
144
+ assert (
145
+ test.shell_process.expect_exact(
146
+ ["\u2502 searching history \u2502", pexpect.EOF]
147
+ )
148
+ == 0
149
+ )
150
+
151
+
152
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
153
+ def test_ctrl_a(test) -> None:
154
+ test.send_finished_statement('"databases rule" AS a;\r')
155
+ assert (
156
+ test.shell_process.expect_exact(
157
+ [
158
+ "Error: Parser exception: extraneous input '\"databases rule\"'",
159
+ pexpect.EOF,
160
+ ],
161
+ )
162
+ == 0
163
+ )
164
+ test.send_control_statement(KEY_ACTION.CTRL_R.value)
165
+ test.send_statement("databases")
166
+ test.send_control_statement(KEY_ACTION.CTRL_A.value)
167
+ test.send_statement("RETURN ")
168
+ test.send_statement("\x1b[F") # move cursor to end
169
+ test.send_finished_statement(KEY_ACTION.ENTER.value)
170
+ assert (
171
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
172
+ == 0
173
+ )
174
+
175
+
176
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
177
+ def test_tab(test) -> None:
178
+ # test tab becomes space when part of pasted input
179
+ set_up_search(test)
180
+ test.send_statement("databases\trule")
181
+ test.send_finished_statement(KEY_ACTION.ENTER.value)
182
+ assert (
183
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
184
+ == 0
185
+ )
186
+
187
+
188
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
189
+ def test_tab_complete(test) -> None:
190
+ # test tab complete search and go to end of line
191
+ test.send_finished_statement("RETURN databases;\r")
192
+ assert (
193
+ test.shell_process.expect_exact(
194
+ [
195
+ "Error: Binder exception: Variable databases is not in scope.",
196
+ pexpect.EOF,
197
+ ],
198
+ )
199
+ == 0
200
+ )
201
+ test.send_control_statement(KEY_ACTION.CTRL_R.value)
202
+ test.send_statement("databases")
203
+ test.send_statement(KEY_ACTION.TAB.value)
204
+ test.send_statement(KEY_ACTION.BACKSPACE.value) # remove semicolon
205
+ test.send_statement("\x1b[D" * 9)
206
+ test.send_statement('"\x1b[F')
207
+ test.send_finished_statement(' rule" AS a;\r')
208
+ assert (
209
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
210
+ == 0
211
+ )
212
+
213
+
214
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
215
+ def test_ctrl_e(test) -> None:
216
+ test.send_finished_statement("RETURN ;\r")
217
+ assert (
218
+ test.shell_process.expect_exact(
219
+ [
220
+ "Error: Parser exception: Invalid input <RETURN ;>: expected rule oC_RegularQuery (line: 1, offset: 7)",
221
+ pexpect.EOF,
222
+ ],
223
+ )
224
+ == 0
225
+ )
226
+ test.send_control_statement(KEY_ACTION.CTRL_R.value)
227
+ test.send_statement("return")
228
+ test.send_control_statement(KEY_ACTION.CTRL_E.value)
229
+ test.send_statement(KEY_ACTION.BACKSPACE.value) # remove semicolon
230
+ test.send_finished_statement('"databases rule" AS a;\r')
231
+ assert (
232
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
233
+ == 0
234
+ )
235
+
236
+
237
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
238
+ def test_ctrl_b(test) -> None:
239
+ test.send_finished_statement('RETURN "databasesrule" AS a;\r')
240
+ assert (
241
+ test.shell_process.expect_exact(["\u2502 databasesrule \u2502", pexpect.EOF])
242
+ == 0
243
+ )
244
+ test.send_control_statement(KEY_ACTION.CTRL_R.value)
245
+ test.send_statement("databasesr")
246
+ test.send_control_statement(KEY_ACTION.CTRL_B.value)
247
+ test.send_finished_statement(" \x1b[F\r")
248
+ assert (
249
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
250
+ == 0
251
+ )
252
+
253
+
254
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
255
+ def test_ctrl_f(test) -> None:
256
+ test.send_finished_statement('RETURN "databasesrule" AS a;\r')
257
+ assert (
258
+ test.shell_process.expect_exact(["\u2502 databasesrule \u2502", pexpect.EOF])
259
+ == 0
260
+ )
261
+ test.send_control_statement(KEY_ACTION.CTRL_R.value)
262
+ test.send_statement("database")
263
+ test.send_control_statement(KEY_ACTION.CTRL_F.value)
264
+ test.send_finished_statement(" \x1b[F\r")
265
+ assert (
266
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
267
+ == 0
268
+ )
269
+
270
+
271
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
272
+ def test_ctrl_t(test) -> None:
273
+ test.send_finished_statement('RETURN "database srule" AS a;\r')
274
+ assert (
275
+ test.shell_process.expect_exact(["\u2502 database srule \u2502", pexpect.EOF])
276
+ == 0
277
+ )
278
+ test.send_control_statement(KEY_ACTION.CTRL_R.value)
279
+ test.send_statement("database ")
280
+ test.send_control_statement(KEY_ACTION.CTRL_T.value)
281
+ test.send_finished_statement("\x1b[F\r")
282
+ assert (
283
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
284
+ == 0
285
+ )
286
+
287
+
288
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
289
+ def test_ctrl_u_cleared(test) -> None:
290
+ # check if line was cleared
291
+ test.send_finished_statement('RETURN "databases rule" AS a;\r')
292
+ assert (
293
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
294
+ == 0
295
+ )
296
+ test.send_control_statement(KEY_ACTION.CTRL_R.value)
297
+ test.send_statement("databases")
298
+ test.send_control_statement(KEY_ACTION.CTRL_U.value)
299
+ test.send_finished_statement('RETURN "lbug is cool" AS a;\r')
300
+ assert (
301
+ test.shell_process.expect_exact(["\u2502 lbug is cool \u2502", pexpect.EOF])
302
+ == 0
303
+ )
304
+
305
+
306
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
307
+ def test_ctrl_u_position(test) -> None:
308
+ # check if position in history was maintained
309
+ set_up_search(test)
310
+ test.send_control_statement(KEY_ACTION.CTRL_R.value)
311
+ test.send_statement("is cool")
312
+ test.send_control_statement(KEY_ACTION.CTRL_U.value)
313
+ test.send_finished_statement("\x1b[A\r") # move up in history
314
+ assert (
315
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
316
+ == 0
317
+ )
318
+
319
+
320
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
321
+ def test_ctrl_k(test) -> None:
322
+ test.send_finished_statement('RETURN "databases rule" AS aabc;\r')
323
+ assert (
324
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
325
+ == 0
326
+ )
327
+ test.send_control_statement(KEY_ACTION.CTRL_R.value)
328
+ test.send_statement("As a")
329
+ test.send_control_statement(KEY_ACTION.CTRL_K.value)
330
+ test.send_finished_statement(";\r")
331
+ assert (
332
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
333
+ == 0
334
+ )
335
+
336
+
337
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
338
+ def test_ctrl_d_eof(test) -> None:
339
+ # ctrl d accepts search and acts as EOF when line is empty
340
+ test.send_control_statement(KEY_ACTION.CTRL_R.value)
341
+ test.send_control_statement(KEY_ACTION.CTRL_D.value)
342
+ # search gets accepted
343
+ assert test.shell_process.expect_exact(["lbug", pexpect.EOF]) == 0
344
+ # acts as EOF
345
+ assert test.shell_process.expect_exact(["lbug", pexpect.EOF]) == 1
346
+
347
+
348
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
349
+ def test_ctrl_d_delete(test) -> None:
350
+ # test accepts search and delete
351
+ test.send_finished_statement('RETURN "databases/ rule" AS a;\r')
352
+ assert (
353
+ test.shell_process.expect_exact(["\u2502 databases/ rule \u2502", pexpect.EOF])
354
+ == 0
355
+ )
356
+ test.send_control_statement(KEY_ACTION.CTRL_R.value)
357
+ test.send_statement("databases")
358
+ test.send_control_statement(KEY_ACTION.CTRL_D.value)
359
+ test.send_finished_statement("\x1b[F\r")
360
+ assert (
361
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
362
+ == 0
363
+ )
364
+
365
+
366
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
367
+ def test_ctrl_l_empty(test) -> None:
368
+ # clear screen with empty line
369
+ test.send_finished_statement('RETURN "databases rule" AS a;\r')
370
+ assert (
371
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
372
+ == 0
373
+ )
374
+ test.send_control_statement(KEY_ACTION.CTRL_R.value)
375
+ test.send_control_statement(KEY_ACTION.CTRL_L.value)
376
+ assert test.shell_process.expect_exact(["\x1b[H\x1b[2J", pexpect.EOF]) == 0
377
+ test.send_statement("databases")
378
+ test.send_finished_statement(KEY_ACTION.ENTER.value)
379
+ assert (
380
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
381
+ == 0
382
+ )
383
+
384
+
385
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
386
+ def test_ctrl_l_non_empty(test) -> None:
387
+ # clear screen with non empty line
388
+ test.send_statement('RETURN "databases rule" AS a;')
389
+ test.send_control_statement(KEY_ACTION.CTRL_R.value)
390
+ test.send_control_statement(KEY_ACTION.CTRL_L.value)
391
+ assert test.shell_process.expect_exact(["\x1b[H\x1b[2J", pexpect.EOF]) == 0
392
+ test.send_finished_statement(KEY_ACTION.ENTER.value)
393
+ assert (
394
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
395
+ == 0
396
+ )
397
+
398
+
399
+ @pytest.mark.parametrize(
400
+ "key",
401
+ [
402
+ KEY_ACTION.CTRL_C.value,
403
+ KEY_ACTION.CTRL_G.value,
404
+ ],
405
+ )
406
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
407
+ def test_cancel_search_cleared(test, key) -> None:
408
+ # check if line is cleared
409
+ test.send_finished_statement('RETURN "databases rule" AS a;\r')
410
+ assert (
411
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
412
+ == 0
413
+ )
414
+ test.send_control_statement(KEY_ACTION.CTRL_R.value)
415
+ test.send_statement("databases")
416
+ test.send_control_statement(key)
417
+ test.send_finished_statement('RETURN "lbug is cool" AS a;\r')
418
+ assert (
419
+ test.shell_process.expect_exact(["\u2502 lbug is cool \u2502", pexpect.EOF])
420
+ == 0
421
+ )
422
+
423
+
424
+ @pytest.mark.parametrize(
425
+ "key",
426
+ [
427
+ KEY_ACTION.CTRL_C.value,
428
+ KEY_ACTION.CTRL_G.value,
429
+ ],
430
+ )
431
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
432
+ def test_cancel_search_position(test, key) -> None:
433
+ # check if position in history was maintained
434
+ set_up_search(test)
435
+ test.send_control_statement(KEY_ACTION.CTRL_R.value)
436
+ test.send_statement("is cool")
437
+ test.send_control_statement(KEY_ACTION.CTRL_U.value)
438
+ test.send_statement("\x1b[B") # move down in history
439
+ test.send_finished_statement('RETURN "databases rule" AS a;\r')
440
+ assert (
441
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
442
+ == 0
443
+ )
444
+
445
+
446
+ @pytest.mark.parametrize(
447
+ "key",
448
+ [
449
+ KEY_ACTION.CTRL_H.value,
450
+ KEY_ACTION.BACKSPACE.value,
451
+ KEY_ACTION.CTRL_W.value,
452
+ ],
453
+ )
454
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
455
+ def test_backspace(test, key) -> None:
456
+ test.send_finished_statement('RETURN "databases rule" AS a;\r')
457
+ assert (
458
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
459
+ == 0
460
+ )
461
+ test.send_control_statement(KEY_ACTION.CTRL_R.value)
462
+ test.send_statement("databasesabc")
463
+ test.send_statement(key * 3)
464
+ test.send_finished_statement(KEY_ACTION.ENTER.value)
465
+ assert (
466
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
467
+ == 0
468
+ )
@@ -0,0 +1,232 @@
1
+ import pexpect
2
+ import pytest
3
+ from conftest import ShellTest
4
+ from test_helper import KEY_ACTION
5
+
6
+
7
+ @pytest.mark.parametrize(
8
+ "esc",
9
+ [
10
+ "\x1bb",
11
+ "\x1b[1;5D",
12
+ ],
13
+ )
14
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
15
+ def test_move_word_left(test, esc) -> None:
16
+ test.send_statement("RETURN AS a;")
17
+ test.send_statement(esc * 3)
18
+ test.send_finished_statement(' "databases rule"\x1b[F\r')
19
+ assert (
20
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
21
+ == 0
22
+ )
23
+
24
+
25
+ @pytest.mark.parametrize(
26
+ "esc",
27
+ [
28
+ "\x1bf",
29
+ "\x1b[1;5C",
30
+ ],
31
+ )
32
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
33
+ def test_move_word_right(test, esc) -> None:
34
+ test.send_statement('RETURN "databases a;')
35
+ test.send_control_statement(KEY_ACTION.CTRL_A.value) # move cursor to front of line
36
+ test.send_statement(esc * 3)
37
+ test.send_finished_statement(' rule" AS\x1b[F\r')
38
+ assert (
39
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
40
+ == 0
41
+ )
42
+
43
+
44
+ @pytest.mark.parametrize(
45
+ "esc",
46
+ [
47
+ "\x1b[H",
48
+ "\x1b[1~",
49
+ "\x1bOH",
50
+ ],
51
+ )
52
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
53
+ def test_move_home(test, esc) -> None:
54
+ test.send_statement('ETURN "databases rule" AS a;')
55
+ test.send_statement(esc)
56
+ test.send_finished_statement("R\x1b[F\r")
57
+ assert (
58
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
59
+ == 0
60
+ )
61
+
62
+
63
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
64
+ def test_delete(test) -> None:
65
+ test.send_statement('RETURN "databases rule" AS a;abc')
66
+ for _ in range(3):
67
+ test.send_control_statement(KEY_ACTION.CTRL_B.value)
68
+ test.send_statement("\x1b[3~" * 4)
69
+ test.send_finished_statement(KEY_ACTION.ENTER.value)
70
+ assert (
71
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
72
+ == 0
73
+ )
74
+
75
+
76
+ @pytest.mark.parametrize(
77
+ "esc",
78
+ [
79
+ "\x1b[F",
80
+ "\x1b[4~",
81
+ "\x1bOF",
82
+ ],
83
+ )
84
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
85
+ def test_move_end(test, esc) -> None:
86
+ test.send_statement('RETURN "databases rule" AS a')
87
+ test.send_control_statement(KEY_ACTION.CTRL_A.value) # move cursor to front of line
88
+ test.send_statement(esc)
89
+ test.send_finished_statement(";\r")
90
+ assert (
91
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
92
+ == 0
93
+ )
94
+
95
+
96
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
97
+ def test_next_history_singleline(test) -> None:
98
+ test.send_finished_statement('RETURN "databases rule" AS a;\r')
99
+ assert (
100
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
101
+ == 0
102
+ )
103
+ test.send_statement("\x1b[A")
104
+ test.send_finished_statement(KEY_ACTION.ENTER.value)
105
+ assert (
106
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
107
+ == 0
108
+ )
109
+
110
+
111
+ def test_next_history_multiline(temp_db) -> None:
112
+ # multiline up arrow will move up if not on top line
113
+ test = ShellTest().add_argument(temp_db)
114
+ test.start()
115
+ test.send_finished_statement('RETURN "shell is fun" AS a;\r')
116
+ assert (
117
+ test.shell_process.expect_exact(["\u2502 shell is fun \u2502", pexpect.EOF])
118
+ == 0
119
+ )
120
+ test.send_finished_statement('RETURN "databases rule" AS a;\r')
121
+ assert (
122
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
123
+ == 0
124
+ )
125
+ test.send_finished_statement('RETURN "lbug is cool"\r AS a;\r')
126
+ assert (
127
+ test.shell_process.expect_exact(["\u2502 lbug is cool \u2502", pexpect.EOF])
128
+ == 0
129
+ )
130
+ test.send_statement("\x1b[A\x1b[A\x1b[A")
131
+ test.send_finished_statement(KEY_ACTION.ENTER.value)
132
+ assert (
133
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
134
+ == 0
135
+ )
136
+
137
+ # singleline up arrow will move up regardless
138
+ test = ShellTest().add_argument(temp_db)
139
+ test.start()
140
+ test.send_finished_statement(":singleline\n")
141
+ test.send_finished_statement('RETURN "shell is fun" AS a;\r')
142
+ assert (
143
+ test.shell_process.expect_exact(["\u2502 shell is fun \u2502", pexpect.EOF])
144
+ == 0
145
+ )
146
+ test.send_finished_statement('RETURN "databases rule" AS a;\r')
147
+ assert (
148
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
149
+ == 0
150
+ )
151
+ test.send_finished_statement('RETURN "lbug is cool"\r AS a;\r')
152
+ assert (
153
+ test.shell_process.expect_exact(["\u2502 lbug is cool \u2502", pexpect.EOF])
154
+ == 0
155
+ )
156
+ test.send_statement("\x1b[A\x1b[A\x1b[A")
157
+ test.send_finished_statement(KEY_ACTION.ENTER.value)
158
+ assert (
159
+ test.shell_process.expect_exact(["\u2502 shell is fun \u2502", pexpect.EOF])
160
+ == 0
161
+ )
162
+
163
+
164
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
165
+ def test_prev_history_singleline(test) -> None:
166
+ test.send_finished_statement('RETURN "lbug is cool" AS b;\r')
167
+ assert (
168
+ test.shell_process.expect_exact(["\u2502 lbug is cool \u2502", pexpect.EOF])
169
+ == 0
170
+ )
171
+ test.send_finished_statement('RETURN "databases rule" AS a;\r')
172
+ assert (
173
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
174
+ == 0
175
+ )
176
+ test.send_control_statement(KEY_ACTION.CTRL_P.value) # move up in history
177
+ test.send_control_statement(KEY_ACTION.CTRL_P.value) # move up in history
178
+ test.send_statement("\x1b[B")
179
+ test.send_finished_statement(KEY_ACTION.ENTER.value)
180
+ assert (
181
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
182
+ == 0
183
+ )
184
+
185
+
186
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
187
+ def test_prev_history_multiline(test) -> None:
188
+ # multiline down arrow will move down if not on bottom line
189
+ test.send_finished_statement('RETURN "lbug is cool"\r AS b;\r')
190
+ assert (
191
+ test.shell_process.expect_exact(["\u2502 lbug is cool \u2502", pexpect.EOF])
192
+ == 0
193
+ )
194
+ test.send_finished_statement('RETURN "databases rule" AS a;\r')
195
+ assert (
196
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
197
+ == 0
198
+ )
199
+ test.send_control_statement(KEY_ACTION.CTRL_P.value) # move up in history
200
+ test.send_control_statement(KEY_ACTION.CTRL_P.value) # move up in history
201
+ test.send_control_statement(KEY_ACTION.CTRL_P.value) # move up line
202
+ test.send_statement("\x1b[B")
203
+ test.send_statement("\x1b[B")
204
+ test.send_finished_statement(KEY_ACTION.ENTER.value)
205
+ assert (
206
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
207
+ == 0
208
+ )
209
+
210
+
211
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
212
+ def test_move_left(test) -> None:
213
+ test.send_statement(" a;")
214
+ test.send_statement("\x1b[D" * 4)
215
+ test.send_finished_statement('RETURN "databases rule" AS\x1b[F\r')
216
+ assert (
217
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
218
+ == 0
219
+ )
220
+
221
+
222
+ @pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
223
+ def test_move_right(test) -> None:
224
+ test.send_statement('RETURN "databases rule" AS a')
225
+ for _ in range(3):
226
+ test.send_control_statement(KEY_ACTION.CTRL_B.value) # move cursor to the left
227
+ test.send_statement("\x1b[C" * 4)
228
+ test.send_finished_statement(";\r")
229
+ assert (
230
+ test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
231
+ == 0
232
+ )