def test_index2address_baddata(self): with self.assertRaises(ValueError) as e: 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: index2address(1, '') self.assertEqual(e, 'Error - Incorrect col ('') entry. Col must either be a int or float') with self.assertRaises(ValueError) as e: index2address(0, 0) self.assertEqual(e, 'Error - Row (0) and Col (0) entry cannot be less than 1')
def test_index2address(self): self.assertEqual(index2address(1, 1), 'A1') self.assertEqual(index2address(1000, 1), 'A1000') self.assertEqual(index2address(1048576, 1), 'A1048576') self.assertEqual(index2address(1, 26), 'Z1') self.assertEqual(index2address(1, 27), 'AA1') self.assertEqual(index2address(1, 53), 'BA1') self.assertEqual(index2address(1, 667), 'YQ1') self.assertEqual(index2address(1, 703), 'AAA1') self.assertEqual(index2address(1, 11496), 'PZD1') self.assertEqual(index2address(1, 11685), 'QGK1') self.assertEqual(index2address(1, 16384), 'XFD1') self.assertEqual(index2address(1048576, 16384), 'XFD1048576')