Starts working on Linked List. Single linked lists implementation for now.

This commit is contained in:
julien lengrand-lambert
2013-12-07 11:47:24 +01:00
parent d925aa9183
commit 26ed3fe4d8
2 changed files with 38 additions and 0 deletions

17
04_linkedList/ll.py Normal file
View File

@@ -0,0 +1,17 @@
"""
Implementation of Linked Lists
@jlengrand
2013/12
"""
class SingleListItem():
"""
Item from a Single Linked List.
Contains only a previous next element, and a value
"""
def __init__(self, value, next):
self.value = value
self.next = next

21
04_linkedList/ll_test.py Normal file
View File

@@ -0,0 +1,21 @@
"""
Unit Tests for the Linked Lists implementations
@jlengrand
2013/12
"""
from ll import SingleListItem
import unittest
class test_single_linked_list_item(unittest.TestCase):
def test_item(self):
a = 12
t = SingleListItem(12, None)
self.assertEqual(a, t.value)
if __name__ == "__main__":
unittest.main()