コード例 #1
0
    def test_query_type_email_valid(self):
        emails = [
            '*****@*****.**',
            '*****@*****.**',
            '*****@*****.**',
            '*****@*****.**',
        ]

        for email in emails:
            assert get_query_type(email) == 'email'
コード例 #2
0
    def test_query_type_email_malformed(self):
        emails = [
            'johndoe @ gmail.com',
            'john.doe@gmail',
            '[email protected]',
            'john@'
            '@', ''
        ]

        for email in emails:
            assert get_query_type(email) == ''
コード例 #3
0
    def test_query_type_domain_malformed(self):
        domains = [
            '//www.google.com/',
            'https:/github.com/',
            'htt://github.org',
            'githubedu',
            '.io',
            'github.'
        ]

        for domain in domains:
            assert get_query_type(domain) == ''
コード例 #4
0
    def test_query_type_domain_valid(self):
        domains = [
            'www.google.com',
            'github.com',
            'github.org',
            'github.edu',
            'github.io',
            'github.me'
        ]

        for domain in domains:
            assert get_query_type(domain) == 'domain'