Exemplo n.º 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)
Exemplo n.º 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'])
Exemplo n.º 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')
Exemplo n.º 4
0
 def test_pk(self):
     val = '[\npk\n]'
     res = index_settings.parseString(val, parseAll=True)
     self.assertTrue(res[0]['pk'])
Exemplo n.º 5
0
 def test_unique(self):
     val = '[unique]'
     res = index_settings.parseString(val, parseAll=True)
     self.assertTrue(res[0]['unique'])