Skip to content

Commit

Permalink
Fix pylint: deprecated-method
Browse files Browse the repository at this point in the history
The plural alias `assertEquals` is deprecated in Python3 [1].

- [1] https://docs.python.org/3/library/unittest.html#deprecated-aliases
  • Loading branch information
stvstnfrd committed Mar 6, 2019
1 parent 379a5ee commit 537258b
Showing 1 changed file with 41 additions and 41 deletions.
82 changes: 41 additions & 41 deletions freetextresponse/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def test_workbench_scenarios(self):
result_title = 'Free-text Response XBlock'
basic_scenario = "<freetextresponse />"
test_result = self.xblock.workbench_scenarios()
self.assertEquals(result_title, test_result[0][0])
self.assertEqual(result_title, test_result[0][0])
self.assertIn(basic_scenario, test_result[0][1])

def test_generate_validation_message(self):
Expand All @@ -97,11 +97,11 @@ def test_generate_validation_message(self):
_(msg)
)
test_result = FreeTextResponse._generate_validation_message(msg)
self.assertEquals(
self.assertEqual(
type(result),
type(test_result),
)
self.assertEquals(
self.assertEqual(
result.text,
test_result.text,
)
Expand All @@ -122,8 +122,8 @@ def test_validate_field_data(self, **test_dict):
self.xblock.validate_field_data(validation, test_data)
validation_list = list(validation)
# Only one validation error should be in set
self.assertEquals(1, len(validation_list))
self.assertEquals(
self.assertEqual(1, len(validation_list))
self.assertEqual(
test_dict['result'],
validation_list[0].text,
)
Expand All @@ -132,26 +132,26 @@ def test_initialization_variables(self):
"""
Checks that instance variables are initialized correctly
"""
self.assertEquals('Free-text Response', self.xblock.display_name)
self.assertEquals(
self.assertEqual('Free-text Response', self.xblock.display_name)
self.assertEqual(
'Please enter your response within this text area',
self.xblock.prompt,
)
self.assertEquals(0.0, self.xblock.score)
self.assertEquals(0, self.xblock.max_attempts)
self.assertEqual(0.0, self.xblock.score)
self.assertEqual(0, self.xblock.max_attempts)
self.assertTrue(self.xblock.display_correctness)
self.assertEquals(1, self.xblock.min_word_count)
self.assertEquals(10000, self.xblock.max_word_count)
self.assertEquals(
self.assertEqual(1, self.xblock.min_word_count)
self.assertEqual(10000, self.xblock.max_word_count)
self.assertEqual(
[],
self.xblock.fullcredit_keyphrases,
)
self.assertEquals(
self.assertEqual(
[],
self.xblock.halfcredit_keyphrases,
)
self.assertEquals('', self.xblock.student_answer)
self.assertEquals(0, self.xblock.count_attempts)
self.assertEqual('', self.xblock.student_answer)
self.assertEqual(0, self.xblock.count_attempts)

# Default Views
def test_student_view(self):
Expand Down Expand Up @@ -208,7 +208,7 @@ def test_max_score(self):
Should return the weight
"""
self.xblock.weight = 4
self.assertEquals(self.xblock.weight, self.xblock.max_score())
self.assertEqual(self.xblock.weight, self.xblock.max_score())

def test_studio_view(self):
"""
Expand Down Expand Up @@ -252,7 +252,7 @@ def test_determine_credit(self, **test_data):
self.xblock.halfcredit_keyphrases = test_data['halfcredit']
self.xblock.student_answer = test_data['student_answer']
credit = Credit[test_data['credit']]
self.assertEquals(credit, self.xblock._determine_credit())
self.assertEqual(credit, self.xblock._determine_credit())

@ddt.data(Credit.zero, Credit.half, Credit.full)
def test_compute_score(self, credit):
Expand Down Expand Up @@ -345,7 +345,7 @@ def test_word_count_valid(self, **test_data):
self.xblock.min_word_count = test_data['min_word_count']
self.xblock.max_word_count = test_data['max_word_count']
self.xblock.student_answer = test_data['student_answer']
self.assertEquals(test_data['result'], self.xblock._word_count_valid())
self.assertEqual(test_data['result'], self.xblock._word_count_valid())

# Messages
@ddt.data(
Expand All @@ -369,7 +369,7 @@ def test_used_attempts_feedback_normal(
"""
self.xblock.max_attempts = max_attempts
self.xblock.count_attempts = count_attempts
self.assertEquals(
self.assertEqual(
_(result),
self.xblock._get_used_attempts_feedback(),
)
Expand All @@ -395,7 +395,7 @@ def test_get_word_count_message(
"""
self.xblock.min_word_count = min_word_count
self.xblock.max_word_count = max_word_count
self.assertEquals(
self.assertEqual(
_(result),
self.xblock._get_word_count_message(),
)
Expand All @@ -415,7 +415,7 @@ def test_get_user_alert(self, **test_data):
self.xblock.count_attempts = test_data['count_attempts']
self.xblock.min_word_count = test_data['min_word_count']
self.xblock.max_word_count = test_data['max_word_count']
self.assertEquals(
self.assertEqual(
_(str(test_data['result'])),
self.xblock._get_user_alert(
ignore_attempts=test_data['ignore_attempts']
Expand Down Expand Up @@ -444,7 +444,7 @@ def test_get_submitted_message(
return_value=word_count_valid
)
self.xblock.submitted_message = 'test submission received message'
self.assertEquals(
self.assertEqual(
_(result),
self.xblock._get_submitted_message(),
)
Expand All @@ -460,7 +460,7 @@ def test_get_problem_progress(self, **test_data):
"""
self.xblock.weight = test_data['weight']
self.xblock.score = test_data['score']
self.assertEquals(
self.assertEqual(
_(test_data['result']),
self.xblock._get_problem_progress(),
)
Expand All @@ -483,7 +483,7 @@ def test_get_indicator_class(self, **test_data):
return_value=test_data['word_count_valid']
)
self.xblock._determine_credit = MagicMock(return_value=credit)
self.assertEquals(
self.assertEqual(
test_data['result'],
self.xblock._get_indicator_class()
)
Expand All @@ -502,7 +502,7 @@ def test_get_indicator_visibility_class(self, display_correctness, result):
hide correctness UI
"""
self.xblock.display_correctness = display_correctness
self.assertEquals(
self.assertEqual(
result,
self.xblock._get_indicator_visibility_class(),
)
Expand All @@ -518,7 +518,7 @@ def test_get_submitdisplay_class(self, **test_data):
"""
self.xblock.max_attempts = test_data['max_attempts']
self.xblock.count_attempts = test_data['count_attempts']
self.assertEquals(
self.assertEqual(
test_data['result'],
self.xblock._get_nodisplay_class()
)
Expand All @@ -535,37 +535,37 @@ def test_submit(self):
response = self.xblock.submit(request)
# Added for response json_body
# pylint: disable=no-member
self.assertEquals(
self.assertEqual(
response.json_body['status'],
'success'
)
self.assertEquals(
self.assertEqual(
response.json_body['problem_progress'],
self.xblock._get_problem_progress()
)
self.assertEquals(
self.assertEqual(
response.json_body['indicator_class'],
self.xblock._get_indicator_class()
)
self.assertEquals(
self.assertEqual(
response.json_body['used_attempts_feedback'],
self.xblock._get_used_attempts_feedback()
)
self.assertEquals(
self.assertEqual(
response.json_body['nodisplay_class'],
self.xblock._get_nodisplay_class()
)
self.assertEquals(
self.assertEqual(
response.json_body['submitted_message'],
self.xblock._get_submitted_message()
)
self.assertEquals(
self.assertEqual(
response.json_body['user_alert'],
self.xblock._get_user_alert(
ignore_attempts=True,
)
)
self.assertEquals(
self.assertEqual(
response.json_body['visibility_class'],
self.xblock._get_indicator_visibility_class()
)
Expand All @@ -582,34 +582,34 @@ def test_save_reponse(self):
response = self.xblock.save_reponse(request)
# Added for response json_body
# pylint: disable=no-member
self.assertEquals(
self.assertEqual(
response.json_body['status'],
'success'
)
self.assertEquals(
self.assertEqual(
response.json_body['problem_progress'],
self.xblock._get_problem_progress()
)
self.assertIsNone(
response.json_body.get('indicator_class', None),
)
self.assertEquals(
self.assertEqual(
response.json_body['used_attempts_feedback'],
self.xblock._get_used_attempts_feedback()
)
self.assertEquals(
self.assertEqual(
response.json_body['nodisplay_class'],
self.xblock._get_nodisplay_class()
)
self.assertEquals(
self.assertEqual(
response.json_body['submitted_message'],
''
)
self.assertEquals(
self.assertEqual(
response.json_body['user_alert'],
self.xblock.saved_message
)
self.assertEquals(
self.assertEqual(
response.json_body['visibility_class'],
self.xblock._get_indicator_visibility_class()
)

0 comments on commit 537258b

Please sign in to comment.