Added a test which demonstrates the wrong precedence of 'or' and 'and' operators

Test is skipped for now, until there is a solution to fix the precedence
This commit is contained in:
Alexander Tivelkov
2014-08-27 16:19:28 +04:00
parent 65d1c9b2d2
commit 43694ad94c

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2014 Mirantis, Inc.
# Copyright (c) 2014 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@@ -44,6 +44,12 @@ class TestBooleans(YaqlTest):
self.assertEval(True, 'true and not false')
self.assertEval(True, 'not true or not false')
@unittest.skip(
"Custom precedence for 'or' and 'and' operators is not defined")
def test_incorrect_boolean_precedence(self):
self.assertEval(True, "false or true or (true and false)") # works
self.assertEval(True, "false or true or true and false") # breaks
def test_boolean_conversion(self):
self.assertNotEquals(types.BooleanType, type(self.eval('abcd')))
self.assertEquals(types.BooleanType, type(self.eval('bool(abcd)')))