import unittest
from algorithms.linked_list import LinkedList
from algorithms.linked_list_circular import *


class TestCircularLinkedList(unittest.TestCase):

    def test_circular_linked_list(self):
        linked = LinkedList()
        self.assertFalse(is_circular(linked))
        linked.insert(1)
        self.assertFalse(is_circular(linked))
        linked.insert(2)
        self.assertFalse(is_circular(linked))
        linked.insert(3)
        self.assertFalse(is_circular(linked))
        linked.get_tail().next = linked.get_head()
        self.assertTrue(is_circular(linked))
        linked.get_at(2).next = linked.get_at(1)
        self.assertTrue(is_circular(linked))
        linked.get_head().next = linked.get_head()
        self.assertTrue(is_circular(linked))

fdeb1bf675e91166628565a3ac48b27ba57c7a91
<mask token>

<mask token>


class TestCircularLinkedList(unittest.TestCase):
    <mask token>

<mask token>


class TestCircularLinkedList(unittest.TestCase):

    def test_circular_linked_list(self):
        linked = LinkedList()
        self.assertFalse(is_circular(linked))
        linked.insert(1)
        self.assertFalse(is_circular(linked))
        linked.insert(2)
        self.assertFalse(is_circular(linked))
        linked.insert(3)
        self.assertFalse(is_circular(linked))
        linked.get_tail().next = linked.get_head()
        self.assertTrue(is_circular(linked))
        linked.get_at(2).next = linked.get_at(1)
        self.assertTrue(is_circular(linked))
        linked.get_head().next = linked.get_head()
        self.assertTrue(is_circular(linked))

import unittest
from algorithms.linked_list import LinkedList
from algorithms.linked_list_circular import *


class TestCircularLinkedList(unittest.TestCase):

    def test_circular_linked_list(self):
        linked = LinkedList()
        self.assertFalse(is_circular(linked))
        linked.insert(1)
        self.assertFalse(is_circular(linked))
        linked.insert(2)
        self.assertFalse(is_circular(linked))
        linked.insert(3)
        self.assertFalse(is_circular(linked))
        linked.get_tail().next = linked.get_head()
        self.assertTrue(is_circular(linked))
        linked.get_at(2).next = linked.get_at(1)
        self.assertTrue(is_circular(linked))
        linked.get_head().next = linked.get_head()
        self.assertTrue(is_circular(linked))
