-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_column.py
More file actions
25 lines (19 loc) · 866 Bytes
/
test_column.py
File metadata and controls
25 lines (19 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# This file is part of python-sql. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import unittest
from sql import AliasManager, Column, Table
class TestColumn(unittest.TestCase):
def test_column(self):
column = Column(Table('t'), 'c')
self.assertEqual(str(column), '"c"')
self.assertEqual(column.name, 'c')
self.assertEqual(column.column_name, '"c"')
with AliasManager():
self.assertEqual(str(column), '"a"."c"')
def test_quote_in_column(self):
column = Column(Table('t'), 'b "c"')
self.assertEqual(str(column), '"b ""c"""')
self.assertEqual(column.name, 'b "c"')
self.assertEqual(column.column_name, '"b ""c"""')
with AliasManager():
self.assertEqual(str(column), '"a"."b ""c"""')