kyu_6.default_list package

Submodules

kyu_6.default_list.default_list module

class kyu_6.default_list.default_list.DefaultList(lst: list, default_value: str)[source]

Bases: object

append(item) → None[source]

This class must also support the regular list functions: append. :param item: :return:

extend(items: list) → None[source]

This class must also support the regular list functions: extend. :param items: iterable :return:

insert(index: int, item) → None[source]

This class must also support the regular list functions: insert. :param index: :param item: :return:

pop(item)[source]

This class must also support the regular list functions: pop. :param item: :return:

remove(item) → None[source]

This class must also support the regular list functions: remove. :param item: :return:

kyu_6.default_list.test_default_list module

class kyu_6.default_list.test_default_list.DefaultListTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

Testing ‘DefaultList’ class

Your job is to create a class (or a function which returns an object) called DefaultList. The class will have two parameters to be given: a list, and a default value. The list will obviously be the list that corresponds to that object. The default value will be returned any time an index of the list is called in the code that would normally raise an error (i.e. i > len(list) - 1 or i < -len(list)). This class must also support the regular list functions extend, append, insert, remove, and pop.

test_default_list_append()[source]

Testing ‘DefaultList’ class: append :return:

test_default_list_basic()[source]

Testing ‘DefaultList’ class: __getitem__

Called to implement evaluation of self[key]. For sequence types, the accepted keys should be integers and slice objects. Note that the special interpretation of negative indexes (if the class wishes to emulate a sequence type) is up to the __getitem__() method. :return:

test_default_list_extend()[source]

Testing ‘DefaultList’ class: extend :return:

test_default_list_insert()[source]

Testing ‘DefaultList’ class: insert :return:

test_default_list_pop()[source]

Testing ‘DefaultList’ class: pop :return:

test_default_list_remove()[source]

Testing ‘DefaultList’ class: remove :return:

Module contents