コード例 #1
0
 def test_wrong_pk(self):
     val = '[pk, name: "not allowed"]'
     with self.assertRaises(ParseSyntaxException):
         index_settings.parseString(val, parseAll=True)
     val2 = '[note: "pk not allowed", pk]'
     with self.assertRaises(ParseSyntaxException):
         index_settings.parseString(val2, parseAll=True)
コード例 #2
0
 def test_all(self):
     val = '[type: hash, name: "index name", note: "index note", unique]'
     res = index_settings.parseString(val, parseAll=True)
     self.assertEqual(res[0]['type_'], 'hash')
     self.assertEqual(res[0]['name'], 'index name')
     self.assertEqual(res[0]['note'].text, 'index note')
     self.assertTrue(res[0]['unique'])
コード例 #3
0
 def test_name_type_multiline(self):
     val = '[\nname: "index name"\n,\ntype:\nbtree\n]'
     res = index_settings.parseString(val, parseAll=True)
     self.assertEqual(res[0]['type_'], 'btree')
     self.assertEqual(res[0]['name'], 'index name')
コード例 #4
0
 def test_pk(self):
     val = '[\npk\n]'
     res = index_settings.parseString(val, parseAll=True)
     self.assertTrue(res[0]['pk'])
コード例 #5
0
 def test_unique(self):
     val = '[unique]'
     res = index_settings.parseString(val, parseAll=True)
     self.assertTrue(res[0]['unique'])