# Path: seal/lib/mr/hit_processor_chain_link.py
# class HitProcessorChainLink(object):
#     def __init__(self, next_link = None):
#         self.next_link = next_link
# 
#     def set_next(self, link):
#         self.next_link = link
#         return link
# 
#     def process(self, original, aligned_pair):
#         """
#         Identity action.  Passes to the next link, if any.
#         """
#         if self.next_link:
#             self.next_link.process(original, aligned_pair)


import unittest
from seal.lib.mr.hit_processor_chain_link import HitProcessorChainLink
# You should have received a copy of the GNU General Public License
# along with Seal.  If not, see <http://www.gnu.org/licenses/>.



class TestHitProcessorChainLink(unittest.TestCase):
    def setUp(self):
        self.h1 = HitProcessorChainLink()
        self.h2 = HitProcessorChainLink()

    def test_default_constructor(self):
        self.assertTrue(self.h1.next_link is None)

    def test_constructor(self):
        h = HitProcessorChainLink(self.h1)
        self.assertEqual(self.h1, h.next_link)

    def test_set_next(self):
        self.assertTrue(self.h1.next_link is None)
        retval = self.h1.set_next(self.h2)
        self.assertTrue(self.h2 is retval)
        self.assertTrue(self.h2 is self.h1.next_link)

    def test_process_no_next(self):
        self.h1.process("test", "test") # shouldn't raise

    def test_process_next(self):
        class Receiver(object):
            def process(self, orig_pair, aln_pair):
                self.orig_received = orig_pair

# Path: seal/lib/mr/hit_processor_chain_link.py
# class HitProcessorChainLink(object):
#     def __init__(self, next_link = None):
#         self.next_link = next_link
# 
#     def set_next(self, link):
#         self.next_link = link
#         return link
# 
#     def process(self, original, aligned_pair):
#         """
#         Identity action.  Passes to the next link, if any.
#         """
#         if self.next_link:
#             self.next_link.process(original, aligned_pair)


# Path: tests/tseal/lib/mr/test_hit_processor_chain_link.py
import unittest
from seal.lib.mr.hit_processor_chain_link import HitProcessorChainLink

# You should have received a copy of the GNU General Public License
# along with Seal.  If not, see <http://www.gnu.org/licenses/>.



class TestHitProcessorChainLink(unittest.TestCase):
    def setUp(self):
        self.h1 = HitProcessorChainLink()
        self.h2 = HitProcessorChainLink()

    def test_default_constructor(self):
        self.assertTrue(self.h1.next_link is None)

    def test_constructor(self):
        h = HitProcessorChainLink(self.h1)
        self.assertEqual(self.h1, h.next_link)

    def test_set_next(self):
        self.assertTrue(self.h1.next_link is None)
        retval = self.h1.set_next(self.h2)
        self.assertTrue(self.h2 is retval)
        self.assertTrue(self.h2 is self.h1.next_link)

    def test_process_no_next(self):
        self.h1.process("test", "test") # shouldn't raise

    def test_process_next(self):
        class Receiver(object):
            def process(self, orig_pair, aln_pair):
                self.orig_received = orig_pair

                self.aln_received = aln_pair