def test_index2address_baddata(self): with self.assertRaises(ValueError) as e: xl.utility_index2address(row='', col=1) self.assertEqual(e, 'Error - Incorrect row ('') entry. Row must either be a int or float') with self.assertRaises(ValueError) as e: xl.utility_index2address(1, '') self.assertEqual(e, 'Error - Incorrect col ('') entry. Col must either be a int or float') with self.assertRaises(ValueError) as e: xl.utility_index2address(0, 0) self.assertEqual(e, 'Error - Row (0) and Col (0) entry cannot be less than 1')
def test_index2address_baddata(self): with self.assertRaises(UserWarning) as e: xl.utility_index2address(row='', col=1) self.assertEqual( 'pylightxl - Incorrect row (' ') entry. Row must either be a int or float', e) with self.assertRaises(UserWarning) as e: xl.utility_index2address(1, '') self.assertEqual( 'pylightxl - Incorrect col (' ') entry. Col must either be a int or float', e) with self.assertRaises(UserWarning) as e: xl.utility_index2address(0, 0) self.assertEqual( 'pylightxl - Row (0) and Col (0) entry cannot be less than 1', e)
def test_index2address(self): self.assertEqual(xl.utility_index2address(1, 1), 'A1') self.assertEqual(xl.utility_index2address(1000, 1), 'A1000') self.assertEqual(xl.utility_index2address(1048576, 1), 'A1048576') self.assertEqual(xl.utility_index2address(1, 26), 'Z1') self.assertEqual(xl.utility_index2address(1, 27), 'AA1') self.assertEqual(xl.utility_index2address(1, 53), 'BA1') self.assertEqual(xl.utility_index2address(1, 667), 'YQ1') self.assertEqual(xl.utility_index2address(1, 703), 'AAA1') self.assertEqual(xl.utility_index2address(1, 728), 'AAZ1') self.assertEqual(xl.utility_index2address(1, 11496), 'PZD1') self.assertEqual(xl.utility_index2address(1, 11685), 'QGK1') self.assertEqual(xl.utility_index2address(1, 16384), 'XFD1') self.assertEqual(xl.utility_index2address(1048576, 16384), 'XFD1048576')
def test_index2address(self): self.assertEqual('A1', xl.utility_index2address(1, 1)) self.assertEqual('A1000', xl.utility_index2address(1000, 1)) self.assertEqual('A1048576', xl.utility_index2address(1048576, 1)) self.assertEqual('Z1', xl.utility_index2address(1, 26)) self.assertEqual('AA1', xl.utility_index2address(1, 27)) self.assertEqual('BA1', xl.utility_index2address(1, 53)) self.assertEqual('YQ1', xl.utility_index2address(1, 667)) self.assertEqual('AAA1', xl.utility_index2address(1, 703)) self.assertEqual('AAZ1', xl.utility_index2address(1, 728)) self.assertEqual('PZD1', xl.utility_index2address(1, 11496)) self.assertEqual('QGK1', xl.utility_index2address(1, 11685)) self.assertEqual('XFD1', xl.utility_index2address(1, 16384)) self.assertEqual('XFD1048576', xl.utility_index2address(1048576, 16384))