Skip to content

Comments

test-1-Parfyonova-Vika-42#8

Open
roriess wants to merge 20 commits intopython-course-matmex:mainfrom
roriess:test-1
Open

test-1-Parfyonova-Vika-42#8
roriess wants to merge 20 commits intopython-course-matmex:mainfrom
roriess:test-1

Conversation

@roriess
Copy link

@roriess roriess commented Nov 7, 2025

No description provided.

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: 6/10
Бинарный поиск: 5/5
Оформление: 9/10 (нет описания PR)

Comment on lines +24 to +35
while True:
user_input = input("Enter an ISBN10 number or '-1' to exit: ")

if user_input == "-1": break

try:
if modulo11_checksum(user_input):
print("correct")
else:
print("incorrect")
except Exception as ex:
print(f"An error occurred: {ex}") No newline at end of file
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 +2 to +5
digits = ''
for char in isbn_number:
if char.isdigit():
digits += char
Copy link

Choose a reason for hiding this comment

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

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

Comment on lines +12 to +25
def test_short_string():
assert not modulo11_checksum("2-266-6-3")


def test_long_string():
assert not modulo11_checksum("2-266-21132312332316-3")


def test_empty_string():
assert not modulo11_checksum("")


def test_none_input():
assert not modulo11_checksum(None) No newline at end of file
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: 
        raise ValueError('ISBN must have exactly 10 characters')

В тестах у вас ожидается False, а произойдет ошибка, тесты упадут.

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