-
Notifications
You must be signed in to change notification settings - Fork 22
Контрольная работа №1 #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
ebd2f27
6c049f1
9e17052
211a9c6
c566f98
8fd3c97
7941485
8a703dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # Python | ||
| __pycache__/ | ||
| *.pyc | ||
| *.pyo | ||
| *.pyd | ||
| *.so | ||
|
|
||
| # Virtual environments | ||
| venv/ | ||
| env/ | ||
| .venv/ | ||
|
|
||
| # IDE | ||
| .vscode/ | ||
| .idea/ | ||
| *.swp | ||
| *.swo | ||
|
|
||
| # OS | ||
| .DS_Store | ||
| Thumbs.db | ||
|
|
||
| # Testing | ||
| .pytest_cache/ | ||
| .coverage | ||
| htmlcov/ | ||
|
|
||
| # Project-specific | ||
| *.log | ||
| temp/ | ||
| tmp/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2025 Elizaveta Menshikova | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| import pytest | ||
| from src.bin_search import binSearch | ||
|
|
||
|
|
||
|
|
@@ -11,3 +12,13 @@ def test_start(): | |
|
|
||
| def test_not_in_list(): | ||
| assert binSearch([1, 2, 3, 4], 5) == -1 | ||
|
Comment on lines
13
to
14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. В текущей реализации метода, этот тест неверен. У вас бросается ошибка если элемента нет, а тут ожидается -1. |
||
|
|
||
|
|
||
| def test_unsorted(): | ||
| with pytest.raises(ValueError, match="Массив не отсортирован"): | ||
| binSearch([8, 3, 6, 1], 6) | ||
|
|
||
|
|
||
| def test_unsorted(): | ||
| with pytest.raises(ValueError, match="такого элемента нет"): | ||
| binSearch([1, 2, 3], 9) | ||
|
Comment on lines
+17
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Тесты имеют одинаковое название, вторая функция перезапишет первую. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| import pytest | ||
| from src.checksum import modulo11Checksum | ||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Эти проверки полностью лишают смысла весь алгоритм. Поиск в$O(N)$ , сортировка имеет сложность $O(N \log{N})$ .
xsимеет сложностьМожно было проверять, что
xимеет типint.