old_contents: # -*- coding: utf-8 -*-
  import pytest
  
  from marshmallow import validate, ValidationError
  
  def test_invalid_email():
      invalid1 = "user@example"
      with pytest.raises(ValidationError):
          validate.email(invalid1)
      invalid2 = "example.com"
      with pytest.raises(ValidationError):
          validate.email(invalid2)
      invalid3 = "user"
      with pytest.raises(ValidationError):
          validate.email(invalid3)
      with pytest.raises(ValidationError):
          validate.email('@nouser.com')
  
  def test_validate_email_none():
      assert validate.email(None) is None
  
  def test_validate_url_none():
      assert validate.url(None) is None
  
new_contents: # -*- coding: utf-8 -*-
  import pytest
  
  from marshmallow import validate, ValidationError
  
  def test_invalid_email():
      invalid1 = "user@example"
      with pytest.raises(ValidationError):
          validate.email(invalid1)
      invalid2 = "example.com"
      with pytest.raises(ValidationError):
          validate.email(invalid2)
      invalid3 = "user"
      with pytest.raises(ValidationError):
          validate.email(invalid3)
      with pytest.raises(ValidationError):
          validate.email('@nouser.com')
  
  def test_validate_email_none():
      assert validate.email(None) is None
  
  def test_validate_url_none():
      assert validate.url(None) is None
  
  def test_min_length():
      with pytest.raises(ValidationError):
          validate.length('foo', 4, 5)
      assert validate.length('foo', 3, 5) == 'foo'
      with pytest.raises(ValidationError):
          validate.length([1, 2, 3], 4, 5)
      assert validate.length([1, 2, 3], 3, 5) == [1, 2, 3]
      with pytest.raises(ValidationError):
          validate.length('foo', 5)
  
  def test_max_length():
      with pytest.raises(ValidationError):
          validate.length('foo', 1, 2)
      assert validate.length('foo', 1, 3) == 'foo'
      with pytest.raises(ValidationError):
          validate.length([1, 2, 3], 1, 2)
      assert validate.length([1, 2, 3], 1, 3) == [1, 2, 3]
      with pytest.raises(ValidationError):
          validate.length('foo', None, 2)
  
  def test_validate_length_none():
      assert validate.length(None) is None
  
subject: Add length validator unit tests