Skip to content

Commit

Permalink
Refactor deprecated unittest aliases for Python 3.11 compatibility. (#41
Browse files Browse the repository at this point in the history
)
  • Loading branch information
tirkarthi authored Mar 27, 2022
1 parent ab462c0 commit 2ea4817
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions tests/test_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class AttributesFieldsTestCase(TestCase):
def test_attributes_form_field(self):
field = AttributesFormField()
# to_python method
self.assertEquals(field.to_python({"test": True}), {"test": True})
self.assertEqual(field.to_python({"test": True}), {"test": True})
with self.assertRaises(ValidationError):
field.to_python("no json")
# validate method
Expand All @@ -79,28 +79,28 @@ def test_attributes_form_field(self):
def test_attributes_field(self):
field = AttributesField(null=True, default={"my": "default"})
# formfield method
self.assertEquals(field.formfield().initial, {"my": "default"})
self.assertEqual(field.formfield().initial, {"my": "default"})
# from_db_value method
self.assertIsNone(field.from_db_value(None))
self.assertEquals(
self.assertEqual(
field.from_db_value('{"test": "test"}'),
{"test": "test"},
)
self.assertEquals(
self.assertEqual(
field.from_db_value({"test": "test"}),
{"test": "test"},
)
# get_db_prep_value method
self.assertIsNone(field.get_db_prep_value(None))
field.null = False
field.blank = True
self.assertEquals(field.get_db_prep_value(None), "")
self.assertEqual(field.get_db_prep_value(None), "")
# get_default method
field = AttributesField(default='{"my": "default"}')
field.default = NOT_PROVIDED
field.get_default()
# get_internal_type method
self.assertEquals(field.get_internal_type(), "TextField")
self.assertEqual(field.get_internal_type(), "TextField")
# validate method
with self.assertRaises(ValidationError):
field.validate(None, Noop)
2 changes: 1 addition & 1 deletion tests/test_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_plugin_form(self):
warnings.simplefilter("ignore")
response = self.client.post(request_url, data)

self.assertEquals(response.status_code, 200)
self.assertEqual(response.status_code, 200)
self.assertContains(response, '<div class="success">')

# test error for excluded keys
Expand Down

0 comments on commit 2ea4817

Please sign in to comment.