real-ladybug 0.0.1.dev1__cp311-cp311-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.
- real_ladybug/__init__.py +83 -0
- real_ladybug/_lbug.cp311-win_amd64.pyd +0 -0
- real_ladybug/_lbug.exp +0 -0
- real_ladybug/_lbug.lib +0 -0
- real_ladybug/async_connection.py +226 -0
- real_ladybug/connection.py +323 -0
- real_ladybug/constants.py +7 -0
- real_ladybug/database.py +307 -0
- real_ladybug/prepared_statement.py +51 -0
- real_ladybug/py.typed +0 -0
- real_ladybug/query_result.py +511 -0
- real_ladybug/torch_geometric_feature_store.py +185 -0
- real_ladybug/torch_geometric_graph_store.py +131 -0
- real_ladybug/torch_geometric_result_converter.py +282 -0
- real_ladybug/types.py +39 -0
- real_ladybug-0.0.1.dev1.dist-info/METADATA +88 -0
- real_ladybug-0.0.1.dev1.dist-info/RECORD +114 -0
- real_ladybug-0.0.1.dev1.dist-info/WHEEL +5 -0
- real_ladybug-0.0.1.dev1.dist-info/licenses/LICENSE +21 -0
- real_ladybug-0.0.1.dev1.dist-info/top_level.txt +3 -0
- real_ladybug-0.0.1.dev1.dist-info/zip-safe +1 -0
- real_ladybug-source/scripts/antlr4/hash.py +2 -0
- real_ladybug-source/scripts/antlr4/keywordhandler.py +47 -0
- real_ladybug-source/scripts/collect-extensions.py +68 -0
- real_ladybug-source/scripts/collect-single-file-header.py +126 -0
- real_ladybug-source/scripts/export-dbs.py +101 -0
- real_ladybug-source/scripts/export-import-test.py +345 -0
- real_ladybug-source/scripts/extension/purge-beta.py +34 -0
- real_ladybug-source/scripts/generate-cpp-docs/collect_files.py +122 -0
- real_ladybug-source/scripts/generate-tinysnb.py +34 -0
- real_ladybug-source/scripts/get-clangd-diagnostics.py +233 -0
- real_ladybug-source/scripts/migrate-lbug-db.py +308 -0
- real_ladybug-source/scripts/multiplatform-test-helper/collect-results.py +71 -0
- real_ladybug-source/scripts/multiplatform-test-helper/notify-discord.py +68 -0
- real_ladybug-source/scripts/pip-package/package_tar.py +90 -0
- real_ladybug-source/scripts/pip-package/setup.py +130 -0
- real_ladybug-source/scripts/run-clang-format.py +408 -0
- real_ladybug-source/scripts/setup-extension-repo.py +67 -0
- real_ladybug-source/scripts/test-simsimd-dispatch.py +45 -0
- real_ladybug-source/scripts/update-nightly-build-version.py +81 -0
- real_ladybug-source/third_party/brotli/scripts/dictionary/step-01-download-rfc.py +16 -0
- real_ladybug-source/third_party/brotli/scripts/dictionary/step-02-rfc-to-bin.py +34 -0
- real_ladybug-source/third_party/brotli/scripts/dictionary/step-03-validate-bin.py +35 -0
- real_ladybug-source/third_party/brotli/scripts/dictionary/step-04-generate-java-literals.py +85 -0
- real_ladybug-source/third_party/pybind11/tools/codespell_ignore_lines_from_errors.py +35 -0
- real_ladybug-source/third_party/pybind11/tools/libsize.py +36 -0
- real_ladybug-source/third_party/pybind11/tools/make_changelog.py +63 -0
- real_ladybug-source/tools/python_api/build/real_ladybug/__init__.py +83 -0
- real_ladybug-source/tools/python_api/build/real_ladybug/async_connection.py +226 -0
- real_ladybug-source/tools/python_api/build/real_ladybug/connection.py +323 -0
- real_ladybug-source/tools/python_api/build/real_ladybug/constants.py +7 -0
- real_ladybug-source/tools/python_api/build/real_ladybug/database.py +307 -0
- real_ladybug-source/tools/python_api/build/real_ladybug/prepared_statement.py +51 -0
- real_ladybug-source/tools/python_api/build/real_ladybug/py.typed +0 -0
- real_ladybug-source/tools/python_api/build/real_ladybug/query_result.py +511 -0
- real_ladybug-source/tools/python_api/build/real_ladybug/torch_geometric_feature_store.py +185 -0
- real_ladybug-source/tools/python_api/build/real_ladybug/torch_geometric_graph_store.py +131 -0
- real_ladybug-source/tools/python_api/build/real_ladybug/torch_geometric_result_converter.py +282 -0
- real_ladybug-source/tools/python_api/build/real_ladybug/types.py +39 -0
- real_ladybug-source/tools/python_api/src_py/__init__.py +83 -0
- real_ladybug-source/tools/python_api/src_py/async_connection.py +226 -0
- real_ladybug-source/tools/python_api/src_py/connection.py +323 -0
- real_ladybug-source/tools/python_api/src_py/constants.py +7 -0
- real_ladybug-source/tools/python_api/src_py/database.py +307 -0
- real_ladybug-source/tools/python_api/src_py/prepared_statement.py +51 -0
- real_ladybug-source/tools/python_api/src_py/py.typed +0 -0
- real_ladybug-source/tools/python_api/src_py/query_result.py +511 -0
- real_ladybug-source/tools/python_api/src_py/torch_geometric_feature_store.py +185 -0
- real_ladybug-source/tools/python_api/src_py/torch_geometric_graph_store.py +131 -0
- real_ladybug-source/tools/python_api/src_py/torch_geometric_result_converter.py +282 -0
- real_ladybug-source/tools/python_api/src_py/types.py +39 -0
- real_ladybug-source/tools/python_api/test/conftest.py +230 -0
- real_ladybug-source/tools/python_api/test/disabled_test_extension.py +73 -0
- real_ladybug-source/tools/python_api/test/ground_truth.py +430 -0
- real_ladybug-source/tools/python_api/test/test_arrow.py +694 -0
- real_ladybug-source/tools/python_api/test/test_async_connection.py +159 -0
- real_ladybug-source/tools/python_api/test/test_blob_parameter.py +145 -0
- real_ladybug-source/tools/python_api/test/test_connection.py +49 -0
- real_ladybug-source/tools/python_api/test/test_database.py +234 -0
- real_ladybug-source/tools/python_api/test/test_datatype.py +372 -0
- real_ladybug-source/tools/python_api/test/test_df.py +564 -0
- real_ladybug-source/tools/python_api/test/test_dict.py +112 -0
- real_ladybug-source/tools/python_api/test/test_exception.py +54 -0
- real_ladybug-source/tools/python_api/test/test_fsm.py +227 -0
- real_ladybug-source/tools/python_api/test/test_get_header.py +49 -0
- real_ladybug-source/tools/python_api/test/test_helper.py +8 -0
- real_ladybug-source/tools/python_api/test/test_issue.py +147 -0
- real_ladybug-source/tools/python_api/test/test_iteration.py +96 -0
- real_ladybug-source/tools/python_api/test/test_networkx.py +437 -0
- real_ladybug-source/tools/python_api/test/test_parameter.py +340 -0
- real_ladybug-source/tools/python_api/test/test_prepared_statement.py +117 -0
- real_ladybug-source/tools/python_api/test/test_query_result.py +54 -0
- real_ladybug-source/tools/python_api/test/test_query_result_close.py +44 -0
- real_ladybug-source/tools/python_api/test/test_scan_pandas.py +676 -0
- real_ladybug-source/tools/python_api/test/test_scan_pandas_pyarrow.py +714 -0
- real_ladybug-source/tools/python_api/test/test_scan_polars.py +165 -0
- real_ladybug-source/tools/python_api/test/test_scan_pyarrow.py +167 -0
- real_ladybug-source/tools/python_api/test/test_timeout.py +11 -0
- real_ladybug-source/tools/python_api/test/test_torch_geometric.py +640 -0
- real_ladybug-source/tools/python_api/test/test_torch_geometric_remote_backend.py +111 -0
- real_ladybug-source/tools/python_api/test/test_udf.py +207 -0
- real_ladybug-source/tools/python_api/test/test_version.py +6 -0
- real_ladybug-source/tools/python_api/test/test_wal.py +80 -0
- real_ladybug-source/tools/python_api/test/type_aliases.py +10 -0
- real_ladybug-source/tools/rust_api/update_version.py +47 -0
- real_ladybug-source/tools/shell/test/conftest.py +218 -0
- real_ladybug-source/tools/shell/test/test_helper.py +60 -0
- real_ladybug-source/tools/shell/test/test_shell_basics.py +325 -0
- real_ladybug-source/tools/shell/test/test_shell_commands.py +656 -0
- real_ladybug-source/tools/shell/test/test_shell_control_edit.py +438 -0
- real_ladybug-source/tools/shell/test/test_shell_control_search.py +468 -0
- real_ladybug-source/tools/shell/test/test_shell_esc_edit.py +232 -0
- real_ladybug-source/tools/shell/test/test_shell_esc_search.py +162 -0
- real_ladybug-source/tools/shell/test/test_shell_flags.py +645 -0
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
import pexpect
|
|
4
|
+
import pytest
|
|
5
|
+
from conftest import ShellTest
|
|
6
|
+
from test_helper import KEY_ACTION, deleteIfExists
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@pytest.mark.parametrize(
|
|
10
|
+
"key",
|
|
11
|
+
[
|
|
12
|
+
KEY_ACTION.CTRL_C.value,
|
|
13
|
+
KEY_ACTION.CTRL_G.value,
|
|
14
|
+
],
|
|
15
|
+
)
|
|
16
|
+
@pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
|
|
17
|
+
def test_sigint_two_consecutive(key, test) -> None:
|
|
18
|
+
# test two consecutive signit required to exit shell
|
|
19
|
+
test.send_control_statement(key)
|
|
20
|
+
test.send_control_statement(key)
|
|
21
|
+
assert test.shell_process.expect_exact(["lbug", pexpect.EOF]) == 1
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@pytest.mark.parametrize(
|
|
25
|
+
"key",
|
|
26
|
+
[
|
|
27
|
+
KEY_ACTION.CTRL_C.value,
|
|
28
|
+
KEY_ACTION.CTRL_G.value,
|
|
29
|
+
],
|
|
30
|
+
)
|
|
31
|
+
@pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
|
|
32
|
+
def test_sigint_line_interupts(key, test) -> None:
|
|
33
|
+
# test sending line interupts the two signits to quit
|
|
34
|
+
test.send_control_statement(key)
|
|
35
|
+
test.send_finished_statement('RETURN "databases rule" AS a;\r')
|
|
36
|
+
assert (
|
|
37
|
+
test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
|
|
38
|
+
== 0
|
|
39
|
+
)
|
|
40
|
+
test.send_control_statement(key)
|
|
41
|
+
test.send_control_statement(key)
|
|
42
|
+
assert test.shell_process.expect_exact(["lbug", pexpect.EOF]) == 1
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@pytest.mark.parametrize(
|
|
46
|
+
"key",
|
|
47
|
+
[
|
|
48
|
+
KEY_ACTION.CTRL_C.value,
|
|
49
|
+
KEY_ACTION.CTRL_G.value,
|
|
50
|
+
],
|
|
51
|
+
)
|
|
52
|
+
@pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
|
|
53
|
+
def test_sigint_cancels_query(key, test) -> None:
|
|
54
|
+
# test sigint cancels the query
|
|
55
|
+
test.send_statement("CREATE NODE TABLE t0(i STRING, PRIMARY KEY(i));")
|
|
56
|
+
test.send_control_statement(key)
|
|
57
|
+
test.send_finished_statement("MATCH (a:t0) RETURN *;\r")
|
|
58
|
+
assert (
|
|
59
|
+
test.shell_process.expect_exact(
|
|
60
|
+
["Error: Binder exception: Table t0 does not exist.", pexpect.EOF],
|
|
61
|
+
)
|
|
62
|
+
== 0
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
@pytest.mark.parametrize(
|
|
67
|
+
"key",
|
|
68
|
+
[
|
|
69
|
+
KEY_ACTION.ENTER.value,
|
|
70
|
+
"\n",
|
|
71
|
+
],
|
|
72
|
+
)
|
|
73
|
+
@pytest.mark.parametrize("mode", [":multiline\n", ":singleline\n"])
|
|
74
|
+
def test_enter(temp_db, key, history_path, mode) -> None:
|
|
75
|
+
test = (
|
|
76
|
+
ShellTest().add_argument(temp_db).add_argument("-p").add_argument(history_path)
|
|
77
|
+
)
|
|
78
|
+
test.start()
|
|
79
|
+
test.send_finished_statement(mode)
|
|
80
|
+
test.send_statement('RETURN "databases rule" AS a;')
|
|
81
|
+
test.send_finished_statement(key)
|
|
82
|
+
assert (
|
|
83
|
+
test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
|
|
84
|
+
== 0
|
|
85
|
+
)
|
|
86
|
+
assert test.shell_process.expect_exact(["lbug", pexpect.EOF]) == 0
|
|
87
|
+
|
|
88
|
+
with open(os.path.join(history_path, "history.txt")) as f:
|
|
89
|
+
assert f.readline() == mode
|
|
90
|
+
assert f.readline() == 'RETURN "databases rule" AS a;\n'
|
|
91
|
+
deleteIfExists(os.path.join(history_path, "history.txt"))
|
|
92
|
+
|
|
93
|
+
# enter in multiline when not at the end of the line should not execute the query
|
|
94
|
+
test = (
|
|
95
|
+
ShellTest().add_argument(temp_db).add_argument("-p").add_argument(history_path)
|
|
96
|
+
)
|
|
97
|
+
test.start()
|
|
98
|
+
test.send_finished_statement(mode)
|
|
99
|
+
test.send_statement('RETURN "databases rule" AS a;\x1b[D\x1b[D\x1b[D')
|
|
100
|
+
test.send_finished_statement(key)
|
|
101
|
+
assert test.shell_process.expect_exact(["lbug", pexpect.EOF]) == 0
|
|
102
|
+
|
|
103
|
+
with open(os.path.join(history_path, "history.txt")) as f:
|
|
104
|
+
assert f.readline() == mode
|
|
105
|
+
assert f.readline() != 'RETURN "databases rule" AS a;\n'
|
|
106
|
+
deleteIfExists(os.path.join(history_path, "history.txt"))
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
@pytest.mark.parametrize(
|
|
110
|
+
"key",
|
|
111
|
+
[
|
|
112
|
+
KEY_ACTION.BACKSPACE.value,
|
|
113
|
+
KEY_ACTION.CTRL_H.value,
|
|
114
|
+
],
|
|
115
|
+
)
|
|
116
|
+
@pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
|
|
117
|
+
def test_backspace(key, test) -> None:
|
|
118
|
+
test.send_statement('RETURN "databases rule" AS a;abc')
|
|
119
|
+
test.send_statement(key * 3)
|
|
120
|
+
test.send_finished_statement(KEY_ACTION.ENTER.value)
|
|
121
|
+
assert (
|
|
122
|
+
test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
|
|
123
|
+
== 0
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
@pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
|
|
128
|
+
def test_ctrl_d_eof(test) -> None:
|
|
129
|
+
# ctrl d acts as EOF when line is empty
|
|
130
|
+
test.send_control_statement(KEY_ACTION.CTRL_D.value)
|
|
131
|
+
assert test.shell_process.expect_exact(["lbug", pexpect.EOF]) == 1
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
@pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
|
|
135
|
+
def test_ctrl_d_delete(test) -> None:
|
|
136
|
+
# ctrl d deletes characters to the right
|
|
137
|
+
test.send_statement('RETURN "databases rule" AS a;abc')
|
|
138
|
+
test.send_statement("\x1b[D" * 3) # move cursor to the left
|
|
139
|
+
for _ in range(4):
|
|
140
|
+
test.send_control_statement(KEY_ACTION.CTRL_D.value)
|
|
141
|
+
test.send_finished_statement(KEY_ACTION.ENTER.value)
|
|
142
|
+
assert (
|
|
143
|
+
test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
|
|
144
|
+
== 0
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
@pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
|
|
149
|
+
def test_ctrl_t(test) -> None:
|
|
150
|
+
test.send_statement('RETURN "databases rule" AS ;a')
|
|
151
|
+
test.send_statement("\x1b[D") # move cursor to the left
|
|
152
|
+
test.send_control_statement(KEY_ACTION.CTRL_T.value)
|
|
153
|
+
test.shell_process.sendcontrol(KEY_ACTION.CTRL_T.value) # line does not refresh
|
|
154
|
+
test.send_finished_statement(KEY_ACTION.ENTER.value)
|
|
155
|
+
assert (
|
|
156
|
+
test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
|
|
157
|
+
== 0
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
@pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
|
|
162
|
+
def test_ctrl_b(test) -> None:
|
|
163
|
+
test.send_statement(";")
|
|
164
|
+
test.send_control_statement(KEY_ACTION.CTRL_B.value)
|
|
165
|
+
test.shell_process.sendcontrol(KEY_ACTION.CTRL_B.value) # line does not refresh
|
|
166
|
+
test.send_finished_statement(
|
|
167
|
+
'RETURN "databases rule" AS a\x1b[C\r'
|
|
168
|
+
) # move cursor to the right one
|
|
169
|
+
assert (
|
|
170
|
+
test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
|
|
171
|
+
== 0
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
@pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
|
|
176
|
+
def test_ctrl_f(test) -> None:
|
|
177
|
+
test.send_statement('RETURN "databases rule" AS a')
|
|
178
|
+
test.send_statement("\x1b[D") # move cursor to the left
|
|
179
|
+
test.send_control_statement(KEY_ACTION.CTRL_F.value)
|
|
180
|
+
test.shell_process.sendcontrol(KEY_ACTION.CTRL_F.value) # line does not refresh
|
|
181
|
+
test.send_finished_statement(";\r")
|
|
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_ctrl_p(test) -> None:
|
|
190
|
+
test.send_finished_statement('RETURN "databases rule" AS a;\r')
|
|
191
|
+
assert (
|
|
192
|
+
test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
|
|
193
|
+
== 0
|
|
194
|
+
)
|
|
195
|
+
test.send_control_statement(KEY_ACTION.CTRL_P.value)
|
|
196
|
+
test.send_finished_statement(KEY_ACTION.ENTER.value)
|
|
197
|
+
assert (
|
|
198
|
+
test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
|
|
199
|
+
== 0
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
@pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
|
|
204
|
+
def test_ctrl_n(test) -> None:
|
|
205
|
+
test.send_finished_statement('RETURN "lbug is cool" AS b;\r')
|
|
206
|
+
assert (
|
|
207
|
+
test.shell_process.expect_exact(["\u2502 lbug is cool \u2502", pexpect.EOF])
|
|
208
|
+
== 0
|
|
209
|
+
)
|
|
210
|
+
test.send_finished_statement('RETURN "databases rule" AS a;\r')
|
|
211
|
+
assert (
|
|
212
|
+
test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
|
|
213
|
+
== 0
|
|
214
|
+
)
|
|
215
|
+
test.send_statement("\x1b[A" * 2) # move up in history
|
|
216
|
+
test.send_control_statement(KEY_ACTION.CTRL_N.value)
|
|
217
|
+
test.send_finished_statement(KEY_ACTION.ENTER.value)
|
|
218
|
+
assert (
|
|
219
|
+
test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
|
|
220
|
+
== 0
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
@pytest.mark.parametrize(
|
|
225
|
+
"key",
|
|
226
|
+
[
|
|
227
|
+
KEY_ACTION.CTRL_R.value,
|
|
228
|
+
KEY_ACTION.CTRL_S.value,
|
|
229
|
+
],
|
|
230
|
+
)
|
|
231
|
+
@pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
|
|
232
|
+
def test_search_opens(test, key, history_path) -> None:
|
|
233
|
+
# test search opens
|
|
234
|
+
test.send_control_statement(key)
|
|
235
|
+
assert test.shell_process.expect_exact(["lbug", pexpect.EOF]) == 0
|
|
236
|
+
assert test.shell_process.expect_exact(["bck-i-search: _", pexpect.EOF]) == 0
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
@pytest.mark.parametrize(
|
|
240
|
+
"key",
|
|
241
|
+
[
|
|
242
|
+
KEY_ACTION.CTRL_R.value,
|
|
243
|
+
KEY_ACTION.CTRL_S.value,
|
|
244
|
+
],
|
|
245
|
+
)
|
|
246
|
+
@pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
|
|
247
|
+
def test_search_good(test, key) -> None:
|
|
248
|
+
# test successful search
|
|
249
|
+
test.send_finished_statement('RETURN "databases rule" AS a;\r')
|
|
250
|
+
assert (
|
|
251
|
+
test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
|
|
252
|
+
== 0
|
|
253
|
+
)
|
|
254
|
+
test.send_finished_statement('RETURN "lbug is cool" AS b;\r')
|
|
255
|
+
assert (
|
|
256
|
+
test.shell_process.expect_exact(["\u2502 lbug is cool \u2502", pexpect.EOF])
|
|
257
|
+
== 0
|
|
258
|
+
)
|
|
259
|
+
test.send_control_statement(key)
|
|
260
|
+
test.send_statement("databases")
|
|
261
|
+
test.send_finished_statement(KEY_ACTION.ENTER.value)
|
|
262
|
+
assert (
|
|
263
|
+
test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
|
|
264
|
+
== 0
|
|
265
|
+
)
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
@pytest.mark.parametrize(
|
|
269
|
+
"key",
|
|
270
|
+
[
|
|
271
|
+
KEY_ACTION.CTRL_R.value,
|
|
272
|
+
KEY_ACTION.CTRL_S.value,
|
|
273
|
+
],
|
|
274
|
+
)
|
|
275
|
+
@pytest.mark.parametrize("mode", [":multiline\n", ":singleline\n"])
|
|
276
|
+
def test_search_bad(mode, temp_db, key, history_path) -> None:
|
|
277
|
+
# test failing search
|
|
278
|
+
test = (
|
|
279
|
+
ShellTest().add_argument(temp_db).add_argument("-p").add_argument(history_path)
|
|
280
|
+
)
|
|
281
|
+
test.start()
|
|
282
|
+
test.send_finished_statement(mode)
|
|
283
|
+
test.send_finished_statement('RETURN "databases rule" AS a;\r')
|
|
284
|
+
assert (
|
|
285
|
+
test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
|
|
286
|
+
== 0
|
|
287
|
+
)
|
|
288
|
+
test.send_finished_statement('RETURN "lbug is cool" AS b;\r')
|
|
289
|
+
assert (
|
|
290
|
+
test.shell_process.expect_exact(["\u2502 lbug is cool \u2502", pexpect.EOF])
|
|
291
|
+
== 0
|
|
292
|
+
)
|
|
293
|
+
test.send_control_statement(key)
|
|
294
|
+
test.send_statement("databases are cool")
|
|
295
|
+
assert test.shell_process.expect_exact(["failing-bck-i-search:", pexpect.EOF]) == 0
|
|
296
|
+
# enter should process last match
|
|
297
|
+
test.send_finished_statement(KEY_ACTION.ENTER.value)
|
|
298
|
+
assert (
|
|
299
|
+
test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
|
|
300
|
+
== 0
|
|
301
|
+
)
|
|
302
|
+
deleteIfExists(os.path.join(history_path, "history.txt"))
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
@pytest.mark.parametrize(
|
|
306
|
+
"key",
|
|
307
|
+
[
|
|
308
|
+
KEY_ACTION.CTRL_R.value,
|
|
309
|
+
KEY_ACTION.CTRL_S.value,
|
|
310
|
+
],
|
|
311
|
+
)
|
|
312
|
+
@pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
|
|
313
|
+
def test_search(test, key) -> None:
|
|
314
|
+
# test starting search with text inputted already
|
|
315
|
+
test.send_statement('RETURN "databases rule" AS a;')
|
|
316
|
+
test.send_control_statement(key)
|
|
317
|
+
test.send_finished_statement(KEY_ACTION.ENTER.value)
|
|
318
|
+
assert (
|
|
319
|
+
test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
|
|
320
|
+
== 0
|
|
321
|
+
)
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
@pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
|
|
325
|
+
def test_ctrl_u(test) -> None:
|
|
326
|
+
test.send_statement("CREATE NODE TABLE t0(i STRING, PRIMARY KEY(i));")
|
|
327
|
+
test.send_control_statement(KEY_ACTION.CTRL_U.value)
|
|
328
|
+
test.send_finished_statement(KEY_ACTION.ENTER.value)
|
|
329
|
+
test.send_finished_statement("MATCH (a:t0) RETURN *;\r")
|
|
330
|
+
assert (
|
|
331
|
+
test.shell_process.expect_exact(
|
|
332
|
+
["Error: Binder exception: Table t0 does not exist.", pexpect.EOF],
|
|
333
|
+
)
|
|
334
|
+
== 0
|
|
335
|
+
)
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
@pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
|
|
339
|
+
def test_ctrl_k(test) -> None:
|
|
340
|
+
test.send_statement('RETURN "databases rule" AS a;abc')
|
|
341
|
+
test.send_statement("\x1b[D" * 3) # move cursor to the left
|
|
342
|
+
test.send_control_statement(KEY_ACTION.CTRL_K.value)
|
|
343
|
+
test.send_finished_statement(KEY_ACTION.ENTER.value)
|
|
344
|
+
assert (
|
|
345
|
+
test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
|
|
346
|
+
== 0
|
|
347
|
+
)
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
@pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
|
|
351
|
+
def test_ctrl_a(test) -> None:
|
|
352
|
+
test.send_statement('ETURN "databases rule" AS a;')
|
|
353
|
+
test.send_control_statement(KEY_ACTION.CTRL_A.value)
|
|
354
|
+
test.send_finished_statement("R\x1b[F\r") # move cursor to end of line
|
|
355
|
+
assert (
|
|
356
|
+
test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
|
|
357
|
+
== 0
|
|
358
|
+
)
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
@pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
|
|
362
|
+
def test_ctrl_e(test) -> None:
|
|
363
|
+
test.send_statement('RETURN "databases rule" AS a')
|
|
364
|
+
test.send_statement("\x1b[H") # move cursor to the front
|
|
365
|
+
test.send_control_statement(KEY_ACTION.CTRL_E.value)
|
|
366
|
+
test.send_finished_statement(";\r")
|
|
367
|
+
assert (
|
|
368
|
+
test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
|
|
369
|
+
== 0
|
|
370
|
+
)
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
@pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
|
|
374
|
+
def test_ctrl_l_empty(test) -> None:
|
|
375
|
+
# clear screen with empty line
|
|
376
|
+
test.send_control_statement(KEY_ACTION.CTRL_L.value)
|
|
377
|
+
assert test.shell_process.expect_exact(["\x1b[H\x1b[2J", pexpect.EOF]) == 0
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
@pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
|
|
381
|
+
def test_ctrl_l_non_empty(test) -> None:
|
|
382
|
+
# clear screen with non empty line
|
|
383
|
+
test.send_statement('RETURN "databases rule" AS a')
|
|
384
|
+
test.send_control_statement(KEY_ACTION.CTRL_L.value)
|
|
385
|
+
assert test.shell_process.expect_exact(["\x1b[H\x1b[2J", pexpect.EOF]) == 0
|
|
386
|
+
test.send_finished_statement(";\r")
|
|
387
|
+
assert (
|
|
388
|
+
test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
|
|
389
|
+
== 0
|
|
390
|
+
)
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
@pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
|
|
394
|
+
def test_ctrl_w(test) -> None:
|
|
395
|
+
test.send_statement('RETURN "databases rule" AS a; abc def ghi ')
|
|
396
|
+
test.send_statement(KEY_ACTION.CTRL_W.value * 3)
|
|
397
|
+
test.send_statement("\x1b[H") # move cursor to the front
|
|
398
|
+
test.send_statement(KEY_ACTION.CTRL_W.value)
|
|
399
|
+
test.send_statement("\x1b[F") # move cursor to the end
|
|
400
|
+
test.send_finished_statement(KEY_ACTION.ENTER.value)
|
|
401
|
+
assert (
|
|
402
|
+
test.shell_process.expect_exact(["\u2502 databases rule \u2502", pexpect.EOF])
|
|
403
|
+
== 0
|
|
404
|
+
)
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
@pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
|
|
408
|
+
def test_tab_spaces(test) -> None:
|
|
409
|
+
# tab is interpreted as four spaces when pasting input
|
|
410
|
+
test.send_finished_statement('RETURN "databases\trule" AS a;\r')
|
|
411
|
+
assert (
|
|
412
|
+
test.shell_process.expect_exact(
|
|
413
|
+
["\u2502 databases rule \u2502", pexpect.EOF]
|
|
414
|
+
)
|
|
415
|
+
== 0
|
|
416
|
+
)
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
@pytest.mark.parametrize("test", ["multiline", "singleline"], indirect=True)
|
|
420
|
+
def test_tab(test) -> None:
|
|
421
|
+
# tab completion
|
|
422
|
+
test.send_statement("CRE")
|
|
423
|
+
test.send_statement(KEY_ACTION.TAB.value)
|
|
424
|
+
test.send_statement(" N")
|
|
425
|
+
test.send_statement(KEY_ACTION.TAB.value)
|
|
426
|
+
test.send_statement(KEY_ACTION.TAB.value)
|
|
427
|
+
test.send_statement(" TAB")
|
|
428
|
+
test.send_statement(KEY_ACTION.TAB.value)
|
|
429
|
+
test.send_statement(KEY_ACTION.TAB.value)
|
|
430
|
+
test.send_statement("LE t0(i STRING, PRIMARY KEY(i));")
|
|
431
|
+
test.send_statement(KEY_ACTION.TAB.value)
|
|
432
|
+
test.send_finished_statement(KEY_ACTION.ENTER.value)
|
|
433
|
+
assert (
|
|
434
|
+
test.shell_process.expect_exact(
|
|
435
|
+
["\u2502 Table t0 has been created. \u2502", pexpect.EOF],
|
|
436
|
+
)
|
|
437
|
+
== 0
|
|
438
|
+
)
|