Commit 9103fa39 by Ned Batchelder

Use assertIsInstance.

parent 3af6b90b
...@@ -792,7 +792,7 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase): ...@@ -792,7 +792,7 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
source_location.tag, source_location.org, source_location.course, 'html', 'nonportable']) source_location.tag, source_location.org, source_location.course, 'html', 'nonportable'])
html_module = module_store.get_instance(source_location.course_id, html_module_location) html_module = module_store.get_instance(source_location.course_id, html_module_location)
self.assertTrue(isinstance(html_module.data, basestring)) self.assertIsInstance(html_module.data, basestring)
new_data = html_module.data.replace('/static/', '/c4x/{0}/{1}/asset/'.format( new_data = html_module.data.replace('/static/', '/c4x/{0}/{1}/asset/'.format(
source_location.org, source_location.course)) source_location.org, source_location.course))
module_store.update_item(html_module_location, new_data) module_store.update_item(html_module_location, new_data)
......
...@@ -42,6 +42,6 @@ class CeleryConfigTest(unittest.TestCase): ...@@ -42,6 +42,6 @@ class CeleryConfigTest(unittest.TestCase):
# We don't know the other dict values exactly, # We don't know the other dict values exactly,
# but we can assert that they take the right form # but we can assert that they take the right form
self.assertTrue(isinstance(result_dict['task_id'], unicode)) self.assertIsInstance(result_dict['task_id'], unicode)
self.assertTrue(isinstance(result_dict['time'], float)) self.assertIsInstance(result_dict['time'], float)
self.assertTrue(result_dict['time'] > 0.0) self.assertTrue(result_dict['time'] > 0.0)
...@@ -769,10 +769,10 @@ class OpenEndedModuleXmlTest(unittest.TestCase, DummyModulestore): ...@@ -769,10 +769,10 @@ class OpenEndedModuleXmlTest(unittest.TestCase, DummyModulestore):
self.assertEqual(module.current_task_number, 0) self.assertEqual(module.current_task_number, 0)
html = module.get_html() html = module.get_html()
self.assertTrue(isinstance(html, basestring)) self.assertIsInstance(html, basestring)
rubric = module.handle_ajax("get_combined_rubric", {}) rubric = module.handle_ajax("get_combined_rubric", {})
self.assertTrue(isinstance(rubric, basestring)) self.assertIsInstance(rubric, basestring)
self.assertEqual(module.state, "assessing") self.assertEqual(module.state, "assessing")
module.handle_ajax("reset", {}) module.handle_ajax("reset", {})
self.assertEqual(module.current_task_number, 0) self.assertEqual(module.current_task_number, 0)
...@@ -790,7 +790,7 @@ class OpenEndedModuleXmlTest(unittest.TestCase, DummyModulestore): ...@@ -790,7 +790,7 @@ class OpenEndedModuleXmlTest(unittest.TestCase, DummyModulestore):
#Simulate a student saving an answer #Simulate a student saving an answer
module.handle_ajax("save_answer", {"student_answer": self.answer}) module.handle_ajax("save_answer", {"student_answer": self.answer})
status = module.handle_ajax("get_status", {}) status = module.handle_ajax("get_status", {})
self.assertTrue(isinstance(status, basestring)) self.assertIsInstance(status, basestring)
#Mock a student submitting an assessment #Mock a student submitting an assessment
assessment_dict = MockQueryDict() assessment_dict = MockQueryDict()
......
...@@ -29,7 +29,7 @@ class TestErrorModule(unittest.TestCase, SetupTestErrorModules): ...@@ -29,7 +29,7 @@ class TestErrorModule(unittest.TestCase, SetupTestErrorModules):
def test_error_module_xml_rendering(self): def test_error_module_xml_rendering(self):
descriptor = error_module.ErrorDescriptor.from_xml( descriptor = error_module.ErrorDescriptor.from_xml(
self.valid_xml, self.system, self.org, self.course, self.error_msg) self.valid_xml, self.system, self.org, self.course, self.error_msg)
self.assertTrue(isinstance(descriptor, error_module.ErrorDescriptor)) self.assertIsInstance(descriptor, error_module.ErrorDescriptor)
module = descriptor.xmodule(self.system) module = descriptor.xmodule(self.system)
context_repr = module.get_html() context_repr = module.get_html()
self.assertIn(self.error_msg, context_repr) self.assertIn(self.error_msg, context_repr)
...@@ -43,7 +43,7 @@ class TestErrorModule(unittest.TestCase, SetupTestErrorModules): ...@@ -43,7 +43,7 @@ class TestErrorModule(unittest.TestCase, SetupTestErrorModules):
error_descriptor = error_module.ErrorDescriptor.from_descriptor( error_descriptor = error_module.ErrorDescriptor.from_descriptor(
descriptor, self.error_msg) descriptor, self.error_msg)
self.assertTrue(isinstance(error_descriptor, error_module.ErrorDescriptor)) self.assertIsInstance(error_descriptor, error_module.ErrorDescriptor)
module = error_descriptor.xmodule(self.system) module = error_descriptor.xmodule(self.system)
context_repr = module.get_html() context_repr = module.get_html()
self.assertIn(self.error_msg, context_repr) self.assertIn(self.error_msg, context_repr)
...@@ -60,7 +60,7 @@ class TestNonStaffErrorModule(unittest.TestCase, SetupTestErrorModules): ...@@ -60,7 +60,7 @@ class TestNonStaffErrorModule(unittest.TestCase, SetupTestErrorModules):
def test_non_staff_error_module_create(self): def test_non_staff_error_module_create(self):
descriptor = error_module.NonStaffErrorDescriptor.from_xml( descriptor = error_module.NonStaffErrorDescriptor.from_xml(
self.valid_xml, self.system, self.org, self.course) self.valid_xml, self.system, self.org, self.course)
self.assertTrue(isinstance(descriptor, error_module.NonStaffErrorDescriptor)) self.assertIsInstance(descriptor, error_module.NonStaffErrorDescriptor)
def test_from_xml_render(self): def test_from_xml_render(self):
descriptor = error_module.NonStaffErrorDescriptor.from_xml( descriptor = error_module.NonStaffErrorDescriptor.from_xml(
...@@ -78,7 +78,7 @@ class TestNonStaffErrorModule(unittest.TestCase, SetupTestErrorModules): ...@@ -78,7 +78,7 @@ class TestNonStaffErrorModule(unittest.TestCase, SetupTestErrorModules):
error_descriptor = error_module.NonStaffErrorDescriptor.from_descriptor( error_descriptor = error_module.NonStaffErrorDescriptor.from_descriptor(
descriptor, self.error_msg) descriptor, self.error_msg)
self.assertTrue(isinstance(error_descriptor, error_module.ErrorDescriptor)) self.assertIsInstance(error_descriptor, error_module.ErrorDescriptor)
module = error_descriptor.xmodule(self.system) module = error_descriptor.xmodule(self.system)
context_repr = module.get_html() context_repr = module.get_html()
self.assertNotIn(self.error_msg, context_repr) self.assertNotIn(self.error_msg, context_repr)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment