Ticket #34169: django_validator_test.py

File django_validator_test.py, 811 bytes (added by Niko, 2 years ago)

Python script which uses the bugged function to demonstrate our point

Line 
1from django.core.validators import EmailValidator
2
3validator = EmailValidator()
4print('domain\t\t \tdjango\'s value\t\texpected value')
5print('\'vt.edu\'\t->\t', validator.validate_domain_part('vt.edu'), '\t\t\tTrue')
6print('\'v-t.edu\'\t->\t', validator.validate_domain_part('v-t.edu'), '\t\t\tTrue')
7print('\'vt.e-du\'\t->\t', validator.validate_domain_part('vt.e-du'), '\t\t\tTrue')
8print('\'v-t.ed-u\'\t->\t', validator.validate_domain_part('v-t.ed-u'), '\t\t\tTrue')
9print('\'-vt.edu\'\t->\t', validator.validate_domain_part('-vt.edu'), '\t\t\tFalse')
10print('\'vt-.edu\'\t->\t', validator.validate_domain_part('vt-.edu'), '\t\t\tFalse')
11print('\'vt.-edu\'\t->\t', validator.validate_domain_part('vt.-edu'), '\t\t\tFalse')
12print('\'vt.edu-\'\t->\t', validator.validate_domain_part('vt.edu-'), '\t\t\tFalse')
Back to Top