Skip to content

Instantly share code, notes, and snippets.

@tejastank
Forked from umutcoskun/test_validators.py
Created August 7, 2022 14:07
Show Gist options
  • Save tejastank/9800bba8c0cb39e29db669ba95d42437 to your computer and use it in GitHub Desktop.
Save tejastank/9800bba8c0cb39e29db669ba95d42437 to your computer and use it in GitHub Desktop.
import unittest
from validators import validate_email
class ValidatorsTestCase(unittest.TestCase):
def test_validate_email(self):
# Bu format kesinlikle doğru.
self.assertTrue(validate_email('[email protected]'))
# Alt tire, tire ya da rakam içerebilir.
self.assertTrue(validate_email('[email protected]'))
# Soru işareti ya da ünlem içeremez.
self.assertFalse(validate_email('[email protected]'))
# Mutlaka @ işareti içermelidir.
self.assertFalse(validate_email('birisigmail.com'))
# @ işareti adresin başında olamaz.
self.assertFalse(validate_email('@birisigmail.com'))
# @ işaretinden bir adet nokta içermelidir.
self.assertFalse(validate_email('birisii@gmailcom'))
if __name__ == '__main__':
unittest.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment