def test_dictify(self): ans = Table._dictify(['col1', 'col2', 'col3'], ['val1', 'val2', 'val3']) self.assertDictEqual(ans, { 'col2': 'val2', 'col3': 'val3', 'col1': 'val1' })
def test_join_batch_rows(self): ans = Table._join_batch_rows([('this', 'that'), ('something', "something's else")]) self.assertEqual( ans, "('this', 'that'), ('something', 'something''s else')")
def test_random_string(self): ans = Table._random_string(5) self.assertEqual(len(ans), 5)
def test_equals(self): ans = Table._equals(['this', 'something'], 'new_table', ['that', 'something_else']) self.assertEqual( ans, 'this=new_table.that, something=new_table.something_else')
def test_qualify(self): ans = Table._qualify('mytable', ['col1', 'col2', 'col3']) self.assertEqual(ans, 'mytable.col1, mytable.col2, mytable.col3')
def test_join_conditionals(self): ans = Table._join_equality({'this': 'that', 'something': 3}) self.assertEqual(ans, "this='that', something=3") with self.assertRaises(TypeError): Table._join_equality({'this': ("won't", 'work')})
def test_join_values(self): ans = Table._join_values(['this', 1, 7.0, 'that']) self.assertEqual(ans, "'this', 1, 7.0, 'that'") with self.assertRaises(TypeError): Table._join_values([('this', "won't"), 'work'])
def test_join_cols(self): ans = Table._join_cols(['this', 'that', 'something']) self.assertEqual(ans, 'this, that, something')