Skip to content

Commit

Permalink
Update validator tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fsbraun committed Oct 26, 2024
1 parent 4aeb631 commit 991b369
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/test_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,20 @@ def test_mailto_validation(self):
self.assertDoesNotValidate(validator, "mailto:info@localhost")
self.assertDoesNotValidate(validator, "mailto:")
self.assertDoesNotValidate(validator, "mailto: [email protected]")

def test_wrong_type_fails(self):
validator = ExtendedURLValidator()

self.assertDoesNotValidate(validator, "\n")
self.assertDoesNotValidate(validator, 42)

def test_anchor(self):
validator = ExtendedURLValidator()
self.assertValidates(validator, "#anchor")
self.assertValidates(validator, "#anchor-1")
self.assertValidates(validator, "#anchor_1")
self.assertDoesNotValidate(validator, "#anchor!")
self.assertDoesNotValidate(validator, "#anchor with spaces")
self.assertValidates(validator, "#" + "a" * (100 - 1))
self.assertDoesNotValidate(validator, "#" + "a" * 101)
self.assertValidates(validator, "#")

0 comments on commit 991b369

Please sign in to comment.