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