def testDirectInverse(self): with os_environ(HTTP_COOKIE="session=7777"): actual = self._definition.sub_page('direct-inverse', '7777', mock_validation()) expected = load_subpage("direct-inverse") self.assertEqual(remove_empty_lines(actual), remove_empty_lines(expected))
def testSententialNegation(self): with os_environ(HTTP_COOKIE="session=7777"): actual = self._definition.sub_page('sentential-negation', '7777', mock_validation()) expected = load_subpage("sentential-negation") self.assertEqual(remove_empty_lines(actual), remove_empty_lines(expected))
def testHtmlSelect_multi_onchange(self): actual = html.html_select(mock_validation(), "hello", onchange="test();", multi=True) expected = '<select name="hello" class="multi" multiple="multiple" onchange="test();">' self.assertEqual(actual, expected)
def testArgumentOptionality(self): with os_environ(HTTP_COOKIE="session=7777"): actual = self._definition.sub_page('arg-opt', '7777', mock_validation()) expected = load_subpage("arg-opt") self.assertEqual(remove_empty_lines(actual), remove_empty_lines(expected))
def testHtmlSelect_onfocus_onchange(self): actual = html.html_select(mock_validation(), "hello", onfocus="test1();", onchange="test2();") expected = '<select name="hello" onfocus="test1();" onchange="test2();">' self.assertEqual(actual, expected)
def testOtherFeatures(self): with os_environ(HTTP_COOKIE="session=7777"): actual = self._definition.sub_page('other-features', '7777', mock_validation()) expected = load_subpage("other-features") self.assertEqual(remove_empty_lines(actual), remove_empty_lines(expected))
def testTAM(self): with os_environ(HTTP_COOKIE="session=7777"): actual = self._definition.sub_page('tense-aspect-mood', '7777', mock_validation()) expected = load_subpage("TAM") self.assertEqual(remove_empty_lines(actual), remove_empty_lines(expected))
def testInformationStructure(self): with os_environ(HTTP_COOKIE="session=7777"): actual = self._definition.sub_page('info-str', '7777', mock_validation()) expected = load_subpage("info-str") self.assertEqual(remove_empty_lines(actual), remove_empty_lines(expected))
def testHtmlInput_checkbox_marked_double(self): actual = html.html_input( mock_validation(errors={"hello": mock_error(message="error")}, infos={"hello": mock_error(message="info")}), "checkbox", "hello", "test_value", False) expected = '<label><a name="" style="text-decoration:none"><span class="error" title="error">*</span></a><input type="checkbox" name="hello" value="test_value"></label>' self.assertEqual(actual, expected)
def testNumber(self): with os_environ(HTTP_COOKIE="session=7777"): actual = self._definition.sub_page('number', '7777', mock_validation()) expected = load_subpage("number") self.assertEqual(remove_empty_lines(actual), remove_empty_lines(expected))
def testHtmlSelect_multi_error(self): actual = html.html_select( mock_validation(errors={"hello": mock_error(message="error")}), "hello", multi=True) expected = '<a name="" style="text-decoration:none"><span class="error" title="error">*</span></a><select name="hello" class="multi" multiple="multiple" >' self.assertEqual(actual, expected)
def testMatrixYesNo(self): with os_environ(HTTP_COOKIE="session=7777"): actual = self._definition.sub_page('matrix-yes-no', '7777', mock_validation()) expected = load_subpage("matrix-yes-no") self.assertEqual(remove_empty_lines(actual), remove_empty_lines(expected))
def testLexicon_Choices2(self): with os_environ(HTTP_COOKIE="session=7777"), environ_choices( "lexicon_choices2.txt"): actual = self._definition.sub_page('lexicon', '7777', mock_validation()) expected = load_subpage("lexicon_choices2") self.assertEqual(remove_empty_lines(actual), remove_empty_lines(expected))
def testHtmlInput_checkbox_disabled(self): actual = html.html_input(mock_validation(), "checkbox", "hello", "test_value", False, disabled=True) expected = '<label><input type="checkbox" name="hello" value="test_value" disabled="disabled"></label>' self.assertEqual(actual, expected)
def testHtmlInput_text_sized(self): actual = html.html_input(mock_validation(), "text", "hello", "test_value", False, size="42") expected = '<input type="text" name="hello" value="test_value" size="42">' self.assertEqual(actual, expected)
def testHtmlInput_checkbox_after(self): actual = html.html_input(mock_validation(), "checkbox", "hello", "test_value", False, after="</div>") expected = '<label><input type="checkbox" name="hello" value="test_value"></div></label>' self.assertEqual(actual, expected)
def testHtmlInput_checkbox_before(self): actual = html.html_input(mock_validation(), "checkbox", "hello", "test_value", False, before="Button: ") expected = '<label>Button: <input type="checkbox" name="hello" value="test_value"></label>' self.assertEqual(actual, expected)
def testHtmlInput_textarea_sized(self): actual = html.html_input(mock_validation(), "textarea", "hello", "test_value", False, size="42x42") expected = '<TextArea name="hello" cols="42" rows="42">test_value</TextArea>' self.assertEqual(actual, expected)
def testHtmlInput_radio_onclick(self): actual = html.html_input(mock_validation(), "radio", "hello", "test_value", False, onclick="helloworld();") expected = '<label><input type="radio" name="hello" value="test_value" onclick="helloworld();"></label>' self.assertEqual(actual, expected)
def testHtmlInput_radio_before_after(self): actual = html.html_input(mock_validation(), "radio", "hello", "test_value", False, before="<div>Button: ", after="</div>") expected = '<label><div>Button: <input type="radio" name="hello" value="test_value"></div></label>' self.assertEqual(actual, expected)
def testHtmlInput_hidden_basic(self): actual = html.html_input(mock_validation(), "hidden", "hello", "test_value", False) expected = '<input type="hidden" name="hello" value="test_value">' self.assertEqual(actual, expected)
def testHtmlInput_checkbox_marked_negative(self): actual = html.html_input( mock_validation(infos={"world": mock_error(message="info")}), "checkbox", "hello", "test_value", False) expected = '<label><input type="checkbox" name="hello" value="test_value"></label>' self.assertEqual(actual, expected)
def testHtmlSelect_info(self): actual = html.html_select( mock_validation(infos={"hello": mock_error(message="info")}), "hello") expected = '<a href="" style="text-decoration:none"><span class="info" title="info">#</span></a><select name="hello">' self.assertEqual(actual, expected)
def testHtmlInput_textarea_basic(self): actual = html.html_input(mock_validation(), "textarea", "hello", "test_value", False) expected = '<TextArea name="hello">test_value</TextArea>' self.assertEqual(actual, expected)
def testHtmlSelect_basic(self): actual = html.html_select(mock_validation(), "hello") expected = '<select name="hello">' self.assertEqual(actual, expected)
def testHtmlSelect_warning(self): actual = html.html_select( mock_validation(warnings={"hello": mock_error(message="warning")}), "hello") expected = '<a name="" style="text-decoration:none"><span class="error" title="warning">?</span></a><select name="hello">' self.assertEqual(actual, expected)
def testHtmlInput_radio_basic(self): actual = html.html_input(mock_validation(), "radio", "hello", "test_value", False) expected = '<label><input type="radio" name="hello" value="test_value"></label>' self.assertEqual(actual, expected)