9
9
10
10
11
11
class TestDataObjects (base .PyMySQLReplicationTestCase ):
12
- def test_column (self ):
12
+ def test_column_is_primary (self ):
13
13
col = Column (1 ,
14
14
{"COLUMN_NAME" : "test" ,
15
15
"COLLATION_NAME" : "utf8_general_ci" ,
16
16
"CHARACTER_SET_NAME" : "UTF8" ,
17
17
"COLUMN_COMMENT" : "" ,
18
- "COLUMN_TYPE" : "tinyint(2)" },
18
+ "COLUMN_TYPE" : "tinyint(2)" ,
19
+ "COLUMN_KEY" : "PRI" },
20
+ None )
21
+ self .assertEqual (True , col .is_primary )
22
+
23
+ def test_column_not_primary (self ):
24
+ col = Column (1 ,
25
+ {"COLUMN_NAME" : "test" ,
26
+ "COLLATION_NAME" : "utf8_general_ci" ,
27
+ "CHARACTER_SET_NAME" : "UTF8" ,
28
+ "COLUMN_COMMENT" : "" ,
29
+ "COLUMN_TYPE" : "tinyint(2)" ,
30
+ "COLUMN_KEY" : "" },
31
+ None )
32
+ self .assertEqual (False , col .is_primary )
33
+
34
+ def test_column_serializable (self ):
35
+ col = Column (1 ,
36
+ {"COLUMN_NAME" : "test" ,
37
+ "COLLATION_NAME" : "utf8_general_ci" ,
38
+ "CHARACTER_SET_NAME" : "UTF8" ,
39
+ "COLUMN_COMMENT" : "" ,
40
+ "COLUMN_TYPE" : "tinyint(2)" ,
41
+ "COLUMN_KEY" : "PRI" },
19
42
None )
20
43
21
44
serialized = col .serializable_data ()
@@ -26,6 +49,7 @@ def test_column(self):
26
49
self .assertIn ("comment" , serialized )
27
50
self .assertIn ("unsigned" , serialized )
28
51
self .assertIn ("type_is_bool" , serialized )
52
+ self .assertIn ("is_primary" , serialized )
29
53
30
54
self .assertEqual (col , Column (** serialized ))
31
55
0 commit comments