Skip to content

Commit 8222a78

Browse files
committed
update README
1 parent 3ef2cdd commit 8222a78

28 files changed

Lines changed: 519 additions & 569 deletions

README.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pip install -r requirements-dev.txt # to use questionnaire_unit_tests.py
3232
python3 ./questionnaire_import.py
3333
```
3434

35-
More info : [questionnaire_import.md](./questionnaire_import.md)
35+
More info about the original conversion : [questionnaire_import.md](./questionnaire_import.md)
3636

3737
---
3838

@@ -41,22 +41,33 @@ More info : [questionnaire_import.md](./questionnaire_import.md)
4141
python3 ./questionnaire.py ./json_questionnaires/<questionnaire.json>
4242
```
4343

44-
More info : [questionnaire.md](./questionnaire.md)
44+
More info about the JSON format expected and Error messages : [questionnaire.md](./questionnaire.md)
4545

4646
---
4747

4848
### Run the tests with `unittest` or `pytest`
49-
use ./json_test_files folder to check 25 intentionally broken quizzes targeting error cases
49+
50+
```bash
51+
python3 -m unittest questionnaire_unit_test
52+
```
53+
```bash
54+
pytest -v questionnaire_unit_test.py -s
55+
```
56+
or use ./json_test_files folder to check 25 intentionally broken quizzes targeting error cases
5057
```bash
51-
python3 -m unittest questionnaire_unit_test.py ./json_test_files/<questionnaire.json>
52-
pytest -v questionnaire_unit_test.py -s ./json_test_files/<questionnaire.json>
58+
python3 questionnaire.py json_test_files/json_00_empty.json
5359
```
5460

5561
More info : [questionnaire_unit_test.md](./questionnaire_unit_test.md)
5662

63+
### Explanation
64+
65+
```load_json_argv()``` is the entry point. It receives ```sys.argv```, validates that there is exactly one ```.json``` argument, detects whether it is a ```URL``` or a local ```file```, and delegates to ```load_json_data_from_URL()``` or ```load_json_data_from_file()```. It always returns a tuple ```(json_data, file_path)```.
66+
5767

5868
### Testing highlights
59-
69+
The objective was to test these various characteristics and methods:
70+
6071
- **Test-class inheritance** to reuse base cases by changing a single parameter.
6172
- **Mocking** with `unittest.mock.patch` to simulate `sys.argv`.
6273
- **Threaded local HTTP server** (`ThreadingMixIn` + `SimpleHTTPRequestHandler`) to test
10.7 KB
Binary file not shown.
28.6 KB
Binary file not shown.
28.6 KB
Binary file not shown.
28.5 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
967 Bytes
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)