def test_is_valid_logical_name(self):
    valid = ('spam', 'spAm', 'SPAM', 'spam-eggs', 'spam.eggs', 'spam_eggs', 'spam~eggs', '9spam', 'spam7', '~spam', '.spam', '.~-_', '~', 'br34kf4st', 's', ('s' * 63), ('s' * 255))
    invalid = (' ', 'spam eggs', '$pam', 'egg$', 'spam#eggs', ' eggs', 'spam ', '', None, 'spam%20')
    for hostname in valid:
        result = utils.is_valid_logical_name(hostname)
        self.assertIs(result, True, ('%s is unexpectedly invalid' % hostname))
    for hostname in invalid:
        result = utils.is_valid_logical_name(hostname)
        self.assertIs(result, False, ('%s is unexpectedly valid' % hostname))
def test_is_valid_logical_name(self):
    valid = ('spam', 'spAm', 'SPAM', 'spam-eggs', 'spam.eggs', 'spam_eggs', 'spam~eggs', '9spam', 'spam7', '~spam', '.spam', '.~-_', '~', 'br34kf4st', 's', ('s' * 63), ('s' * 255))
    invalid = (' ', 'spam eggs', '$pam', 'egg$', 'spam#eggs', ' eggs', 'spam ', , None, 'spam%20')
    for hostname in valid:
        result = utils.is_valid_logical_name(hostname)
        self.assertIs(result, True, ('%s is unexpectedly invalid' % hostname))
    for hostname in invalid:
        result = utils.is_valid_logical_name(hostname)
        self.assertIs(result, False, ('%s is unexpectedly valid' % hostname))