kyu_6.default_list package

Submodules

kyu_6.default_list.default_list module

Solution for -> DefaultList.

Created by Egor Kostan. GitHub: https://github.com/ikostan

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

Bases: object

A class called DefaultList.

append(item) None[source]

Support the regular list functions: append.

Parameters:

item

Returns:

extend(items: list) None[source]

Support the regular list functions: extend.

Parameters:

items – iterable

Returns:

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

Support the regular list functions: insert.

Parameters:
  • index

  • item

Returns:

pop(index=None)[source]

Support the regular list functions: pop.

Parameters:

index

Returns:

remove(item) None[source]

Support the regular list functions: remove.

Parameters:

item

Returns:

kyu_6.default_list.test_default_list module

Test for -> DefaultList.

Created by Egor Kostan. GitHub: https://github.com/ikostan

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

Bases: 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.

_classSetupFailed = False
_class_cleanups = []
test_default_list_append()[source]

Testing ‘DefaultList’ class: append.

Returns:

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.

Returns:

test_default_list_insert()[source]

Testing ‘DefaultList’ class: insert.

Returns:

test_default_list_pop()[source]

Testing ‘DefaultList’ class: pop.

Returns:

test_default_list_remove()[source]

Testing ‘DefaultList’ class: remove.

Returns:

kyu_6.default_list.test_edge_case_list module

Test for edge case -> DefaultList.

Created by Egor Kostan. GitHub: https://github.com/ikostan

class kyu_6.default_list.test_edge_case_list.EdgeCaseListTestCase(methodName='runTest')[source]

Bases: TestCase

Testing ‘DefaultList’ class with edge cases.

_classSetupFailed = False
_class_cleanups = []
test_default_list_edge_cases_pop()[source]

Testing ‘DefaultList’ class: pop.

Tests regular pop operations and edge case of popping from empty list. :return:

Module contents

DefaultList.