def test_common_rules():
	try:
		import DNS
	except __HOLE__:
		pytest.skip("PyDNS not installed.")

	mock = DomainValidator()
	dataset = [
			('valid@example.com', ''),
			('', 'It cannot be empty.'),
			('*' * 256, 'It cannot be longer than 255 chars.'),
			('.invalid@example.com', 'It cannot start with a dot.'),
			('invalid@example.com.', 'It cannot end with a dot.'),
			('invalid..@example.com', 'It cannot contain consecutive dots.'),
		]

	def closure(address, expect):
		assert mock._apply_common_rules(address, 255) == (address, expect)

	for address, expect in dataset:
		yield closure, address, expect
dataset/ETHPy150Open marrow/mailer/test/test_validator.py/test_common_rules