Fix many wrong-assert-type errors
This commit is contained in:
@@ -544,7 +544,7 @@ class MatlabTest(unittest.TestCase):
|
||||
test_capa_system().xqueue['interface'].send_to_queue.assert_called_with(header=ANY, body=ANY)
|
||||
|
||||
self.assertTrue(response['success'])
|
||||
self.assertTrue(self.the_input.input_state['queuekey'] is not None)
|
||||
self.assertIsNotNone(self.the_input.input_state['queuekey'])
|
||||
self.assertEqual(self.the_input.input_state['queuestate'], 'queued')
|
||||
|
||||
def test_plot_data_failure(self):
|
||||
@@ -572,8 +572,8 @@ class MatlabTest(unittest.TestCase):
|
||||
queue_msg = json.dumps({'msg': inner_msg})
|
||||
|
||||
the_input.ungraded_response(queue_msg, queuekey)
|
||||
self.assertTrue(input_state['queuekey'] is None)
|
||||
self.assertTrue(input_state['queuestate'] is None)
|
||||
self.assertIsNone(input_state['queuekey'])
|
||||
self.assertIsNone(input_state['queuestate'])
|
||||
self.assertEqual(input_state['queue_msg'], inner_msg)
|
||||
|
||||
@patch('capa.inputtypes.time.time', return_value=10)
|
||||
|
||||
@@ -71,7 +71,7 @@ class ResponseTest(unittest.TestCase):
|
||||
|
||||
def assert_answer_format(self, problem): # pylint: disable=missing-docstring
|
||||
answers = problem.get_question_answers()
|
||||
self.assertTrue(answers['1_2_1'] is not None)
|
||||
self.assertIsNotNone(answers['1_2_1'])
|
||||
|
||||
def assert_multiple_grade(self, problem, correct_answers, incorrect_answers): # pylint: disable=missing-docstring
|
||||
for input_str in correct_answers:
|
||||
|
||||
@@ -67,7 +67,7 @@ class SymmathCheckTest(TestCase):
|
||||
# Expect that an incorrect response is marked incorrect
|
||||
result = symmath_check(expected_str, input_str, dynamath=[dynamath])
|
||||
self.assertTrue('ok' in result and not result['ok'])
|
||||
self.assertFalse('fail' in result['msg'])
|
||||
self.assertNotIn('fail', result['msg'])
|
||||
|
||||
def _symmath_check_numbers(self, number_list):
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ class ModuleStoreSettingsMigration(TestCase):
|
||||
def test_update_settings(self, default_store):
|
||||
mixed_setting = self.ALREADY_UPDATED_MIXED_CONFIG
|
||||
update_module_store_settings(mixed_setting, default_store=default_store)
|
||||
self.assertTrue(get_mixed_stores(mixed_setting)[0]['NAME'] == default_store)
|
||||
self.assertEqual(get_mixed_stores(mixed_setting)[0]['NAME'], default_store)
|
||||
|
||||
def test_update_settings_error(self):
|
||||
mixed_setting = self.ALREADY_UPDATED_MIXED_CONFIG
|
||||
|
||||
@@ -1230,7 +1230,7 @@ class CapaModuleTest(unittest.TestCase):
|
||||
def test_no_max_attempts(self):
|
||||
module = CapaFactory.create(max_attempts='')
|
||||
html = module.get_problem_html()
|
||||
self.assertTrue(html is not None)
|
||||
self.assertIsNotNone(html)
|
||||
# assert that we got here without exploding
|
||||
|
||||
def test_get_problem_html(self):
|
||||
@@ -1365,7 +1365,7 @@ class CapaModuleTest(unittest.TestCase):
|
||||
# Try to render the module with DEBUG turned off
|
||||
html = module.get_problem_html()
|
||||
|
||||
self.assertTrue(html is not None)
|
||||
self.assertIsNotNone(html)
|
||||
|
||||
# Check the rendering context
|
||||
render_args, _ = module.system.render_template.call_args
|
||||
@@ -1395,7 +1395,7 @@ class CapaModuleTest(unittest.TestCase):
|
||||
# Try to render the module with DEBUG turned on
|
||||
html = module.get_problem_html()
|
||||
|
||||
self.assertTrue(html is not None)
|
||||
self.assertIsNotNone(html)
|
||||
|
||||
# Check the rendering context
|
||||
render_args, _ = module.system.render_template.call_args
|
||||
@@ -1419,7 +1419,7 @@ class CapaModuleTest(unittest.TestCase):
|
||||
# Get the seed
|
||||
# By this point, the module should have persisted the seed
|
||||
seed = module.seed
|
||||
self.assertTrue(seed is not None)
|
||||
self.assertIsNotNone(seed)
|
||||
|
||||
# If we're not rerandomizing, the seed is always set
|
||||
# to the same value (1)
|
||||
@@ -1490,7 +1490,7 @@ class CapaModuleTest(unittest.TestCase):
|
||||
# Get the seed
|
||||
# By this point, the module should have persisted the seed
|
||||
seed = module.seed
|
||||
self.assertTrue(seed is not None)
|
||||
self.assertIsNotNone(seed)
|
||||
|
||||
# We do NOT want the seed to reset if rerandomize
|
||||
# is set to 'never' -- it should still be 1
|
||||
@@ -1510,7 +1510,7 @@ class CapaModuleTest(unittest.TestCase):
|
||||
# to generate a different seed
|
||||
success = _retry_and_check(5, lambda: _reset_and_get_seed(module) != seed)
|
||||
|
||||
self.assertTrue(module.seed is not None)
|
||||
self.assertIsNotNone(module.seed)
|
||||
msg = 'Could not get a new seed from reset after 5 tries'
|
||||
self.assertTrue(success, msg)
|
||||
|
||||
@@ -1543,7 +1543,7 @@ class CapaModuleTest(unittest.TestCase):
|
||||
# Get the seed
|
||||
# By this point, the module should have persisted the seed
|
||||
seed = module.seed
|
||||
self.assertTrue(seed is not None)
|
||||
self.assertIsNotNone(seed)
|
||||
|
||||
#the seed should never change because the student hasn't finished the problem
|
||||
self.assertEqual(seed, _reset_and_get_seed(module))
|
||||
|
||||
Reference in New Issue
Block a user