Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_table_extend(self):
c = table.Column(0, u'test', [u'test', u'column', u''])
c2 = table.Column(0, u'test', [u'test', u'column', u''])
c3 = table.Column(0, u'test', [u'test', u'column', u''])
t = table.Table([c])
t.extend([c2, c3])
self.assertEqual(len(t), 3)
self.assertEqual(t[0], c)
self.assertEqual(t[1], c2)
self.assertEqual(t[2], c3)
self.assertEqual(t[0].order, 0)
self.assertEqual(t[1].order, 1)
self.assertEqual(t[2].order, 2)
def test_table_row(self):
c = table.Column(0, u'test', [u'test', u'column', u''])
c2 = table.Column(0, u'test', [u'test', u'column', u''])
c3 = table.Column(0, u'test', [u'test', u'column', u''])
t = table.Table([c, c2, c3])
self.assertEqual(t.row(1), [u'column', u'column', u'column'])
def test_from_csv_no_inference(self):
with open('examples/testfixed_converted.csv', 'r') as f:
t = table.Table.from_csv(f, infer_types=False)
self.assertEqual(type(t), table.Table)
self.assertEqual(type(t[0]), table.Column)
self.assertEqual(len(t), 8)
self.assertEqual(t[2][0], '40')
self.assertEqual(type(t[2][0]), six.text_type)
self.assertEqual(t[3][0], 'True')
self.assertEqual(type(t[3][0]), six.text_type)
def test_table_uneven_columns(self):
c = table.Column(0, u'test', [u'test', u'column', u''])
c_short = table.Column(0, u'test', [u'test'])
c_long = table.Column(0, u'test', [u'', u'', u'', u'way out here'])
t = table.Table([c, c_short, c_long])
self.assertEqual(t.row(0), [u'test', u'test', None])
self.assertEqual(t.row(1), [u'column', None, None])
self.assertEqual(t.row(2), [None, None, None])
self.assertEqual(t.row(3), [None, None, u'way out here'])