Пример #1
0
 def test_invalid_character_in_isbn_is_not_treated_as_zero(self):
     self.assertIs(is_valid("3-598-P1581-X"), False)
Пример #2
0
 def test_invalid_characters_are_not_ignored_before_checking_length(self):
     self.assertIs(is_valid("3598P215088"), False)
Пример #3
0
 def test_valid_with_X_check_digit(self):
     self.assertIs(is_valid('3-598-21507-X'), True)
Пример #4
0
 def test_invalid_check_digit_X_used_for_0(self):
     self.assertIs(is_valid('3-598-21515-X'), False)
Пример #5
0
 def test_too_short_isbn(self):
     self.assertIs(is_valid("00"), False)
Пример #6
0
 def test_input_is_9_characters(self):
     self.assertIs(is_valid("134456729"), False)
Пример #7
0
 def test_invalid_isbn_without_check_digit_and_dashes(self):
     self.assertIs(is_valid('359821507'), False)
Пример #8
0
 def test_valid_isbn_without_separating_dashes(self):
     self.assertIs(is_valid("3598215088"), True)
Пример #9
0
 def test_valid_isbn_without_separating_dashes(self):
     self.assertIs(is_valid('3598215088'), True)
Пример #10
0
 def test_valid_isbn_without_separating_dashes_with_X_check_digit(self):
     self.assertIs(is_valid('359821507X'), True)
Пример #11
0
 def test_invalid_X_other_than_check_digit(self):
     self.assertIs(is_valid('3-598-2X507-9'), False)
Пример #12
0
 def test_invalid_character_in_isbn(self):
     self.assertIs(is_valid('3-598-P1581-X'), False)
Пример #13
0
 def test_invalid_check_digit_other_than_X(self):
     self.assertIs(is_valid('3-598-21507-A'), False)
Пример #14
0
 def test_valid_isbn_number_with_a_check_digit_of_10(self):
     self.assertIs(is_valid("3-598-21507-X"), True)
Пример #15
0
 def test_invalid_too_long_isbn_with_no_dashes(self):
     self.assertIs(is_valid('3598215078X'), False)
Пример #16
0
 def test_invalid_character_in_isbn(self):
     self.assertIs(is_valid("3-598-P1581-X"), False)
Пример #17
0
 def test_invalid_too_short_isbn(self):
     self.assertIs(is_valid('00'), False)
Пример #18
0
 def test_isbn_without_check_digit_and_dashes(self):
     self.assertIs(is_valid("359821507"), False)
Пример #19
0
 def test_invalid_isbn_without_check_digit(self):
     self.assertIs(is_valid('3-598-21507'), False)
Пример #20
0
 def test_check_digit_of_x_should_not_be_used_for_0(self):
     self.assertIs(is_valid("3-598-21515-X"), False)
Пример #21
0
 def test_invalid_check_digit_X_used_for_0(self):
     self.assertIs(is_valid('3-598-21515-X'), False)
Пример #22
0
 def test_input_is_too_long_but_contains_a_valid_isbn(self):
     self.assertIs(is_valid("98245726788"), False)
Пример #23
0
 def test_valid_empty_isbn(self):
     self.assertIs(is_valid(''), False)
Пример #24
0
 def test_invalid_too_short_isbn(self):
     self.assertIs(is_valid('00'), False)
Пример #25
0
 def test_input_is_nine_characters(self):
     self.assertIs(is_valid('134456729'), False)
Пример #26
0
 def test_input_is_nine_characters(self):
     self.assertIs(is_valid('134456729'), False)
Пример #27
0
 def test_invalid_characters_are_not_ignored(self):
     self.assertIs(is_valid('3132P34035'), False)
Пример #28
0
 def test_invalid_characters_are_not_ignored_after_checking_length(self):
     self.assertIs(is_valid("3132P34035"), False)
Пример #29
0
 def test_input_is_too_long_but_contains_a_valid_isbn(self):
     self.assertIs(is_valid('98245726788'), False)
Пример #30
0
 def test_invalid_isbn_check_digit(self):
     self.assertIs(is_valid("3-598-21508-9"), False)
Пример #31
0
 def test_valid_isbn_number(self):
     self.assertIs(is_valid('3-598-21508-8'), True)
Пример #32
0
 def test_check_digit_is_a_character_other_than_x(self):
     self.assertIs(is_valid("3-598-21507-A"), False)
Пример #33
0
 def test_invalid_isbn13(self):
     for isbn in ['978-3-598-21508-1', '978359821508X', '9780306406153']:
         self.assertIs(is_valid(isbn), False)
Пример #34
0
 def test_x_is_only_valid_as_a_check_digit(self):
     self.assertIs(is_valid("3-598-2X507-9"), False)
Пример #35
0
 def test_invalid_check_digit(self):
     self.assertIs(is_valid('3-598-21508-9'), False)
Пример #36
0
 def test_isbn_without_separating_dashes_and_x_as_check_digit(self):
     self.assertIs(is_valid("359821507X"), True)
Пример #37
0
 def test_valid_with_X_check_digit(self):
     self.assertIs(is_valid('3-598-21507-X'), True)
Пример #38
0
 def test_too_long_isbn_and_no_dashes(self):
     self.assertIs(is_valid("3598215078X"), False)
Пример #39
0
 def test_invalid_check_digit_other_than_X(self):
     self.assertIs(is_valid('3-598-21507-A'), False)
Пример #40
0
 def test_isbn_without_check_digit(self):
     self.assertIs(is_valid("3-598-21507"), False)
Пример #41
0
 def test_invalid_X_other_than_check_digit(self):
     self.assertIs(is_valid('3-598-2X507-9'), False)
Пример #42
0
 def test_empty_isbn(self):
     self.assertIs(is_valid(""), False)
Пример #43
0
 def test_valid_isbn_without_separating_dashes_with_X_check_digit(self):
     self.assertIs(is_valid('359821507X'), True)
Пример #44
0
 def test_invalid_characters_are_not_ignored(self):
     self.assertIs(is_valid("3132P34035"), False)
Пример #45
0
 def test_invalid_too_long_isbn_with_no_dashes(self):
     self.assertIs(is_valid('3598215078X'), False)
Пример #46
0
 def test_valid_isbn_number(self):
     self.assertIs(is_valid("3-598-21508-8"), True)
Пример #47
0
 def test_invalid_check_digit(self):
     self.assertIs(is_valid('3-598-21508-9'), False)