Module Unittests

Test suite for lorem module.

test_lorem._T

Type variable.

alias of TypeVar(‘_T’)

test_lorem.islice(iterable, stop)[source]

Wrapper function for itertools.islice().

Parameters
  • iterable (Iterator[test_lorem._T]) –

  • stop (int) –

Return type

List[test_lorem._T]

test_lorem.shuffle(x, random=None)[source]

Mock random.shuffle(), but actually do nothing.

Parameters
  • x (List[Any]) –

  • random (Optional[Callable[[], float]]) –

test_lorem.randint(a, b)[source]

Mock random.randint(), but return the lower boundary.

Parameters
Return type

int

test_lorem.choice_first(seq)[source]

Mock random.choice(), but return the first element.

Parameters

seq (Sequence[test_lorem._T]) –

Return type

test_lorem._T

test_lorem.choice_last(seq)[source]

Mock random.choice(), but return the last element.

Parameters

seq (Sequence[test_lorem._T]) –

Return type

test_lorem._T

test_lorem.pool(dupe=1)[source]

Mock lorem._gen_pool(), but return a minimised pool.

Parameters

dupe (int) –

Return type

Iterator[str]

class test_lorem.TestLorem(methodName='runTest')[source]

Bases: unittest.case.TestCase

Unittest case for lorem module.

mock_shuffle = <unittest.mock._patch object>

Mock random.shuffle()

mock_randint = <unittest.mock._patch object>

Mock random.randint()

mock_choice_first = <unittest.mock._patch object>

Mock random.choice() by choosing the first item.

mock_choice_last = <unittest.mock._patch object>

Mock random.choice() by choosing the last item.

mock_text = <unittest.mock._patch object>

Mock lorem._TEXT by a minimised pool (['lorem', 'ipsum']).

mock_pool = <unittest.mock._patch object>

Mock lorem._gen_pool().

test_set_pool()[source]

Test lorem.set_pool().

test_gen_pool()[source]

Test lorem._gen_pool().

test_gen_word()[source]

Test lorem._gen_word().

test_gen_sentence()[source]

Test lorem._gen_sentence().

test_gen_paragraph()[source]

Test lorem._gen_paragraph().

test_word()[source]

Test lorem.word().

test_sentence()[source]

Test lorem.sentence().

test_paragraph()[source]

Test lorem.paragraph().

test_get_word()[source]

Test lorem.get_word().

test_get_sentence()[source]

Test lorem.get_sentence().

test_get_paragraph()[source]

Test lorem.get_paragraph().