Skip to content

Commit

Permalink
scripted-diff: Use assertEqual instead of assertEquals
Browse files Browse the repository at this point in the history
Python unittest has deprecated assertEquals in 3.12, so change to using
assertEqual.
  • Loading branch information
achow101 committed Jan 31, 2024
1 parent 7eedbd6 commit 9b8d1e5
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions test/test_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ def test_display_address_path(self):

def test_display_address_bad_path(self):
result = self.do_command(self.dev_args + ['displayaddress', '--path', 'f'])
self.assertEquals(result['code'], -7)
self.assertEqual(result['code'], -7)

def test_display_address_descriptor(self):
account_xpub = self.do_command(self.dev_args + ['getxpub', 'm/84h/1h/0h'])['xpub']
Expand Down Expand Up @@ -743,4 +743,4 @@ def test_sign_msg(self):

def test_bad_path(self):
result = self.do_command(self.dev_args + ['signmessage', "Message signing test", 'f'])
self.assertEquals(result['code'], -7)
self.assertEqual(result['code'], -7)
24 changes: 12 additions & 12 deletions test/test_digitalbitbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,20 +110,20 @@ def test_display(self):
def test_setup_wipe(self):
# Device is init, setup should fail
result = self.do_command(self.dev_args + ['-i', 'setup', '--label', 'setup_test', '--backup_passphrase', 'testpass'])
self.assertEquals(result['code'], -10)
self.assertEquals(result['error'], 'Device is already initialized. Use wipe first and try again')
self.assertEqual(result['code'], -10)
self.assertEqual(result['error'], 'Device is already initialized. Use wipe first and try again')

# Wipe
result = self.do_command(self.dev_args + ['wipe'])
self.assertTrue(result['success'])

# Check arguments
result = self.do_command(self.dev_args + ['-i', 'setup', '--label', 'setup_test'])
self.assertEquals(result['code'], -7)
self.assertEquals(result['error'], 'The label and backup passphrase for a new Digital Bitbox wallet must be specified and cannot be empty')
self.assertEqual(result['code'], -7)
self.assertEqual(result['error'], 'The label and backup passphrase for a new Digital Bitbox wallet must be specified and cannot be empty')
result = self.do_command(self.dev_args + ['-i', 'setup', '--backup_passphrase', 'testpass'])
self.assertEquals(result['code'], -7)
self.assertEquals(result['error'], 'The label and backup passphrase for a new Digital Bitbox wallet must be specified and cannot be empty')
self.assertEqual(result['code'], -7)
self.assertEqual(result['error'], 'The label and backup passphrase for a new Digital Bitbox wallet must be specified and cannot be empty')

# Setup
result = self.do_command(self.dev_args + ['-i', 'setup', '--label', 'setup_test', '--backup_passphrase', 'testpass'])
Expand All @@ -137,17 +137,17 @@ def test_setup_wipe(self):

# Make sure device is init, setup should fail
result = self.do_command(self.dev_args + ['-i', 'setup', '--label', 'setup_test', '--backup_passphrase', 'testpass'])
self.assertEquals(result['code'], -10)
self.assertEquals(result['error'], 'Device is already initialized. Use wipe first and try again')
self.assertEqual(result['code'], -10)
self.assertEqual(result['error'], 'Device is already initialized. Use wipe first and try again')

def test_backup(self):
# Check arguments
result = self.do_command(self.dev_args + ['backup', '--label', 'backup_test'])
self.assertEquals(result['code'], -7)
self.assertEquals(result['error'], 'The label and backup passphrase for a Digital Bitbox backup must be specified and cannot be empty')
self.assertEqual(result['code'], -7)
self.assertEqual(result['error'], 'The label and backup passphrase for a Digital Bitbox backup must be specified and cannot be empty')
result = self.do_command(self.dev_args + ['backup', '--backup_passphrase', 'key'])
self.assertEquals(result['code'], -7)
self.assertEquals(result['error'], 'The label and backup passphrase for a Digital Bitbox backup must be specified and cannot be empty')
self.assertEqual(result['code'], -7)
self.assertEqual(result['error'], 'The label and backup passphrase for a Digital Bitbox backup must be specified and cannot be empty')

# Wipe
result = self.do_command(self.dev_args + ['wipe'])
Expand Down
12 changes: 6 additions & 6 deletions test/test_keepkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ def setUp(self):
def test_setup_wipe(self):
# Device is init, setup should fail
result = self.do_command(self.dev_args + ['-i', 'setup'])
self.assertEquals(result['code'], -10)
self.assertEquals(result['error'], 'Device is already initialized. Use wipe first and try again')
self.assertEqual(result['code'], -10)
self.assertEqual(result['error'], 'Device is already initialized. Use wipe first and try again')

# Wipe
result = self.do_command(self.dev_args + ['wipe'])
Expand All @@ -225,8 +225,8 @@ def test_setup_wipe(self):

# Make sure device is init, setup should fail
result = self.do_command(self.dev_args + ['-i', 'setup'])
self.assertEquals(result['code'], -10)
self.assertEquals(result['error'], 'Device is already initialized. Use wipe first and try again')
self.assertEqual(result['code'], -10)
self.assertEqual(result['error'], 'Device is already initialized. Use wipe first and try again')

def test_label(self):
result = self.do_command(self.dev_args + ['wipe'])
Expand Down Expand Up @@ -372,7 +372,7 @@ def test_passphrase(self):
for dev in result:
if dev['type'] == 'keepkey' and dev['path'] == 'udp:127.0.0.1:11044':
self.assertFalse(dev['needs_passphrase_sent'])
self.assertEquals(dev['fingerprint'], '95d8f670')
self.assertEqual(dev['fingerprint'], '95d8f670')
break
else:
self.fail("Did not enumerate device")
Expand All @@ -381,7 +381,7 @@ def test_passphrase(self):
for dev in result:
if dev['type'] == 'keepkey' and dev['path'] == 'udp:127.0.0.1:11044':
self.assertFalse(dev['needs_passphrase_sent'])
self.assertEquals(dev['fingerprint'], '95d8f670')
self.assertEqual(dev['fingerprint'], '95d8f670')
break
else:
self.fail("Did not enumerate device")
Expand Down
12 changes: 6 additions & 6 deletions test/test_trezor.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ def setUp(self):
def test_setup_wipe(self):
# Device is init, setup should fail
result = self.do_command(self.dev_args + ['-i', 'setup'])
self.assertEquals(result['code'], -10)
self.assertEquals(result['error'], 'Device is already initialized. Use wipe first and try again')
self.assertEqual(result['code'], -10)
self.assertEqual(result['error'], 'Device is already initialized. Use wipe first and try again')

# Wipe
result = self.do_command(self.dev_args + ['wipe'])
Expand All @@ -233,8 +233,8 @@ def test_setup_wipe(self):

# Make sure device is init, setup should fail
result = self.do_command(self.dev_args + ['-i', 'setup'])
self.assertEquals(result['code'], -10)
self.assertEquals(result['error'], 'Device is already initialized. Use wipe first and try again')
self.assertEqual(result['code'], -10)
self.assertEqual(result['error'], 'Device is already initialized. Use wipe first and try again')

def test_label(self):
result = self.do_command(self.dev_args + ['wipe'])
Expand Down Expand Up @@ -401,7 +401,7 @@ def test_passphrase(self):
for dev in result:
if dev['type'] == 'trezor' and dev['path'] == 'udp:127.0.0.1:21324':
self.assertFalse(dev['needs_passphrase_sent'])
self.assertEquals(dev['fingerprint'], '95d8f670')
self.assertEqual(dev['fingerprint'], '95d8f670')
break
else:
self.fail("Did not enumerate device")
Expand All @@ -410,7 +410,7 @@ def test_passphrase(self):
for dev in result:
if dev['type'] == 'trezor' and dev['path'] == 'udp:127.0.0.1:21324':
self.assertFalse(dev['needs_passphrase_sent'])
self.assertEquals(dev['fingerprint'], '95d8f670')
self.assertEqual(dev['fingerprint'], '95d8f670')
break
else:
self.fail("Did not enumerate device")
Expand Down

0 comments on commit 9b8d1e5

Please sign in to comment.