# Path: hotness/domain/package.py
# class Package:
#     """
#     Internal representation of package object.
# 
#     Attributes:
#         name (str): Name of the package
#         version (str): Latest version of the package
#         distro (str): Distribution assigned
#     """
# 
#     def __init__(self, name: str, version: str, distro: str) -> None:
#         """
#         Class constructor
#         """
#         self.name = name
#         self.version = version
#         self.distro = distro
# 
#     def to_dict(self) -> dict:
#         """
#         Convert object to dictionary.
# 
#         Return:
#             Dictionary created from package object.
#         """
#         return {"name": self.name, "version": self.version, "distro": self.distro}
# 
#     @classmethod
#     def from_dict(cls, package_dict: dict) -> object:
#         """
#         Convert dictionary to object.
# 
#         Params:
#             package_dict: Dictionary to create package from.
# 
#         Return:
#             Package object.
#         """
#         package = Package(
#             name=package_dict["name"],
#             version=package_dict["version"],
#             distro=package_dict["distro"],
#         )
#         return package
# 
#     def __eq__(self, other: object) -> bool:
#         """
#         Compare method for package object.
# 
#         Params:
#             other: object to compare with
# 
#         Return:
#             Compare result.
#         """
#         return self.to_dict() == other.to_dict()  # type: ignore
# 
# Path: hotness/validators/pdc.py
# class PDC(Validator):
#     """
#     Wrapper around PDC (Product definition center) https://pdc.fedoraproject.org
# 
#     It inherits the Validator abstract class and implements the validate method.
# 
#     The PDC wrapper is used to check if the package is retired in Fedora.
# 
#     Attributes:
#         url: URL of the PDC server
#         requests_session: Session object which will be used for HTTP request
#         timeout: Timeouts to HTTP request in seconds (connect timeout, read timeout)
#         branch: Branch to check (rawhide, f34, f33...)
#         package_type: Type of package to check (rpm, module...)
#     """
# 
#     def __init__(
#         self,
#         url: str,
#         requests_session: Session,
#         timeout: tuple,
#         branch: str,
#         package_type: str,
#     ) -> None:
#         """
#         Class constructor.
#         """
#         self.url = url
#         self.requests_session = requests_session
#         self.timeout = timeout
#         self.branch = branch
#         self.package_type = package_type
# 
#     def validate(self, package: Package) -> dict:
#         """
#         Implementation of `Validator.validate` method. It calls the PDC, checks the response
#         and returns the output.
# 
#         Params:
#             package: Package to check in PDC
# 
#         Returns:
#             Dictionary containing output of response and validation.
#             Example:
#             {
#                 "retired": True,
#                 "count": "0",  # Number of active branches found
#             }
# 
#         Raises:
#             HTTPException: Is raised when HTTP status code of response isn't 200.
#         """
#         output = {}
#         pdc_url = "{0}/rest_api/v1/component-branches/".format(self.url)
#         params = (
#             ("name", self.branch),
#             ("global_component", package.name),
#             ("type", self.package_type),
#             ("active", True),
#         )
#         _logger.debug(
#             "Checking {} to see if {} is retired, {}".format(pdc_url, package, params)
#         )
#         response = self.requests_session.get(
#             pdc_url, params=params, timeout=self.timeout
#         )
# 
#         if not response.status_code == 200:
#             raise HTTPException(
#                 response.status_code, "Error encountered on request {}".format(pdc_url)
#             )
# 
#         js = response.json()
#         # If there are zero active rawhide branches for this package, then it is
#         # retired.
#         output["retired"] = js["count"] == 0
#         output["active_branches"] = js["count"]
# 
#         return output
# 
# Path: hotness/exceptions/http_exception.py
# class HTTPException(BaseHotnessException):
#     """
#     Class representing HTTP exception. This exception should be returned by any wrapper receiving
#     HTTP response when the error code is not 200.
# 
#     Attributes:
#         error_code: Error code of the response
#         message: Error message.
#     """
# 
#     def __init__(self, error_code: int, message: str):
#         """
#         Class constructor.
#         """
#         self.error_code = error_code
#         self.message = message
#         super(HTTPException, self).__init__(self.message)
# 
#     def __str__(self):
#         """
#         String representation of error.
#         """
#         return f"Error code: {self.error_code}\n" f"Error message: {self.message}"


import pytest
from unittest import mock
from hotness.domain import Package
from hotness.validators import PDC
from hotness.exceptions import HTTPException
        timeout = (5, 20)
        requests_session = mock.Mock()
        branch = "rawhide"
        package_type = "rpm"

        validator = PDC(url, requests_session, timeout, branch, package_type)

        assert validator.url == url
        assert validator.requests_session == requests_session
        assert validator.timeout == timeout
        assert validator.branch == branch
        assert validator.package_type == package_type


class TestPDCValidate:
    """
    Test class for `hotness.validators.PDC.validate` method.
    """

    def setup(self):
        """
        Setup phase before test.
        """
        # Initialize PDC wrapper
        url = "http://testing.url"
        timeout = (5, 20)
        requests_session = mock.Mock()
        branch = "rawhide"
        package_type = "rpm"


# Path: hotness/domain/package.py
# class Package:
#     """
#     Internal representation of package object.
# 
#     Attributes:
#         name (str): Name of the package
#         version (str): Latest version of the package
#         distro (str): Distribution assigned
#     """
# 
#     def __init__(self, name: str, version: str, distro: str) -> None:
#         """
#         Class constructor
#         """
#         self.name = name
#         self.version = version
#         self.distro = distro
# 
#     def to_dict(self) -> dict:
#         """
#         Convert object to dictionary.
# 
#         Return:
#             Dictionary created from package object.
#         """
#         return {"name": self.name, "version": self.version, "distro": self.distro}
# 
#     @classmethod
#     def from_dict(cls, package_dict: dict) -> object:
#         """
#         Convert dictionary to object.
# 
#         Params:
#             package_dict: Dictionary to create package from.
# 
#         Return:
#             Package object.
#         """
#         package = Package(
#             name=package_dict["name"],
#             version=package_dict["version"],
#             distro=package_dict["distro"],
#         )
#         return package
# 
#     def __eq__(self, other: object) -> bool:
#         """
#         Compare method for package object.
# 
#         Params:
#             other: object to compare with
# 
#         Return:
#             Compare result.
#         """
#         return self.to_dict() == other.to_dict()  # type: ignore
# 
# Path: hotness/validators/pdc.py
# class PDC(Validator):
#     """
#     Wrapper around PDC (Product definition center) https://pdc.fedoraproject.org
# 
#     It inherits the Validator abstract class and implements the validate method.
# 
#     The PDC wrapper is used to check if the package is retired in Fedora.
# 
#     Attributes:
#         url: URL of the PDC server
#         requests_session: Session object which will be used for HTTP request
#         timeout: Timeouts to HTTP request in seconds (connect timeout, read timeout)
#         branch: Branch to check (rawhide, f34, f33...)
#         package_type: Type of package to check (rpm, module...)
#     """
# 
#     def __init__(
#         self,
#         url: str,
#         requests_session: Session,
#         timeout: tuple,
#         branch: str,
#         package_type: str,
#     ) -> None:
#         """
#         Class constructor.
#         """
#         self.url = url
#         self.requests_session = requests_session
#         self.timeout = timeout
#         self.branch = branch
#         self.package_type = package_type
# 
#     def validate(self, package: Package) -> dict:
#         """
#         Implementation of `Validator.validate` method. It calls the PDC, checks the response
#         and returns the output.
# 
#         Params:
#             package: Package to check in PDC
# 
#         Returns:
#             Dictionary containing output of response and validation.
#             Example:
#             {
#                 "retired": True,
#                 "count": "0",  # Number of active branches found
#             }
# 
#         Raises:
#             HTTPException: Is raised when HTTP status code of response isn't 200.
#         """
#         output = {}
#         pdc_url = "{0}/rest_api/v1/component-branches/".format(self.url)
#         params = (
#             ("name", self.branch),
#             ("global_component", package.name),
#             ("type", self.package_type),
#             ("active", True),
#         )
#         _logger.debug(
#             "Checking {} to see if {} is retired, {}".format(pdc_url, package, params)
#         )
#         response = self.requests_session.get(
#             pdc_url, params=params, timeout=self.timeout
#         )
# 
#         if not response.status_code == 200:
#             raise HTTPException(
#                 response.status_code, "Error encountered on request {}".format(pdc_url)
#             )
# 
#         js = response.json()
#         # If there are zero active rawhide branches for this package, then it is
#         # retired.
#         output["retired"] = js["count"] == 0
#         output["active_branches"] = js["count"]
# 
#         return output
# 
# Path: hotness/exceptions/http_exception.py
# class HTTPException(BaseHotnessException):
#     """
#     Class representing HTTP exception. This exception should be returned by any wrapper receiving
#     HTTP response when the error code is not 200.
# 
#     Attributes:
#         error_code: Error code of the response
#         message: Error message.
#     """
# 
#     def __init__(self, error_code: int, message: str):
#         """
#         Class constructor.
#         """
#         self.error_code = error_code
#         self.message = message
#         super(HTTPException, self).__init__(self.message)
# 
#     def __str__(self):
#         """
#         String representation of error.
#         """
#         return f"Error code: {self.error_code}\n" f"Error message: {self.message}"


# Path: tests/validators/test_pdc.py
import pytest
from unittest import mock
from hotness.domain import Package
from hotness.validators import PDC
from hotness.exceptions import HTTPException

        timeout = (5, 20)
        requests_session = mock.Mock()
        branch = "rawhide"
        package_type = "rpm"

        validator = PDC(url, requests_session, timeout, branch, package_type)

        assert validator.url == url
        assert validator.requests_session == requests_session
        assert validator.timeout == timeout
        assert validator.branch == branch
        assert validator.package_type == package_type


class TestPDCValidate:
    """
    Test class for `hotness.validators.PDC.validate` method.
    """

    def setup(self):
        """
        Setup phase before test.
        """
        # Initialize PDC wrapper
        url = "http://testing.url"
        timeout = (5, 20)
        requests_session = mock.Mock()
        branch = "rawhide"
        package_type = "rpm"


        self.validator = PDC(url, requests_session, timeout, branch, package_type)