luar 0.4.2__tar.gz → 0.4.3__tar.gz
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.
- {luar-0.4.2/src/luar.egg-info → luar-0.4.3}/PKG-INFO +1 -1
- {luar-0.4.2 → luar-0.4.3}/pyproject.toml +1 -1
- {luar-0.4.2 → luar-0.4.3}/src/luar/__init__.py +1 -1
- {luar-0.4.2 → luar-0.4.3}/src/luar/app.py +12 -5
- {luar-0.4.2 → luar-0.4.3/src/luar.egg-info}/PKG-INFO +1 -1
- {luar-0.4.2 → luar-0.4.3}/tests/test_app.py +12 -0
- {luar-0.4.2 → luar-0.4.3}/LICENSE +0 -0
- {luar-0.4.2 → luar-0.4.3}/README.md +0 -0
- {luar-0.4.2 → luar-0.4.3}/setup.cfg +0 -0
- {luar-0.4.2 → luar-0.4.3}/src/luar/__main__.py +0 -0
- {luar-0.4.2 → luar-0.4.3}/src/luar/backends/__init__.py +0 -0
- {luar-0.4.2 → luar-0.4.3}/src/luar/backends/base.py +0 -0
- {luar-0.4.2 → luar-0.4.3}/src/luar/backends/laya_backend.py +0 -0
- {luar-0.4.2 → luar-0.4.3}/src/luar/cli.py +0 -0
- {luar-0.4.2 → luar-0.4.3}/src/luar/engine.py +0 -0
- {luar-0.4.2 → luar-0.4.3}/src/luar/questions.py +0 -0
- {luar-0.4.2 → luar-0.4.3}/src/luar/report.py +0 -0
- {luar-0.4.2 → luar-0.4.3}/src/luar/tables.py +0 -0
- {luar-0.4.2 → luar-0.4.3}/src/luar.egg-info/SOURCES.txt +0 -0
- {luar-0.4.2 → luar-0.4.3}/src/luar.egg-info/dependency_links.txt +0 -0
- {luar-0.4.2 → luar-0.4.3}/src/luar.egg-info/entry_points.txt +0 -0
- {luar-0.4.2 → luar-0.4.3}/src/luar.egg-info/requires.txt +0 -0
- {luar-0.4.2 → luar-0.4.3}/src/luar.egg-info/top_level.txt +0 -0
- {luar-0.4.2 → luar-0.4.3}/tests/test_engine.py +0 -0
- {luar-0.4.2 → luar-0.4.3}/tests/test_laya_backend.py +0 -0
- {luar-0.4.2 → luar-0.4.3}/tests/test_offline.py +0 -0
- {luar-0.4.2 → luar-0.4.3}/tests/test_questions.py +0 -0
- {luar-0.4.2 → luar-0.4.3}/tests/test_tables.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "luar"
|
|
7
|
-
version = "0.4.
|
|
7
|
+
version = "0.4.3"
|
|
8
8
|
description = "LUAR (Local Utility for Automated Reviews): catalog spreadsheet rows with a local decision model."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -106,11 +106,18 @@ Add a column named `expected_<id>` to your file to measure accuracy on rows you
|
|
|
106
106
|
"""
|
|
107
107
|
|
|
108
108
|
NO_QUESTIONS = (
|
|
109
|
-
"There are no questions yet. In step 2, fill in at least the id and the question of one row "
|
|
110
|
-
"
|
|
111
|
-
"page and drop it in \"Load questions (.json)\", or pick \"Amostra de teste (Sample CSV)\" in "
|
|
112
|
-
"\"…or try an example\" to load both at once."
|
|
109
|
+
"There are no questions yet. In step 2, fill in at least the id and the question of one row, "
|
|
110
|
+
"or load a questions .json file in \"Load questions (.json)\"."
|
|
113
111
|
)
|
|
112
|
+
# only offered where the sample buttons and the examples menu exist (a repository checkout, not PyPI)
|
|
113
|
+
SAMPLE_HINT = (
|
|
114
|
+
" Trying the Sample CSV? Download Sample JSON at the top of the page and load it there, or pick "
|
|
115
|
+
"\"Amostra de teste (Sample CSV)\" in \"…or try an example\" to load both at once."
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def no_questions_message() -> str:
|
|
120
|
+
return NO_QUESTIONS + (SAMPLE_HINT if SAMPLE_QUESTIONS.exists() else "")
|
|
114
121
|
|
|
115
122
|
|
|
116
123
|
def _questions_to_rows(questions) -> list[list[str]]:
|
|
@@ -132,7 +139,7 @@ def _rows_to_questions(table) -> list:
|
|
|
132
139
|
continue
|
|
133
140
|
data.append({"id": qid, "type": qtype.lower(), "question": text, "options": opts})
|
|
134
141
|
if not data:
|
|
135
|
-
raise QuestionError(
|
|
142
|
+
raise QuestionError(no_questions_message())
|
|
136
143
|
return parse_questions(data)
|
|
137
144
|
|
|
138
145
|
|
|
@@ -22,6 +22,18 @@ def test_no_questions_explains_what_to_do():
|
|
|
22
22
|
app._rows_to_questions(table)
|
|
23
23
|
|
|
24
24
|
|
|
25
|
+
def test_no_questions_message_only_mentions_samples_that_exist(monkeypatch, tmp_path):
|
|
26
|
+
with pytest.raises(QuestionError, match="Sample JSON") as repo:
|
|
27
|
+
app._rows_to_questions([["", "choice", "", ""]])
|
|
28
|
+
# an install from PyPI has no examples/ folder: the sample buttons and menu are hidden
|
|
29
|
+
monkeypatch.setattr(app, "SAMPLE_QUESTIONS", tmp_path / "missing.json")
|
|
30
|
+
with pytest.raises(QuestionError) as pypi:
|
|
31
|
+
app._rows_to_questions([["", "choice", "", ""]])
|
|
32
|
+
assert "Load questions (.json)" in str(pypi.value)
|
|
33
|
+
assert "Sample" not in str(pypi.value) and "try an example" not in str(pypi.value)
|
|
34
|
+
assert str(repo.value).startswith(str(pypi.value))
|
|
35
|
+
|
|
36
|
+
|
|
25
37
|
def test_half_written_row_still_reports_the_missing_id():
|
|
26
38
|
with pytest.raises(QuestionError, match="Invalid question id"):
|
|
27
39
|
app._rows_to_questions([["", "choice", "What is it about?", "a; b"]])
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|