Fix typo and formatting in tests.core #2197

Merged
PeterSurda merged 1 commits from gitea-76 into v0.6 2024-03-15 01:24:21 +01:00

View File

@ -209,8 +209,8 @@ class TestCore(unittest.TestCase):
): ):
if c < 60: if c < 60:
self.fail( self.fail(
'Still connected to bootstrap node %s after % seconds' % 'Still connected to bootstrap node %s after %.2f'
(peer, time.time() - _started)) ' seconds' % (peer, time.time() - _started))
c += 1 c += 1
break break
else: else:
@ -220,7 +220,7 @@ class TestCore(unittest.TestCase):
continue continue
return return
self.fail( self.fail(
'Failed to connect during %s sec' % (time.time() - _started)) 'Failed to connect during %.2f sec' % (time.time() - _started))
def _check_knownnodes(self): def _check_knownnodes(self):
for stream in knownnodes.knownNodes.itervalues(): for stream in knownnodes.knownNodes.itervalues():
@ -372,14 +372,17 @@ class TestCore(unittest.TestCase):
def test_add_same_address_twice_in_addressbook(self): def test_add_same_address_twice_in_addressbook(self):
"""checking same address is added twice in addressbook""" """checking same address is added twice in addressbook"""
self.assertTrue(helper_addressbook.insert(label='test1', address=self.addr)) self.assertTrue(
self.assertFalse(helper_addressbook.insert(label='test1', address=self.addr)) helper_addressbook.insert(label='test1', address=self.addr))
self.assertFalse(
helper_addressbook.insert(label='test1', address=self.addr))
self.delete_address_from_addressbook(self.addr) self.delete_address_from_addressbook(self.addr)
def test_is_address_present_in_addressbook(self): def test_is_address_present_in_addressbook(self):
"""checking is address added in addressbook or not""" """checking is address added in addressbook or not"""
helper_addressbook.insert(label='test1', address=self.addr) helper_addressbook.insert(label='test1', address=self.addr)
queryreturn = sqlQuery('''select count(*) from addressbook where address=?''', self.addr) queryreturn = sqlQuery(
'select count(*) from addressbook where address=?', self.addr)
self.assertEqual(queryreturn[0][0], 1) self.assertEqual(queryreturn[0][0], 1)
self.delete_address_from_addressbook(self.addr) self.delete_address_from_addressbook(self.addr)
@ -387,8 +390,10 @@ class TestCore(unittest.TestCase):
"""Testing same case sensitive address store in addressbook""" """Testing same case sensitive address store in addressbook"""
address1 = 'BM-2cVWtdUzPwF7UNGDrZftWuHWiJ6xxBpiSP' address1 = 'BM-2cVWtdUzPwF7UNGDrZftWuHWiJ6xxBpiSP'
address2 = 'BM-2CvwTDuZpWf7ungdRzFTwUhwIj6XXbPIsp' address2 = 'BM-2CvwTDuZpWf7ungdRzFTwUhwIj6XXbPIsp'
self.assertTrue(helper_addressbook.insert(label='test1', address=address1)) self.assertTrue(
self.assertTrue(helper_addressbook.insert(label='test2', address=address2)) helper_addressbook.insert(label='test1', address=address1))
self.assertTrue(
helper_addressbook.insert(label='test2', address=address2))
self.delete_address_from_addressbook(address1) self.delete_address_from_addressbook(address1)
self.delete_address_from_addressbook(address2) self.delete_address_from_addressbook(address2)