How to use pylightxl - 10 common examples

To help you get started, we’ve selected a few pylightxl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PydPiper / pylightxl / test / test_readxl.py View on Github external
def test_db_init(self):
        # locally defined to return an empty ws
        db = Database()
        self.assertEqual(db._ws, {})
github PydPiper / pylightxl / test / test_readxl.py View on Github external
self.assertEqual(DB.ws('merged_cells').index(4, 3), 43)
        self.assertEqual(DB.ws('merged_cells').index(5, 2), 52)
        self.assertEqual(DB.ws('merged_cells').index(6, 1), 61)
        self.assertEqual(DB.ws('merged_cells').index(7, 2), 72)
        self.assertEqual(DB.ws('merged_cells').index(7, 3), 73)
        self.assertEqual(DB.ws('merged_cells').index(8, 3), 83)
        self.assertEqual(DB.ws('merged_cells').index(9, 1), 91)
        self.assertEqual(DB.ws('merged_cells').index(9, 3), 93)
        self.assertEqual(DB.ws('merged_cells').index(10, 3), 103)

    def test_ws_length(self):
        self.assertEqual(DB.ws('length').size, [1048576, 16384])


class test_Database(TestCase):
    db = Database()

    def test_db_badsheet(self):
        db = Database()
        with self.assertRaises(ValueError) as e:
            db.ws('not a sheet')
            self.assertEqual(e, 'Error - Sheetname (not a sheet) is not in the database')

    def test_db_init(self):
        # locally defined to return an empty ws
        db = Database()
        self.assertEqual(db._ws, {})

    def test_db_repr(self):
        self.assertEqual(str(self.db), 'pylightxl.Database')

    def test_db_ws_names(self):
github PydPiper / pylightxl / test / test_readxl.py View on Github external
def test_ws_init(self):
        ws = Worksheet(data={})
        self.assertEqual(ws._data, {})
        self.assertEqual(ws.maxrow, 0)
        self.assertEqual(ws.maxcol, 0)
github PydPiper / pylightxl / test / test_readxl.py View on Github external
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')
github PydPiper / pylightxl / test / test_readxl.py View on Github external
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')
github PydPiper / pylightxl / test / test_readxl.py View on Github external
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')
github PydPiper / pylightxl / test / test_readxl.py View on Github external
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')
github PydPiper / pylightxl / test / test_readxl.py View on Github external
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')
github PydPiper / pylightxl / test / test_readxl.py View on Github external
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')
github PydPiper / pylightxl / test / test_readxl.py View on Github external
def test_address2index(self):
        self.assertEqual(address2index('A1'), [1, 1])
        self.assertEqual(address2index('A1000'), [1000, 1])
        self.assertEqual(address2index('A1048576'), [1048576, 1])

        self.assertEqual(address2index('Z1'), [1, 26])
        self.assertEqual(address2index('AA1'), [1, 27])
        self.assertEqual(address2index('BA1'), [1, 53])
        self.assertEqual(address2index('YQ1'), [1, 667])
        self.assertEqual(address2index('AAA1'), [1, 703])
        self.assertEqual(address2index('PZD1'), [1, 11496])
        self.assertEqual(address2index('QGK1'), [1, 11685])
        self.assertEqual(address2index('XFD1'), [1, 16384])

        self.assertEqual(address2index('XFD1048576'), [1048576, 16384])