~openerp-dev/openobject-server/trunk-gunicorn-signaling-vmt

« back to all changes in this revision

Viewing changes to openerp/tests/test_expression.py

  • Committer: Vo Minh Thu
  • Date: 2012-03-07 11:10:30 UTC
  • mfrom: (4001.1.83 server)
  • Revision ID: vmt@openerp.com-20120307111030-8hzhzm0zoo34nuj7
[MERGE] merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import unittest2
 
2
 
 
3
import openerp
 
4
 
 
5
class test_domain_normalization(unittest2.TestCase):
 
6
    def test_normalize_domain(self):
 
7
        expression = openerp.osv.expression
 
8
        norm_domain = domain = ['&',(1,'=',1),('a','=','b')]
 
9
        assert norm_domain == expression.normalize(domain), "Normalized domains should be left untouched"
 
10
        domain = [('x','in',['y','z']),('a.v','=','e'),'|','|',('a','=','b'),'!',('c','>','d'),('e','!=','f'),('g','=','h')]
 
11
        norm_domain = ['&','&','&'] + domain
 
12
        assert norm_domain == expression.normalize(domain), "Non-normalized domains should be properly normalized"