timApp.tests.unit package#

Submodules#

timApp.tests.unit.test_attributeparser module#

class timApp.tests.unit.test_attributeparser.AttributeParserTest(methodName='runTest')[source]#

Bases: unittest.case.TestCase

check_invalid(string)[source]#
check_valid(string, expected, expected_index=0)[source]#
test_brace()[source]#
test_broken()[source]#
test_keyvalues()[source]#
test_random()[source]#
test_whitespace()[source]#

timApp.tests.unit.test_correct_yaml module#

class timApp.tests.unit.test_correct_yaml.TestCorrect_yaml(methodName='runTest')[source]#

Bases: unittest.case.TestCase

test_comparesame()[source]#
test_correct_yaml1()[source]#
test_correct_yaml10()[source]#
test_correct_yaml2()[source]#
test_correct_yaml3()[source]#
test_correct_yaml4()[source]#
test_correct_yaml5()[source]#
test_correct_yaml6()[source]#
test_correct_yaml7()[source]#
test_correct_yaml8()[source]#
test_correct_yaml9()[source]#

timApp.tests.unit.test_dataclass_deserialization module#

class timApp.tests.unit.test_dataclass_deserialization.DataclassDeserializationTest(methodName='runTest')[source]#

Bases: unittest.case.TestCase

test_any_deserialization()[source]#
test_float_deserialization()[source]#

timApp.tests.unit.test_datefilters module#

class timApp.tests.unit.test_datefilters.TestFormatDate(methodName='runTest')[source]#

Bases: unittest.case.TestCase

test_fmt_date_default()[source]#
test_fmt_date_normal()[source]#
class timApp.tests.unit.test_datefilters.TestInc(methodName='runTest')[source]#

Bases: unittest.case.TestCase

test_post_inc1()[source]#
test_post_inc2()[source]#
test_pre_inc1()[source]#
test_pre_inc2()[source]#
class timApp.tests.unit.test_datefilters.TestMonthToWeek(methodName='runTest')[source]#

Bases: unittest.case.TestCase

test_m2w_normal()[source]#
class timApp.tests.unit.test_datefilters.TestWeekToDate(methodName='runTest')[source]#

Bases: unittest.case.TestCase

test_w2date_default()[source]#
test_w2date_format()[source]#
test_w2date_normal()[source]#
test_w2date_sunday()[source]#
class timApp.tests.unit.test_datefilters.TestWeekToText(methodName='runTest')[source]#

Bases: unittest.case.TestCase

test_w2text_end_of_year()[source]#
test_w2text_end_of_year2()[source]#
test_w2text_just3()[source]#
test_w2text_just_dates()[source]#
test_w2text_normal()[source]#
test_w2text_shorter()[source]#
test_w2text_too_many()[source]#
test_w2text_too_many2()[source]#

timApp.tests.unit.test_dateparsing module#

class timApp.tests.unit.test_dateparsing.DateParseTest(methodName='runTest')[source]#

Bases: unittest.case.TestCase

test_parse_custom()[source]#
test_parse_human_readable()[source]#
test_parse_human_readable_ambiguous()[source]#
test_parse_isodate()[source]#

timApp.tests.unit.test_documentparser module#

class timApp.tests.unit.test_documentparser.DocumentParserTest(methodName='runTest')[source]#

Bases: unittest.case.TestCase

test_incomplete_code()[source]#
test_parsing()[source]#
test_validation()[source]#

timApp.tests.unit.test_find_inline_plugins module#

class timApp.tests.unit.test_find_inline_plugins.TestFindInlinePlugins(methodName='runTest')[source]#

Bases: unittest.case.TestCase

test_find_inline_plugins1()[source]#
test_find_inline_plugins2()[source]#
test_find_inline_plugins3()[source]#
test_find_inline_plugins4()[source]#
test_find_inline_plugins5()[source]#
test_find_inline_plugins6()[source]#
test_find_inline_plugins7()[source]#

timApp.tests.unit.test_genfields module#

class timApp.tests.unit.test_genfields.TestGenfields(methodName='runTest')[source]#

Bases: unittest.case.TestCase

test_genfields()[source]#
test_genfields2()[source]#
test_genfields3()[source]#
test_genfields4()[source]#
test_genfields5()[source]#
test_genfields6()[source]#
test_genfields7()[source]#
test_genfields8()[source]#
test_genfields9()[source]#
test_grange()[source]#
test_grange10()[source]#
test_grange11()[source]#
test_grange2()[source]#
test_grange3()[source]#
test_grange4()[source]#
test_grange5()[source]#
test_grange6()[source]#
test_grange7()[source]#
test_grange8()[source]#
test_grange9()[source]#

timApp.tests.unit.test_import_data module#

class timApp.tests.unit.test_import_data.TestImportData(methodName='runTest')[source]#

Bases: unittest.case.TestCase

test_conv_data_csv()[source]#
test_conv_data_csv2()[source]#
test_conv_data_csv3()[source]#
test_conv_data_csv4()[source]#
test_conv_data_csv5()[source]#
test_conv_data_field_names()[source]#
test_conv_data_field_names2()[source]#
test_conv_data_field_names4()[source]#
test_conv_data_field_names5()[source]#
test_conv_data_field_names6()[source]#
test_conv_data_field_names7()[source]#
test_conv_data_field_names8()[source]#
test_convert_data()[source]#
test_convert_data2()[source]#
test_convert_data3()[source]#

timApp.tests.unit.test_mailbody_convert module#

class timApp.tests.unit.test_mailbody_convert.MailBodyConvertTest(methodName='runTest')[source]#

Bases: unittest.case.TestCase

test_hash_convert()[source]#
test_list_spacing()[source]#
test_mailbody_convert()[source]#
test_mailbody_convert_border()[source]#
test_mailbody_convert_codeblocks()[source]#
test_mailbody_convert_quote()[source]#
test_mailbody_convert_url()[source]#

timApp.tests.unit.test_question_normalize module#

class timApp.tests.unit.test_question_normalize.QuestionJsonNormalizeTest(methodName='runTest')[source]#

Bases: unittest.case.TestCase

test_invalid()[source]#
test_normalize()[source]#

timApp.tests.unit.test_srange module#

class timApp.tests.unit.test_srange.TestSRange(methodName='runTest')[source]#

Bases: unittest.case.TestCase

test_srange_mul()[source]#
test_srange_mul_add()[source]#
test_srange_normal()[source]#
test_srange_plus()[source]#
test_srange_step()[source]#

timApp.tests.unit.test_title_to_id module#

class timApp.tests.unit.test_title_to_id.TitleToIdTest(methodName='runTest')[source]#

Bases: unittest.case.TestCase

test_title_to_id()[source]#

timApp.tests.unit.test_translator_generic module#

Contains prototypal testing for a generic model of translating from language to another.

class timApp.tests.unit.test_translator_generic.TestGenericTranslator(methodName='runTest')[source]#

Bases: timApp.tests.server.test_translation.TimTranslationTest, timApp.tests.unit.test_translator_parser.TimTranslationParserTest

test_all_notranslate()[source]#
test_all_translate()[source]#
test_empty()[source]#
test_mixed()[source]#

timApp.tests.unit.test_translator_parser module#

Contains tests for the parsing that is performed on TIM’s Markdown before machine translation. Most tests check that correct parts are being marked as Translate or NoTranslate and that the Markdown is constructed with good enough accuracy to original.

class timApp.tests.unit.test_translator_parser.TestParser(methodName='runTest')[source]#

Bases: unittest.case.TestCase, timApp.tests.unit.test_translator_parser.TimTranslationParserTest

test_base10_to_alphabet()[source]#

Test some edge-cases on the alphabet conversion.

test_bulletlist1()[source]#
test_bulletlist2()[source]#

Testing bulletlist with different indentation and with a code block in between the list.

test_get_translate_approvals_attr()[source]#
test_get_translate_approvals_latex()[source]#

Test for multiple translate approvals

test_header()[source]#

Testing different headers

test_multiple_paragraphs()[source]#

Test string that contains multiple Para-elements.

test_notranslate_style1()[source]#
test_notranslate_style2()[source]#

Testing notranslate style with brackets and parenthesis inside. Will fail if it contains unclosed [ or ]

test_notranslate_style3()[source]#

Testing notranslate along with multiple other styles

test_ordered_list1()[source]#

Testing orderedlist with all the different ways they can be formatted.

test_ordered_list2()[source]#

Testing orderedlist with all the different ways they can be formatted and with indentation.

test_ordered_list3()[source]#

Testing orderedlist with all the different ways they can be formatted with indentation and different number-digits.

test_tex_collect()[source]#
test_tex_collect_formatted()[source]#

Testing bold and italics formatting

test_tex_collect_math_function1()[source]#

Testing a math function inside latex using dollar signs

test_tex_collect_math_function2()[source]#

Testing a math function mathrm inside latex using double dollar signs

test_tex_collect_math_function3()[source]#

Testing matrices inside latex

test_tex_collect_simple_text()[source]#

Testing simple text inside latex

test_tex_collect_style_text()[source]#

Testing text with style inside latex

test_tim_plugin1()[source]#

Test that YAML-attributes defined as translatable are in fact marked as translate and that Markdown parts inside plugins are parsed as well.

test_tim_plugin2()[source]#

Test for multiple choice plugin.

test_tim_plugin3()[source]#

Test for a big sized video plugin.

test_tim_plugin4()[source]#

Test for geogebra plugin. Currently, translates only header and stem, nothing else.

class timApp.tests.unit.test_translator_parser.TimTranslationParserTest[source]#

Bases: object

A Base class to run translation tests needing a parser instance.

parser: timApp.document.translation.translationparser.TranslationParser = TranslationParser(quote='"')#

timApp.tests.unit.test_unique_code module#

class timApp.tests.unit.test_unique_code.TestUniqueCode(methodName='runTest')[source]#

Bases: unittest.case.TestCase

test_parse()[source]#

timApp.tests.unit.test_valid_email module#

class timApp.tests.unit.test_valid_email.ValidEmailTest(methodName='runTest')[source]#

Bases: unittest.case.TestCase

assert_invalid_email(email: str)[source]#
assert_valid_email(email: str)[source]#
test_invalid_email()[source]#
test_valid_email()[source]#

timApp.tests.unit.test_widen_fields module#

class timApp.tests.unit.test_widen_fields.TestWidenFields(methodName='runTest')[source]#

Bases: unittest.case.TestCase

test_widen_fields()[source]#
test_widen_fields1()[source]#
test_widen_fields10()[source]#
test_widen_fields2()[source]#
test_widen_fields3()[source]#
test_widen_fields4()[source]#
test_widen_fields5()[source]#
test_widen_fields6()[source]#
test_widen_fields7()[source]#
test_widen_fields8()[source]#
test_widen_fields9()[source]#
class timApp.tests.unit.test_widen_fields.TestgetAlias(methodName='runTest')[source]#

Bases: unittest.case.TestCase

test_get_name1()[source]#
test_get_name2()[source]#
test_get_name3()[source]#
test_get_name4()[source]#
test_get_name5()[source]#
test_get_name6()[source]#
test_get_name7()[source]#

timApp.tests.unit.test_yamlblock module#

class timApp.tests.unit.test_yamlblock.YamlBlockTest(methodName='runTest')[source]#

Bases: unittest.case.TestCase

combined_append = '\nmacros:\n first: a\n second: c\n third: d\ncss: |!! a\n.red {\n    color: red;\n}\n.blue {\n    color: blue;\n}\n!!\n    '#
combined_replace = '\nmacros:\n first: a\n second: c\n third: d\ncss: |!!\n.blue {\n    color: blue;\n}\n!!\n        '#
md1 = '\nmacros:\n first: a\n second: b\ncss: |!!\n.red {\n    color: red;\n}\n!!\n    '#
md2 = '\nmacros:\n second: c\n third: d\ncss: |!!\n.blue {\n    color: blue;\n}\n!!\n    '#
multiple_multiline = '\na: |!!\ntest1\n!!\nb: |??\ntest2\n??\n    '#
test_anchor_depth()[source]#
test_css_default_append()[source]#
test_duplicate_key_append()[source]#
test_empty()[source]#
test_empty_line_auto_indent()[source]#
test_empty_multiline_key()[source]#
test_invalid()[source]#
test_merge_append()[source]#
test_merge_replace()[source]#
test_merge_replace_if_not_exist()[source]#
test_missing_end()[source]#
test_multiline_append_deeper()[source]#
test_multiline_invalid_indentation()[source]#
test_multiple_multiline()[source]#
test_one_char_terminator()[source]#
test_parse()[source]#
test_same_key_diff_level()[source]#
test_standard()[source]#
test_standard_indent_marker()[source]#

Module contents#