Skip to content

Comments

Б42 контрольная#6

Open
stuffacc wants to merge 6 commits intopython-course-matmex:mainfrom
stuffacc:main
Open

Б42 контрольная#6
stuffacc wants to merge 6 commits intopython-course-matmex:mainfrom
stuffacc:main

Conversation

@stuffacc
Copy link

@stuffacc stuffacc commented Nov 7, 2025

исправлены ошибки
сделал тесты
ruff ci исправлен

@stuffacc
Copy link
Author

stuffacc commented Nov 7, 2025

/request-review @chernishev

Copy link

@Godrik0 Godrik0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ISBN10: 5/10
Бинарный поиск: 5/5
Оформление: 2/10 (snake_case, новые файлы с тестами, нет лицензии, нет .gitignore, проблемы с форматированием, нет внятного описания в PR, неинформативные и плохо сформулированные тексты коммитов)

Comment on lines +21 to +32
num = input()

while num != "-1":
res = modulo11Checksum(num)

if res:
print("correct")

else:
print("incorrect")

num = input()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Когда pytest импортирует этот файл для тестов, он зависнет, ожидая ввода данных.
Код, который относится к запуску нужно оборачивать в if __name__ == "__main__".

Comment on lines +5 to +8
if len(digits) != 10:
print("Цифр должно быть 10", end=' - ')
return

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

У Вас пропущена обработка символа X, который может служить контрольной цифрой.



if len(digits) != 10:
print("Цифр должно быть 10", end=' - ')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Такое не должно выводиться принтом, тут следовало кинуть исключение.


if len(digits) != 10:
print("Цифр должно быть 10", end=' - ')
return
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это вернет None, хотя функция предполагает возврат True/False.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А что не так с тестами из папки test? Для чего новые файлы с тестами?


def test1():
num = "99921-58-10-7"
assert modulo11Checksum(num) == True
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Правильно писать assert modulo11Checksum(num) или assert not modulo11Checksum(num).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants