# Path: approvaltests/core/reporter.py
# class Reporter(ABC):
#     """
#     Super class of all reporters in ApprovalTests.Python
# 
#     The only necessary function to implement for a
#     reporter is 'report', which takes the absolute
#     paths of the received- and approved files, and
#     returns a truthy value on success.
#     """
# 
#     def __eq__(self, other):
#         return repr(self) == repr(other)
# 
#     @abstractmethod
#     def report(self, received_path: str, approved_path: str) -> bool:
#         """
#         Apply the reporter to pair of files given
#         as absolute paths parameters.
# 
#         A truthy return value from report means that it succeeded,
#         such as because any command existed.
# 
#         A falsy return value from report means that its operation
#         failed in some way.
# 
#         Note: At the time of writing, not all implementations of
#         Reporter return this value correctly.
#         """
#         raise Exception("Interface member not implemented")
# 
# Path: approvaltests/reporters/first_working_reporter.py
# class FirstWorkingReporter(Reporter):
#     """
#     A composite reporter that goes through a list
#     of reporters, running the first one that is
#     working on the current machine.
# 
#     This is mostly an implementation detail of other
#     classes in the library, but it may be useful in scenarios
#     where a team wants to supply a list of custom reporter,
#     and have the first working one of these be used.
# 
#     See also MultiReporter.
#     """
# 
#     def __init__(self, *reporters) -> None:
#         self.reporters = reporters
# 
#     def report(self, received_path: str, approved_path: str) -> bool:
#         for r in self.reporters:
#             try:
#                 success = r.report(received_path, approved_path)
#                 if success:
#                     return True
#             except:
#                 pass
# 
#         return False
# 
#     def __str__(self):
#         reporters = ", ".join(str(s) for s in self.reporters)
#         return f"FirstWorkingReporter({reporters})"
# 
#     __repr__ = __str__
# 
#     def __eq__(self, other) -> bool:
#         return repr(self) == repr(other)


import unittest
from approvaltests.core.reporter import Reporter
from approvaltests.reporters.first_working_reporter import FirstWorkingReporter
from typing import Callable, Optional
    __repr__ = __str__

    def report(self, received_path: str, approved_path: str) -> bool:
        self.called = True
        self.additional()
        return self.success


class TestFirstWorkingReporter(unittest.TestCase):
    def test_first_one(self) -> None:
        r1 = ReporterForTesting(True)
        r2 = ReporterForTesting(False)
        first = FirstWorkingReporter(r1, r2)
        success = first.report("a.txt", "b.txt")
        self.assertTrue(r1.called)
        self.assertTrue(success)
        self.assertFalse(r2.called)

    def test_string_representation(self) -> None:
        r1 = ReporterForTesting(True)
        r2 = ReporterForTesting(False)
        first = FirstWorkingReporter(r1, r2)
        expected = (
            "FirstWorkingReporter(ReporterForTesting(True), ReporterForTesting(False))"
        )
        self.assertEqual(expected, str(first))

    def test_second_one(self) -> None:
        r1 = ReporterForTesting(False)
        r2 = ReporterForTesting(False)

# Path: approvaltests/core/reporter.py
# class Reporter(ABC):
#     """
#     Super class of all reporters in ApprovalTests.Python
# 
#     The only necessary function to implement for a
#     reporter is 'report', which takes the absolute
#     paths of the received- and approved files, and
#     returns a truthy value on success.
#     """
# 
#     def __eq__(self, other):
#         return repr(self) == repr(other)
# 
#     @abstractmethod
#     def report(self, received_path: str, approved_path: str) -> bool:
#         """
#         Apply the reporter to pair of files given
#         as absolute paths parameters.
# 
#         A truthy return value from report means that it succeeded,
#         such as because any command existed.
# 
#         A falsy return value from report means that its operation
#         failed in some way.
# 
#         Note: At the time of writing, not all implementations of
#         Reporter return this value correctly.
#         """
#         raise Exception("Interface member not implemented")
# 
# Path: approvaltests/reporters/first_working_reporter.py
# class FirstWorkingReporter(Reporter):
#     """
#     A composite reporter that goes through a list
#     of reporters, running the first one that is
#     working on the current machine.
# 
#     This is mostly an implementation detail of other
#     classes in the library, but it may be useful in scenarios
#     where a team wants to supply a list of custom reporter,
#     and have the first working one of these be used.
# 
#     See also MultiReporter.
#     """
# 
#     def __init__(self, *reporters) -> None:
#         self.reporters = reporters
# 
#     def report(self, received_path: str, approved_path: str) -> bool:
#         for r in self.reporters:
#             try:
#                 success = r.report(received_path, approved_path)
#                 if success:
#                     return True
#             except:
#                 pass
# 
#         return False
# 
#     def __str__(self):
#         reporters = ", ".join(str(s) for s in self.reporters)
#         return f"FirstWorkingReporter({reporters})"
# 
#     __repr__ = __str__
# 
#     def __eq__(self, other) -> bool:
#         return repr(self) == repr(other)


# Path: tests/reporters/test_first_working_reporter.py
import unittest
from approvaltests.core.reporter import Reporter
from approvaltests.reporters.first_working_reporter import FirstWorkingReporter
from typing import Callable, Optional

    __repr__ = __str__

    def report(self, received_path: str, approved_path: str) -> bool:
        self.called = True
        self.additional()
        return self.success


class TestFirstWorkingReporter(unittest.TestCase):
    def test_first_one(self) -> None:
        r1 = ReporterForTesting(True)
        r2 = ReporterForTesting(False)
        first = FirstWorkingReporter(r1, r2)
        success = first.report("a.txt", "b.txt")
        self.assertTrue(r1.called)
        self.assertTrue(success)
        self.assertFalse(r2.called)

    def test_string_representation(self) -> None:
        r1 = ReporterForTesting(True)
        r2 = ReporterForTesting(False)
        first = FirstWorkingReporter(r1, r2)
        expected = (
            "FirstWorkingReporter(ReporterForTesting(True), ReporterForTesting(False))"
        )
        self.assertEqual(expected, str(first))

    def test_second_one(self) -> None:
        r1 = ReporterForTesting(False)
        r2 = ReporterForTesting(False)

        first = FirstWorkingReporter(r1, r2)