def test_find_from_last(self): reverse = self.test_string[::-1] r = nu.to_linked_list(self.test_string) for k, v in enumerate(reverse): actual = tester.find_from_last(r, k) expected = v self.assertTrue(actual == expected)
def test_recurse_3(self): r = nu.to_linked_list(self.test_string) self.assertTrue(recurse.remove(r, 3) == 'h')
def test_find_from_head(self): r = nu.to_linked_list(self.test_string) for k, v in enumerate(self.test_string): actual = tester.find_from_head(r, k) expected = v self.assertTrue(actual == expected)
def test_remove(self): r = nu.to_linked_list("pointer") remove_i = r.next.next actual = nu.to_str(t.remove(r, remove_i)) expected = "ponter" self.assertEqual(expected, actual)
def test_remove_duplicates(self): r = nu.to_linked_list("FOLLOWUP") actual = nu.to_str(tester.remove_duplicates(r)) self.assertTrue(actual == "FOLWUP")
def test_balanced(self): r = nu.to_linked_list('(())(((())()))') self.assertTrue(tester.is_balanced(r))
def test_not_balanced(self): r = nu.to_linked_list("(()") self.assertFalse(tester.is_balanced(r))