Fixing "wrong-assert-type" pep8 warning.

TNL-3650
This commit is contained in:
muzaffaryousaf
2015-10-29 14:23:01 +05:00
parent d9751a855a
commit cc88cfaf64
11 changed files with 32 additions and 34 deletions

View File

@@ -124,7 +124,7 @@ class CapaHtmlRenderTest(unittest.TestCase):
rendered_html = etree.XML(problem.get_html())
# expect the javascript is still present in the rendered html
self.assertTrue("<script type=\"text/javascript\">function(){}</script>" in etree.tostring(rendered_html))
self.assertIn("<script type=\"text/javascript\">function(){}</script>", etree.tostring(rendered_html))
def test_render_response_xml(self):
# Generate some XML for a string response

View File

@@ -105,8 +105,7 @@ class TemplateTestCase(unittest.TestCase):
If no elements are found, the assertion fails.
"""
element_list = xml_root.xpath(xpath)
self.assertTrue(len(element_list) > 0,
"Could not find element at '%s'" % str(xpath))
self.assertGreater(len(element_list), 0, "Could not find element at '%s'" % str(xpath))
if exact:
self.assertEqual(text, element_list[0].text)

View File

@@ -555,8 +555,8 @@ class MatlabTest(unittest.TestCase):
response = self.the_input.handle_ajax("plot", data)
self.assertFalse(response['success'])
self.assertEqual(response['message'], error_message)
self.assertTrue('queuekey' not in self.the_input.input_state)
self.assertTrue('queuestate' not in self.the_input.input_state)
self.assertNotIn('queuekey', self.the_input.input_state)
self.assertNotIn('queuestate', self.the_input.input_state)
@patch('capa.inputtypes.time.time', return_value=10)
def test_ungraded_response_success(self, time):
@@ -594,7 +594,7 @@ class MatlabTest(unittest.TestCase):
the_input.ungraded_response(queue_msg, 'abc')
self.assertEqual(input_state['queuekey'], queuekey)
self.assertEqual(input_state['queuestate'], 'queued')
self.assertFalse('queue_msg' in input_state)
self.assertNotIn('queue_msg', input_state)
@patch('capa.inputtypes.time.time', return_value=20)
def test_matlab_response_timeout_not_exceeded(self, time):
@@ -1076,7 +1076,7 @@ class ChemicalEquationTest(unittest.TestCase):
)
self.assertIn('error', response)
self.assertTrue("Couldn't parse formula" in response['error'])
self.assertIn("Couldn't parse formula", response['error'])
@patch('capa.inputtypes.log')
def test_ajax_other_err(self, mock_log):