예제 #1
0
class TestListCirc(TestCase):
    def setUp(self):
        self.list_to_test = ListCirc(10)

    def tearDown(self):
        del self.list_to_test

    def test_to_list(self):

        #Testing type
        assert(type(self.list_to_test) == ListCirc), \
            self.fail("Problem with list type")

        #Test add note on first items
        for i in range(10):
            self.list_to_test.to_list(i)

        #Testing content
        for i in range(10):
            assert(self.list_to_test[i] == i),\
                self.fail("Problem with content of the listcirc")

        #Test replace note
        for i in range(20):
            self.list_to_test.to_list(i)

        #Testing size
        assert(len(self.list_to_test) == 10),\
            self.fail("Problem of size with the listcirc")

        #Testing content of the list
        for i in range(10):
            assert(self.list_to_test[i] == 10+i),\
                self.fail("Problem with content of the listcirc")


    def test_flush(self):
        #Test add note on first items
        for i in range(10):
            self.list_to_test.to_list(i)

        #Flushing list
        self.list_to_test.flush()

        #Testing attribute
        assert(len(self.list_to_test)==0), \
            self.fail("Problem flushing the list")

        assert(self.list_to_test.round==0), \
            self.fail("Problem with round attributeflushing the list")

        assert(self.list_to_test.index==0), \
            self.fail("Problem with index attribute flushing the list")
예제 #2
0
class TestListCirc(TestCase):
    def setUp(self):
        self.list_to_test = ListCirc(10)

    def tearDown(self):
        del self.list_to_test

    def test_to_list(self):

        #Testing type
        assert(type(self.list_to_test) == ListCirc), \
            self.fail("Problem with list type")

        #Test add note on first items
        for i in range(10):
            self.list_to_test.to_list(i)

        #Testing content
        for i in range(10):
            assert(self.list_to_test[i] == i),\
                self.fail("Problem with content of the listcirc")

        #Test replace note
        for i in range(20):
            self.list_to_test.to_list(i)

        #Testing size
        assert(len(self.list_to_test) == 10),\
            self.fail("Problem of size with the listcirc")

        #Testing content of the list
        for i in range(10):
            assert(self.list_to_test[i] == 10+i),\
                self.fail("Problem with content of the listcirc")

    def test_flush(self):
        #Test add note on first items
        for i in range(10):
            self.list_to_test.to_list(i)

        #Flushing list
        self.list_to_test.flush()

        #Testing attribute
        assert(len(self.list_to_test)==0), \
            self.fail("Problem flushing the list")

        assert(self.list_to_test.round==0), \
            self.fail("Problem with round attributeflushing the list")

        assert(self.list_to_test.index==0), \
            self.fail("Problem with index attribute flushing the list")
예제 #3
0
 def setUp(self):
     self.list_to_test = ListCirc(10)
예제 #4
0
 def setUp(self):
     self.list_to_test = ListCirc(10)