old_contents: #!/usr/bin/env python3
  
  import zlib
  
  import pytest
  # from conftest import *
  
  # from aiospamc.exceptions import (BadResponse,
  #                                  UsageException, DataErrorException, NoInputException, NoUserException,
  #                                  NoHostException, UnavailableException, InternalSoftwareException, OSErrorException,
  #                                  OSFileException, CantCreateException, IOErrorException, TemporaryFailureException,
  #                                  ProtocolException, NoPermissionException, ConfigException, TimeoutException)
  from aiospamc.headers import Compress
  from aiospamc.responses import Response, Status
  
  
  def test_response_instantiates():
      response = Response('1.5', Status.EX_OK, 'EX_OK')
  
      assert 'response' in locals()
  
  
  @pytest.mark.parametrize('version,status,message,body,headers', [
      ('1.5', Status.EX_OK, 'EX_OK', None, []),
      ('1.5', Status.EX_OK, 'EX_OK', b'Test body\n', []),
      ('1.5', Status.EX_OK, 'EX_OK', b'Test body\n', [Compress()]),
  ])
  def test_response_bytes(version, status, message, body, headers):
      response = Response(version=version,
                          status_code=status,
                          message=message,
                          body=body,
                          headers=headers)
  
      assert bytes(response).startswith(b'SPAMD/%b' % version.encode())
      assert b' %d ' % status.value in bytes(response)
      assert b' %b\r\n' % message.encode() in bytes(response)
      assert all(bytes(header) in bytes(response) for header in headers)
      if body:
          if any(isinstance(header, Compress) for header in headers):
              assert bytes(response).endswith(zlib.compress(body))
          else:
              assert bytes(response).endswith(body)
  
new_contents: #!/usr/bin/env python3
  
  import zlib
  
  from aiospamc.headers import Compress
  from aiospamc.responses import Response, Status
  
  
  def test_init_version():
      r = Response(version='4.2', status_code=Status.EX_OK, message='EX_OK')
      result = bytes(r).split(b' ')[0]
  
      assert result == b'SPAMD/4.2'
  
  
  def test_init_status_code():
      r = Response(version='1.5', status_code=Status.EX_OK, message='EX_OK')
      result = bytes(r).split(b' ')[1]
  
      assert result == str(Status.EX_OK.value).encode()
  
  
  def test_init_message():
      r = Response(version='1.5', status_code=Status.EX_OK, message='EX_OK')
      result = bytes(r).split(b'\r\n')[0]
  
      assert result.endswith(Status.EX_OK.name.encode())
  
  
  def test_bytes_headers(x_headers):
      r = Response(version='1.5', status_code=Status.EX_OK, message='EX_OK')
      result = bytes(r).split(b'\r\n')[1:-2]      # strip end of headers, body and first line
      expected = [bytes(header).rstrip(b'\r\n') for header in x_headers]
  
      for header_bytes in result:
          assert header_bytes in expected
  
  
  def test_bytes_body():
      test_input = b'Test body\n'
      r = Response(version='1.5', status_code=Status.EX_OK, message='EX_OK', body=test_input)
      result = bytes(r).split(b'\r\n', 3)[-1]
  
      assert result == test_input
  
  
  def test_bytes_body_compressed():
      test_input = b'Test body\n'
      r = Response(version='1.5', status_code=Status.EX_OK, message='EX_OK', headers=[Compress()], body=test_input)
      result = bytes(r).split(b'\r\n', 3)[-1]
  
      assert result == zlib.compress(test_input)
  
subject: Split up tests for Response class