[PATCH 1 of 4 yams] [tests, flake8] autopep8 on tests

Simon Chabot simon.chabot at logilab.fr
Fri Jan 17 18:32:19 CET 2020


# HG changeset patch
# User Simon Chabot <simon.chabot at logilab.fr>
# Date 1579279897 -3600
#      Fri Jan 17 17:51:37 2020 +0100
# Node ID c60dbc99fb4b879816587cf3ab29b6778384ae8d
# Parent  ad6b583452e3cfc0f5a0fa1a22cbff0f05733a5c
# Available At https://hg.logilab.org/review/yams
#              hg pull https://hg.logilab.org/review/yams -r c60dbc99fb4b
[tests, flake8] autopep8 on tests

diff --git a/test/data/dbmodel/__init__.py b/test/data/dbmodel/__init__.py
--- a/test/data/dbmodel/__init__.py
+++ b/test/data/dbmodel/__init__.py
@@ -16,4 +16,3 @@
 # You should have received a copy of the GNU Lesser General Public License along
 # with yams. If not, see <http://www.gnu.org/licenses/>.
 """db model"""
-
diff --git a/test/data/dbmodel/blog.py b/test/data/dbmodel/blog.py
--- a/test/data/dbmodel/blog.py
+++ b/test/data/dbmodel/blog.py
@@ -17,6 +17,7 @@
 # with yams. If not, see <http://www.gnu.org/licenses/>.
 from google.appengine.ext import db
 
+
 class Article(db.Model):
     content = db.TextProperty()
     synopsis = db.StringProperty(default='hello')
diff --git a/test/data/schema/Company.py b/test/data/schema/Company.py
--- a/test/data/schema/Company.py
+++ b/test/data/schema/Company.py
@@ -17,7 +17,7 @@
 # with yams. If not, see <http://www.gnu.org/licenses/>.
 
 from yams.buildobjs import EntityType, RelationType, RelationDefinition, \
-     SubjectRelation, String
+    SubjectRelation, String
 
 
 _ = str
@@ -26,31 +26,36 @@ from yams.buildobjs import EntityType, R
 class Company(EntityType):
     name = String()
 
+
 class Subcompany(Company):
     __specializes_schema__ = True
     subcompany_of = SubjectRelation('Company')
 
+
 class Division(Company):
     __specializes_schema__ = True
     division_of = SubjectRelation('Company')
 
+
 class Subdivision(Division):
     __specializes_schema__ = True
     subdivision_of = SubjectRelation('Company')
 
+
 class Employee(EntityType):
     works_for = SubjectRelation('Company')
 
+
 class require_permission(RelationType):
     """link a permission to the entity. This permission should be used in the
     security definition of the entity's type to be useful.
     """
     fulltext_container = 'subject'
     __permissions__ = {
-        'read':   ('managers', 'users', 'guests'),
-        'add':    ('managers',),
+        'read': ('managers', 'users', 'guests'),
+        'add': ('managers',),
         'delete': ('managers',),
-        }
+    }
 
 
 class missing_require_permission(RelationDefinition):
@@ -58,15 +63,16 @@ class missing_require_permission(Relatio
     subject = 'Company'
     object = 'EPermission'
 
+
 class EPermission(EntityType):
     """entity type that may be used to construct some advanced security configuration
     """
     __permissions__ = {
-        'read':   ('managers', 'users', 'guests',),
-        'add':    ('managers',),
+        'read': ('managers', 'users', 'guests',),
+        'add': ('managers',),
         'delete': ('managers',),
         'update': ('managers', 'owners',),
-        }
+    }
     name = String(required=True, indexed=True, internationalizable=True,
                   fulltextindexed=True, maxsize=100,
                   description=_('name or identifier of the permission'))
diff --git a/test/data/schema/Dates.py b/test/data/schema/Dates.py
--- a/test/data/schema/Dates.py
+++ b/test/data/schema/Dates.py
@@ -18,11 +18,11 @@
 from datetime import time, date
 from yams.buildobjs import EntityType, Datetime, Date, Time
 
+
 class Datetest(EntityType):
     dt1 = Datetime(default=u'now')
     dt2 = Datetime(default=u'today')
-    d1  = Date(default=u'today')
-    d2  = Date(default=date(2007, 12, 11))
-    t1  = Time(default=time(8, 40))
-    t2  = Time(default=time(9, 45))
-
+    d1 = Date(default=u'today')
+    d2 = Date(default=date(2007, 12, 11))
+    t1 = Time(default=time(8, 40))
+    t2 = Time(default=time(9, 45))
diff --git a/test/data/schema/State.py b/test/data/schema/State.py
--- a/test/data/schema/State.py
+++ b/test/data/schema/State.py
@@ -16,21 +16,22 @@
 # You should have received a copy of the GNU Lesser General Public License along
 # with yams. If not, see <http://www.gnu.org/licenses/>.
 from yams.buildobjs import (EntityType, RelationType, RelationDefinition,
-                            SubjectRelation, Int, String,  Boolean)
+                            SubjectRelation, Int, String, Boolean)
 from yams.constraints import SizeConstraint, UniqueConstraint
 
 from data.schema import RESTRICTED_RTYPE_PERMS
 
+
 class State(EntityType):
     """used to associate simple states to an entity
     type and/or to define workflows
     """
     __permissions__ = {
-        'read':   ('managers', 'users', 'guests',),
-        'add':    ('managers', 'users',),
+        'read': ('managers', 'users', 'guests',),
+        'add': ('managers', 'users',),
         'delete': ('managers', 'owners',),
         'update': ('managers', 'owners',),
-        }
+    }
 
     # attributes
     eid = Int(required=True, uid=True)
@@ -47,33 +48,36 @@ class state_of(RelationType):
     """link a state to one or more entity type"""
     __permissions__ = RESTRICTED_RTYPE_PERMS
 
+
 class next_state(RelationType):
     """define a workflow by associating a state to possible following states
     """
     __permissions__ = RESTRICTED_RTYPE_PERMS
 
+
 class initial_state(RelationType):
     """indicate which state should be used by default when an entity using states
     is created
     """
     __permissions__ = {
-        'read':   ('managers', 'users', 'guests',),
-        'add':    ('managers', 'users',),
+        'read': ('managers', 'users', 'guests',),
+        'add': ('managers', 'users',),
         'delete': ('managers', 'users',),
-        }
+    }
     subject = 'Eetype'
     object = 'State'
     cardinality = '?*'
     inlined = True
 
+
 class Eetype(EntityType):
     """define an entity type, used to build the application schema"""
     __permissions__ = {
-        'read':   ('managers', 'users', 'guests',),
-        'add':    ('managers',),
+        'read': ('managers', 'users', 'guests',),
+        'add': ('managers',),
         'delete': ('managers',),
         'update': ('managers', 'owners',),
-        }
+    }
     name = String(required=True, indexed=True, internationalizable=True,
                   constraints=[UniqueConstraint(), SizeConstraint(64)])
     description = String(fulltextindexed=True)
diff --git a/test/data/schema/__init__.py b/test/data/schema/__init__.py
--- a/test/data/schema/__init__.py
+++ b/test/data/schema/__init__.py
@@ -17,7 +17,7 @@
 # with yams. If not, see <http://www.gnu.org/licenses/>.
 """test schema"""
 RESTRICTED_RTYPE_PERMS = {
-    'read':   ('managers', 'users', 'guests',),
-    'add':    ('managers',),
+    'read': ('managers', 'users', 'guests',),
+    'add': ('managers',),
     'delete': ('managers',),
-    }
+}
diff --git a/test/data/schema/schema.py b/test/data/schema/schema.py
--- a/test/data/schema/schema.py
+++ b/test/data/schema/schema.py
@@ -18,6 +18,7 @@
 from yams.buildobjs import (EntityType, RelationDefinition, RelationType,
                             SubjectRelation, String, Int, Float, Date, Boolean)
 
+
 class Affaire(EntityType):
     sujet = String(maxsize=128)
     ref = String(maxsize=12)
@@ -27,6 +28,7 @@ class Affaire(EntityType):
     sym_rel = SubjectRelation('Person', symmetric=True)
     inline_rel = SubjectRelation('Person', inlined=True, cardinality='?*')
 
+
 class subj_wildcard(RelationDefinition):
     subject = '*'
     object = 'Affaire'
@@ -34,20 +36,20 @@ class subj_wildcard(RelationDefinition):
 
 class Person(EntityType):
     __unique_together__ = [('nom', 'prenom')]
-    nom    = String(maxsize=64, fulltextindexed=True, required=True)
+    nom = String(maxsize=64, fulltextindexed=True, required=True)
     prenom = String(maxsize=64, fulltextindexed=True)
-    sexe   = String(maxsize=1, default='M')
-    promo  = String(vocabulary=('bon','pasbon'))
-    titre  = String(maxsize=128, fulltextindexed=True)
-    adel   = String(maxsize=128)
-    ass    = String(maxsize=128)
-    web    = String(maxsize=128)
-    tel    = Int(__permissions__={'read': (),
-                                  'add': ('managers',),
-                                  'update': ('managers',)})
-    fax    = Int()
+    sexe = String(maxsize=1, default='M')
+    promo = String(vocabulary=('bon', 'pasbon'))
+    titre = String(maxsize=128, fulltextindexed=True)
+    adel = String(maxsize=128)
+    ass = String(maxsize=128)
+    web = String(maxsize=128)
+    tel = Int(__permissions__={'read': (),
+                               'add': ('managers',),
+                               'update': ('managers',)})
+    fax = Int()
     datenaiss = Date()
-    test   = Boolean()
+    test = Boolean()
     salary = Float()
     travaille = SubjectRelation('Societe',
                                 __permissions__={'read': (),
@@ -57,19 +59,21 @@ class Person(EntityType):
 
     evaluee = SubjectRelation('Note')
 
+
 class Salaried(Person):
     __specializes_schema__ = True
 
+
 class Societe(EntityType):
-    nom  = String(maxsize=64, fulltextindexed=True)
+    nom = String(maxsize=64, fulltextindexed=True)
     web = String(maxsize=128)
-    tel  = Int()
-    fax  = Int()
+    tel = Int()
+    fax = Int()
     rncs = String(maxsize=32)
-    ad1  = String(maxsize=128)
-    ad2  = String(maxsize=128)
-    ad3  = String(maxsize=128)
-    cp   = String(maxsize=12)
+    ad1 = String(maxsize=128)
+    ad2 = String(maxsize=128)
+    ad3 = String(maxsize=128)
+    cp = String(maxsize=12)
     ville = String(maxsize=32)
 
     evaluee = SubjectRelation('Note')
@@ -99,7 +103,8 @@ class evaluee(RelationType):
         'read': ('managers',),
         'add': ('managers',),
         'delete': ('managers',),
-        }
+    }
+
 
 class concerne(RelationDefinition):
     subject = 'Person'
@@ -108,5 +113,4 @@ class concerne(RelationDefinition):
         'read': ('managers',),
         'add': ('managers',),
         'delete': ('managers',),
-        }
-
+    }
diff --git a/test/data/schema_post_build_callback.py b/test/data/schema_post_build_callback.py
--- a/test/data/schema_post_build_callback.py
+++ b/test/data/schema_post_build_callback.py
@@ -17,5 +17,6 @@
 # with yams. If not, see <http://www.gnu.org/licenses/>.
 from yams.buildobjs import EntityType
 
+
 def post_build_callback(schema):
     schema.add_entity_type(EntityType(name='Toto'))
diff --git a/test/data2/schema.py b/test/data2/schema.py
--- a/test/data2/schema.py
+++ b/test/data2/schema.py
@@ -24,7 +24,9 @@ Affaire.__permissions__ = {'read': (),
                            'update': (),
                            'delete': ()}
 
+
 class MyNote(Note):
     text = String()
 
+
 assert 'Note' in context.defined
diff --git a/test/unittest_constraints.py b/test/unittest_constraints.py
--- a/test/unittest_constraints.py
+++ b/test/unittest_constraints.py
@@ -87,7 +87,9 @@ class ConstraintTC(unittest.TestCase):
 
     def test_interval_attribute_error(self):
         cstr = IntervalBoundConstraint(minvalue=Attribute('hip'), maxvalue=Attribute('hop'))
-        class entity: hip, hop = 34, 42
+
+        class entity:
+            hip, hop = 34, 42
         self.assertEqual(cstr.failed_message('key', 20, entity),
                          (u'value %(KEY-value)s must be >= %(KEY-boundary)s',
                           {'key-boundary': 'hip', 'key-value': 20}))
@@ -110,14 +112,14 @@ class ConstraintTC(unittest.TestCase):
         cstr2 = IntervalBoundConstraint.deserialize(cstr.serialize())
         self.assertEqual(cstr2.minvalue.offset, None)
         self.assertEqual(cstr2.maxvalue.attr, 'hop')
-        self.assertTrue(cstr2.check(mock_object(hop=datetime.now()+timedelta(hours=1)),
+        self.assertTrue(cstr2.check(mock_object(hop=datetime.now() + timedelta(hours=1)),
                                     'hip', datetime.now() + timedelta(seconds=2)))
         # fail, value < minvalue
-        self.assertFalse(cstr2.check(mock_object(hop=datetime.now()+timedelta(hours=1)),
-                                'hip', datetime.now() - timedelta(hours=2)))
+        self.assertFalse(cstr2.check(mock_object(hop=datetime.now() + timedelta(hours=1)),
+                                     'hip', datetime.now() - timedelta(hours=2)))
         # fail, value > maxvalue
-        self.assertFalse(cstr2.check(mock_object(hop=datetime.now()+timedelta(hours=1)),
-                                'hip', datetime.now() + timedelta(hours=2)))
+        self.assertFalse(cstr2.check(mock_object(hop=datetime.now() + timedelta(hours=1)),
+                                     'hip', datetime.now() + timedelta(hours=2)))
 
     def test_interval_with_date(self):
         cstr = IntervalBoundConstraint(TODAY(timedelta(1)),
@@ -180,7 +182,8 @@ class ConstraintTC(unittest.TestCase):
                  SizeConstraint(min=0, max=42, msg='constraint failed, you monkey!'),
                  RegexpConstraint('babar', 0, msg='constraint failed, you monkey!'),
                  BoundaryConstraint('>', 1, msg='constraint failed, you monkey!'),
-                 IntervalBoundConstraint(minvalue=0, maxvalue=42, msg='constraint failed, you monkey!'),
+                 IntervalBoundConstraint(minvalue=0, maxvalue=42,
+                                         msg='constraint failed, you monkey!'),
                  StaticVocabularyConstraint((1, 2, 3), msg='constraint failed, you monkey!'),
                  FormatConstraint(msg='constraint failed, you monkey!')]
         for cstr in cstrs:
@@ -192,5 +195,6 @@ class ConstraintTC(unittest.TestCase):
                 self.assertEqual(cstr.failed_message('key', 'value', object()),
                                  ('constraint failed, you monkey!', {}))
 
+
 if __name__ == '__main__':
     unittest.main()
diff --git a/test/unittest_diff.py b/test/unittest_diff.py
--- a/test/unittest_diff.py
+++ b/test/unittest_diff.py
@@ -62,7 +62,7 @@ def create_schema_1():
         nom = String()
         associate_affaire = SubjectRelation('Affaire')
     return build_schema_from_namespace([('PersonBase', PersonBase),
-                                        ('Affaire',    Affaire),
+                                        ('Affaire', Affaire),
                                         ('PersonAttrMod', PersonAttrMod)])
 
 
@@ -73,7 +73,7 @@ def create_schema_2():
         associate_affaire = SubjectRelation('Affaire', cardinality='**')
         associate_person = SubjectRelation('PersonBase')
     return build_schema_from_namespace([('PersonBase', PersonBase),
-                                        ('Affaire',    Affaire)])
+                                        ('Affaire', Affaire)])
 
 
 class PropertiesFromTC(TestCase):
@@ -154,7 +154,7 @@ class PropertiesFromTC(TestCase):
             'add': ('managers', 'users'),
             'update': ('owners', 'managers'),
             'read': ('users', 'managers', 'guests'),
-            },
+        },
         }
         rdef = self.build_rdef(props_ref)
         self.assertEqual({'__permissions__': self.expected_default_attr_perms,
diff --git a/test/unittest_reader.py b/test/unittest_reader.py
--- a/test/unittest_reader.py
+++ b/test/unittest_reader.py
@@ -46,7 +46,7 @@ class SchemaLoaderTC(TestCase):
         files = [osp.basename(f) for f in SchemaLoader().get_schema_files(self.datadir)]
         self.assertEqual(files[0], '__init__.py')
         self.assertEqual(sorted(files),
-                          ['Company.py', 'Dates.py', 'State.py', '__init__.py', 'schema.py'])
+                         ['Company.py', 'Dates.py', 'State.py', '__init__.py', 'schema.py'])
 
     # test load_schema read entity and relation types #######################
 
@@ -54,55 +54,56 @@ class SchemaLoaderTC(TestCase):
         self.assertIsInstance(self.schema, Schema)
         self.assertEqual(self.schema.name, 'NoName')
         self.assertListEqual(sorted(self.schema.entities()),
-                              ['Affaire', 'BigInt', 'Boolean', 'Bytes', 'Company',
-                               'Date', 'Datetest', 'Datetime', 'Decimal',
-                               'Division', 'EPermission', 'Eetype',  'Employee', 'Float', 'Int', 'Interval',
-                               'Note', 'Password', 'Person', 'Salaried', 'Societe', 'State', 'String',
-                               'Subcompany', 'Subdivision', 'TZDatetime', 'TZTime', 'Time', 'pkginfo'])
+                             ['Affaire', 'BigInt', 'Boolean', 'Bytes', 'Company',
+                              'Date', 'Datetest', 'Datetime', 'Decimal',
+                              'Division', 'EPermission', 'Eetype', 'Employee', 'Float', 'Int', 'Interval',
+                              'Note', 'Password', 'Person', 'Salaried', 'Societe', 'State', 'String',
+                              'Subcompany', 'Subdivision', 'TZDatetime', 'TZTime', 'Time', 'pkginfo'])
         self.assertListEqual(sorted(self.schema.relations()),
-                              ['ad1', 'ad2', 'ad3', 'adel', 'ass', 'author', 'author_email',
-                               'concerne', 'copyright', 'cp',
-                               'd1', 'd2', 'date', 'datenaiss', 'debian_handler', 'description', 'division_of', 'dt1', 'dt2',
-                               'eid', 'evaluee', 'fax', 'final',
-                               'initial_state', 'inline_rel',
-                               'license', 'long_desc',
-                               'mailinglist', 'meta', 'modname',
-                               'name', 'next_state', 'nom', 'obj_wildcard',
-                               'para', 'prenom', 'promo',
-                               'ref', 'require_permission', 'rncs',
-                               'salary', 'sexe', 'short_desc', 'state_of', 'subcompany_of',
-                               'subdivision_of', 'subj_wildcard', 'sujet', 'sym_rel',
-                               't1', 't2', 'tel', 'test', 'titre', 'travaille', 'type',
-                               'version',
-                               'ville', 'web', 'works_for'])
+                             ['ad1', 'ad2', 'ad3', 'adel', 'ass', 'author', 'author_email',
+                              'concerne', 'copyright', 'cp',
+                              'd1', 'd2', 'date', 'datenaiss', 'debian_handler', 'description', 'division_of', 'dt1', 'dt2',
+                              'eid', 'evaluee', 'fax', 'final',
+                              'initial_state', 'inline_rel',
+                              'license', 'long_desc',
+                              'mailinglist', 'meta', 'modname',
+                              'name', 'next_state', 'nom', 'obj_wildcard',
+                              'para', 'prenom', 'promo',
+                              'ref', 'require_permission', 'rncs',
+                              'salary', 'sexe', 'short_desc', 'state_of', 'subcompany_of',
+                              'subdivision_of', 'subj_wildcard', 'sujet', 'sym_rel',
+                              't1', 't2', 'tel', 'test', 'titre', 'travaille', 'type',
+                              'version',
+                              'ville', 'web', 'works_for'])
 
     def test_eschema(self):
         eschema = self.schema.eschema('Societe')
         self.assertEqual(eschema.description, '')
         self.assertEqual(eschema.final, False)
         self.assertListEqual(sorted(eschema.subject_relations()),
-                              ['ad1', 'ad2', 'ad3', 'cp', 'evaluee',
-                               'fax', 'nom', 'rncs', 'subj_wildcard', 'tel', 'ville',
-                               'web'])
+                             ['ad1', 'ad2', 'ad3', 'cp', 'evaluee',
+                              'fax', 'nom', 'rncs', 'subj_wildcard', 'tel', 'ville',
+                              'web'])
         self.assertListEqual(sorted(eschema.object_relations()),
-                          ['concerne', 'obj_wildcard', 'travaille'])
+                             ['concerne', 'obj_wildcard', 'travaille'])
 
         eschema = self.schema.eschema('Eetype')
-        self.assertEqual(eschema.description, 'define an entity type, used to build the application schema')
+        self.assertEqual(eschema.description,
+                         'define an entity type, used to build the application schema')
         self.assertEqual(eschema.final, False)
         self.assertListEqual(sorted(str(r) for r in eschema.subject_relations()),
-                              ['description', 'final', 'initial_state', 'meta',
-                               'name', 'subj_wildcard'])
+                             ['description', 'final', 'initial_state', 'meta',
+                              'name', 'subj_wildcard'])
         self.assertListEqual(sorted(str(r) for r in eschema.object_relations()),
-                              ['obj_wildcard', 'state_of'])
+                             ['obj_wildcard', 'state_of'])
 
         eschema = self.schema.eschema('Boolean')
         self.assertEqual(eschema.description, '')
         self.assertEqual(eschema.final, True)
         self.assertListEqual(sorted(eschema.subject_relations()),
-                              [])
+                             [])
         self.assertListEqual(sorted(eschema.object_relations()),
-                              ['final', 'meta', 'test'])
+                             ['final', 'meta', 'test'])
 
     # test base entity type's subject relation properties #####################
 
@@ -119,7 +120,8 @@ class SchemaLoaderTC(TestCase):
 
     def test_fulltextindexed(self):
         eschema = self.schema.eschema('Person')
-        self.assertRaises(AttributeError, getattr, eschema.rdef('tel'), 'fulltextindexed') # tel is an INT
+        self.assertRaises(AttributeError, getattr, eschema.rdef(
+            'tel'), 'fulltextindexed')  # tel is an INT
         self.assertTrue(eschema.rdef('nom').fulltextindexed)
         self.assertTrue(eschema.rdef('prenom').fulltextindexed)
         self.assertFalse(eschema.rdef('sexe').fulltextindexed)
@@ -127,7 +129,7 @@ class SchemaLoaderTC(TestCase):
         self.assertEqual(['nom', 'prenom', 'titre'], indexable)
         self.assertEqual(self.schema.rschema('works_for').fulltext_container, None)
         self.assertEqual(self.schema.rschema('require_permission').fulltext_container,
-                          'subject')
+                         'subject')
         eschema = self.schema.eschema('Company')
         indexable = sorted(eschema.indexable_attributes())
         self.assertEqual([], indexable)
@@ -182,7 +184,8 @@ class SchemaLoaderTC(TestCase):
 
         rschema = self.schema.rschema('initial_state')
         self.assertEqual(rschema.symmetric, False)
-        self.assertEqual(rschema.description, 'indicate which state should be used by default when an entity using states is created')
+        self.assertEqual(
+            rschema.description, 'indicate which state should be used by default when an entity using states is created')
         self.assertEqual(rschema.final, False)
         self.assertListEqual(sorted(rschema.subjects()), ['Eetype'])
         self.assertListEqual(sorted(rschema.objects()), ['State'])
@@ -191,7 +194,8 @@ class SchemaLoaderTC(TestCase):
         self.assertEqual(rschema.symmetric, False)
         self.assertEqual(rschema.description, '')
         self.assertEqual(rschema.final, True)
-        self.assertListEqual(sorted(rschema.subjects()), ['Company', 'Division', 'EPermission', 'Eetype', 'State', 'Subcompany', 'Subdivision'])
+        self.assertListEqual(sorted(rschema.subjects()), [
+                             'Company', 'Division', 'EPermission', 'Eetype', 'State', 'Subcompany', 'Subdivision'])
         self.assertListEqual(sorted(rschema.objects()), ['String'])
 
     def test_cardinality(self):
@@ -232,58 +236,57 @@ class SchemaLoaderTC(TestCase):
     def test_relation_permissions(self):
         rschema = self.schema.rschema('evaluee')
         self.assertEqual(rschema.rdef('Person', 'Note').permissions,
-                          {'read': ('managers',),
-                           'delete': ('managers',),
-                           'add': ('managers',)})
+                         {'read': ('managers',),
+                          'delete': ('managers',),
+                          'add': ('managers',)})
         self.assertEqual(rschema.rdef('Societe', 'Note').permissions,
-                          {'read': ('managers',),
-                           'delete': ('managers',),
-                           'add': ('managers',)})
+                         {'read': ('managers',),
+                          'delete': ('managers',),
+                          'add': ('managers',)})
         rschema = self.schema.rschema('concerne')
         self.assertEqual(rschema.rdef('Person', 'Affaire').permissions,
-                          {'read': ('managers',),
-                           'delete': ('managers',),
-                           'add': ('managers',)})
+                         {'read': ('managers',),
+                          'delete': ('managers',),
+                          'add': ('managers',)})
         self.assertEqual(rschema.rdef('Affaire', 'Societe').permissions,
-                          DEFAULT_RELPERMS)
+                         DEFAULT_RELPERMS)
         rschema = self.schema.rschema('travaille')
         self.assertEqual(rschema.rdef('Person', 'Societe').permissions,
-                          {'read': (), 'add': (), 'delete': ('managers',)})
+                         {'read': (), 'add': (), 'delete': ('managers',)})
 
     def test_attributes_permissions(self):
         rschema = self.schema.rschema('name')
         self.assertEqual(rschema.rdef('Company', 'String').permissions,
-                          DEFAULT_ATTRPERMS)
+                         DEFAULT_ATTRPERMS)
         rschema = self.schema.rschema('tel')
         self.assertEqual(rschema.rdef('Person', 'Int').permissions,
-                          {'read': (),
-                           'add': ('managers',),
-                           'update': ('managers',)})
-
+                         {'read': (),
+                          'add': ('managers',),
+                          'update': ('managers',)})
 
     def test_entity_permissions(self):
         eschema = self.schema.eschema('State')
         self.assertEqual(eschema.permissions,
-                          {'read':   ('managers', 'users', 'guests',),
-                           'add':    ('managers', 'users',),
-                           'delete': ('managers', 'owners',),
-                           'update': ('managers', 'owners',)})
+                         {'read': ('managers', 'users', 'guests',),
+                          'add': ('managers', 'users',),
+                          'delete': ('managers', 'owners',),
+                          'update': ('managers', 'owners',)})
 
         eschema = self.schema.eschema('Eetype')
         self.assertEqual(eschema.permissions,
-                          {'read':   ('managers', 'users', 'guests',),
-                           'add':    ('managers',),
-                           'delete': ('managers',),
-                           'update': ('managers', 'owners',)})
+                         {'read': ('managers', 'users', 'guests',),
+                          'add': ('managers',),
+                          'delete': ('managers',),
+                          'update': ('managers', 'owners',)})
 
         eschema = self.schema.eschema('Person')
         self.assertEqual(eschema.permissions,
-                          {'read':   ('managers', 'users', 'guests',),
-                           'add':    ('managers', 'users',),
-                           'delete': ('managers', 'owners',),
-                           'update': ('managers', 'owners',)})
+                         {'read': ('managers', 'users', 'guests',),
+                          'add': ('managers', 'users',),
+                          'delete': ('managers', 'owners',),
+                          'update': ('managers', 'owners',)})
 
-##     def test_nonregr_using_tuple_as_relation_target(self):
+# def test_nonregr_using_tuple_as_relation_target(self):
 ##         rschema = schema.rschema('see_also')
 ##         self.assertEqual(rschema.symmetric, False)
 ##         self.assertEqual(rschema.description, '')
@@ -308,9 +311,11 @@ class BasePerson(EntityType):
     firstname = String(vocabulary=('logilab', 'caesium'), maxsize=10)
     lastname = String(constraints=[StaticVocabularyConstraint(['logilab', 'caesium'])])
 
+
 class Person(BasePerson):
     email = String()
 
+
 class Employee(Person):
     company = String(vocabulary=('logilab', 'caesium'))
 
@@ -319,16 +324,17 @@ class Student(Person):
     __specializes_schema__ = True
     college = String()
 
+
 class X(Student):
     pass
 
+
 class Foo(EntityType):
     i = Int(required=True, metadata={'name': String()})
     f = Float()
     d = Datetime()
 
 
-
 class PySchemaTC(TestCase):
 
     def test_python_inheritance(self):
@@ -337,11 +343,13 @@ class PySchemaTC(TestCase):
         e = Employee()
         self.assertEqual([r.name for r in bp.__relations__], ['firstname', 'lastname'])
         self.assertEqual([r.name for r in p.__relations__], ['firstname', 'lastname', 'email'])
-        self.assertEqual([r.name for r in e.__relations__], ['firstname', 'lastname', 'email', 'company'])
+        self.assertEqual([r.name for r in e.__relations__], [
+                         'firstname', 'lastname', 'email', 'company'])
 
     def test_schema_extension(self):
         s = Student()
-        self.assertEqual([r.name for r in s.__relations__], ['firstname', 'lastname', 'email', 'college'])
+        self.assertEqual([r.name for r in s.__relations__], [
+                         'firstname', 'lastname', 'email', 'college'])
         self.assertEqual(s.specialized_type, 'Person')
         x = X()
         self.assertEqual(x.specialized_type, None)
@@ -355,6 +363,7 @@ class PySchemaTC(TestCase):
 
     def test_maxsize(self):
         bp = BasePerson()
+
         def maxsize(e):
             for e in e.constraints:
                 if isinstance(e, SizeConstraint):
@@ -368,7 +377,6 @@ class PySchemaTC(TestCase):
         foo = Foo()
         self.assertEqual('i_name', foo.__relations__[1].name)
 
-
     def test_date_defaults(self):
         _today = date.today()
         _now = datetime.now()
@@ -414,6 +422,7 @@ class SchemaLoaderTC2(TestCase):
     def test_bad_rtype_inlined_conflict1(self):
         class Anentity(EntityType):
             rel = SubjectRelation('Anentity', inlined=True)
+
         class Anotherentity(EntityType):
             rel = SubjectRelation('Anentity', inlined=False)
 
@@ -421,10 +430,10 @@ class SchemaLoaderTC2(TestCase):
             build_schema_from_namespace(locals().items())
         self.assertBadInlinedMessage(cm.exception)
 
-
     def test_bad_rtype_inlined_conflict2(self):
         class Anentity(EntityType):
             rel = SubjectRelation('Anentity', inlined=True)
+
         class rel(RelationType):
             inlined = False
 
@@ -445,18 +454,18 @@ class SchemaLoaderTC2(TestCase):
         class Entity(EntityType):
             attr = String(constraints=[StaticVocabularyConstraint(['ab', 'abc']),
                                        SizeConstraint(2)])
-                          # "auto-fixed" when using:
-                          #vocabulary=['ab', 'abc'], maxsize=1)
+            # "auto-fixed" when using:
+            # vocabulary=['ab', 'abc'], maxsize=1)
 
         with self.assertRaises(BadSchemaDefinition) as cm:
             schema = build_schema_from_namespace(locals().items())
         self.assertEqual("size constraint set to 2 but vocabulary contains string of greater size",
                          str(cm.exception))
 
-
     def test_bad_rtype_rdef_conflict(self):
         class foo(RelationType):
-            __permissions__={'read': ()}
+            __permissions__ = {'read': ()}
+
         class Entity(EntityType):
             foo = String(__permissions__={'add': ()})
 
@@ -465,12 +474,13 @@ class SchemaLoaderTC2(TestCase):
         self.assertEqual("conflicting values {'add': ()}/{'read': ()} for property __permissions__ of relation 'foo'",
                          str(cm.exception))
 
-
     def test_schema(self):
         class Anentity(EntityType):
             rel = SubjectRelation('Anentity', inlined=True)
+
         class Anotherentity(EntityType):
             rel = SubjectRelation('Anentity')
+
         class rel(RelationType):
             composite = 'subject'
             cardinality = '1*'
@@ -492,18 +502,19 @@ class SchemaLoaderTC2(TestCase):
         self.assertEqual('<builtin>', rdef2.package)
 
     def test_imports(self):
-        schema = SchemaLoader().load([self.datadir, self.datadir+'2'], 'Test')
+        schema = SchemaLoader().load([self.datadir, self.datadir + '2'], 'Test')
         self.assertEqual({'read': (),
                           'add': (),
                           'update': (),
                           'delete': ()},
                          schema['Affaire'].permissions)
-        self.assertEqual([str(r) for r,at in schema['MyNote'].attribute_definitions()],
-                          ['date', 'type', 'para', 'text'])
+        self.assertEqual([str(r) for r, at in schema['MyNote'].attribute_definitions()],
+                         ['date', 'type', 'para', 'text'])
 
     def test_duplicated_rtype(self):
         loader = SchemaLoader()
         loader.defined = {}
+
         class RT1(RelationType):
             pass
         loader.add_definition(RT1)
@@ -514,10 +525,12 @@ class SchemaLoaderTC2(TestCase):
     def test_rtype_priority(self):
         loader = SchemaLoader()
         loader.defined = {}
+
         class RT1Def(RelationDefinition):
             name = 'RT1'
             subject = 'Whatever'
             object = 'Whatever'
+
         class RT1(RelationType):
             pass
         loader.add_definition(RT1Def)
@@ -529,11 +542,14 @@ class SchemaLoaderTC2(TestCase):
             base_arg_b = String()
             base_arg_a = Boolean()
             base_sub = SubjectRelation('MyOtherEntity')
+
         class base_obj(RelationDefinition):
             subject = 'MyOtherEntity'
             object = 'MyEntity'
+
         class MyOtherEntity(EntityType):
             base_o_obj = SubjectRelation('MyEntity')
+
         class base_o_sub(RelationDefinition):
             subject = 'MyEntity'
             object = 'MyOtherEntity'
@@ -541,9 +557,11 @@ class SchemaLoaderTC2(TestCase):
         MyEntity.add_relation(Int(), name='new_arg_b')
         MyEntity.add_relation(SubjectRelation('MyOtherEntity'), name="new_sub")
         MyOtherEntity.add_relation(SubjectRelation('MyEntity'), name="new_o_obj")
+
         class new_obj(RelationDefinition):
             subject = 'MyOtherEntity'
             object = 'MyEntity'
+
         class new_o_sub(RelationDefinition):
             subject = 'MyEntity'
             object = 'MyOtherEntity'
@@ -556,7 +574,7 @@ class SchemaLoaderTC2(TestCase):
         self.assertEqual(['base_arg_a', 'base_arg_b', 'new_arg_a', 'new_arg_b'],
                          attributes)
         relations_def = my_entity.relation_definitions()
-        relations = sorted( rel[0].type for rel in relations_def)
+        relations = sorted(rel[0].type for rel in relations_def)
         self.assertEqual(['base_o_obj', 'base_o_sub', 'base_obj',
                           'base_sub', 'new_o_obj', 'new_o_sub', 'new_obj',
                           'new_sub'],
@@ -601,11 +619,11 @@ class ComputedSchemaTC(TestCase):
 
         class travaille(RelationDefinition):
             subject = 'Employe'
-            object  = 'Societe'
+            object = 'Societe'
 
         class est_paye_par(ComputedRelation):
             __permissions__ = {'read': ('managers', 'users')}
-            rule  = ('S travaille O')
+            rule = ('S travaille O')
 
         schema = build_schema_from_namespace(vars().items())
         self.assertEqual('S travaille O', schema['est_paye_par'].rule)
@@ -620,12 +638,12 @@ class ComputedSchemaTC(TestCase):
             nickname = String()
 
         class est_paye_par(ComputedRelation):
-            rule  = ('S travaille O')
+            rule = ('S travaille O')
 
         class est_soudoye_par(RelationDefinition):
             name = 'est_paye_par'
             subject = 'Personne'
-            object  = 'Mafieu'
+            object = 'Mafieu'
 
         with self.assertRaises(BadSchemaDefinition) as cm:
             schema = build_schema_from_namespace(vars().items())
@@ -643,10 +661,10 @@ class ComputedSchemaTC(TestCase):
 
         class travaille(RelationDefinition):
             subject = 'Employe'
-            object  = 'Societe'
+            object = 'Societe'
 
         class est_paye_par(ComputedRelation):
-            rule  = ('S travaille O')
+            rule = ('S travaille O')
             inlined = True
 
         with self.assertRaises(BadSchemaDefinition) as cm:
@@ -663,13 +681,13 @@ class ComputedSchemaTC(TestCase):
 
         class travaille(RelationDefinition):
             subject = 'Employe'
-            object  = 'Societe'
+            object = 'Societe'
 
         class est_paye_par(ComputedRelation):
             __permissions__ = {'read': ('managers', 'users', 'guests'),
                                'add': ('hacker inside!', ),
                                'delete': ()}
-            rule  = ('S travaille O')
+            rule = ('S travaille O')
 
         with self.assertRaises(BadSchemaDefinition) as cm:
             schema = build_schema_from_namespace(vars().items())
@@ -694,7 +712,7 @@ class ComputedSchemaTC(TestCase):
         class attr(RelationDefinition):
             subject = 'Entity'
             object = 'Int'
-            formula='Any Z WHERE X oattr Z'
+            formula = 'Any Z WHERE X oattr Z'
 
         schema = build_schema_from_namespace(vars().items())
         self.assertEqual('Any Z WHERE X oattr Z',
@@ -711,7 +729,7 @@ class ComputedSchemaTC(TestCase):
             formula = 'Any Z WHERE X oattr Z'
 
         schema = build_schema_from_namespace(vars().items())
-        self.assertEqual({'read':   ('managers', 'users', 'guests'),
+        self.assertEqual({'read': ('managers', 'users', 'guests'),
                           'update': (),
                           'add': ()},
                          schema['attr'].rdef('Entity', 'Int').permissions)
@@ -752,13 +770,13 @@ class ComputedSchemaTC(TestCase):
             object = 'Boolean'
 
         schema = build_schema_from_namespace(vars().items())
-        self.assertEqual({'read':   ('clows', ),
+        self.assertEqual({'read': ('clows', ),
                           'update': (),
                           'add': ()},
                          schema['attr'].rdef('Entity', 'Int').permissions)
         self.assertEqual(
-                DEFAULT_ATTRPERMS,
-                schema['foo'].rdef('Entity', 'Boolean').permissions)
+            DEFAULT_ATTRPERMS,
+            schema['foo'].rdef('Entity', 'Boolean').permissions)
 
     def test_computed_attribute_subjrel(self):
         class Entity(EntityType):
diff --git a/test/unittest_schema.py b/test/unittest_schema.py
--- a/test/unittest_schema.py
+++ b/test/unittest_schema.py
@@ -51,7 +51,6 @@ class BaseSchemaTC(TestCase):
         eperson = schema.add_entity_type(EntityType('Person'))
         esociete = schema.add_entity_type(EntityType('Societe'))
 
-
         RELS = (
             # attribute relations
             ('Note date Datetime'),
@@ -77,7 +76,7 @@ class BaseSchemaTC(TestCase):
             ('Person  concerne  Affaire'),
             ('Person  concerne  Societe'),
             ('Affaire concerne  Societe'),
-            )
+        )
         for i, rel in enumerate(RELS):
             _from, _type, _to = rel.split()
             try:
@@ -85,7 +84,7 @@ class BaseSchemaTC(TestCase):
             except KeyError:
                 schema.add_relation_type(RelationType(_type))
             schema.add_relation_def(RelationDefinition(_from, _type, _to, order=i))
-        schema.rschema('nom').rdef('Person', 'String').cardinality = '11' # not null
+        schema.rschema('nom').rdef('Person', 'String').cardinality = '11'  # not null
 
         enote.rdef('type').constraints = [StaticVocabularyConstraint((u'bon', u'pasbon',
                                                                       u'bof', u'peux mieux faire'))]
@@ -97,7 +96,7 @@ class BaseSchemaTC(TestCase):
         eperson.rdef('prenom').constraints = [SizeConstraint(64)]
         eperson.rdef('tel').constraints = [IntervalBoundConstraint(maxvalue=999999)]
         eperson.rdef('fax').constraints = [IntervalBoundConstraint(minvalue=12, maxvalue=999999)]
-        eperson.rdef('promo').constraints = [StaticVocabularyConstraint( (u'bon', u'pasbon'))]
+        eperson.rdef('promo').constraints = [StaticVocabularyConstraint((u'bon', u'pasbon'))]
         eperson.rdef('promo_format').constraints = [FormatConstraint()]
 
         estring = schema.eschema('String')
@@ -114,9 +113,10 @@ class BaseSchemaTC(TestCase):
 
 # test data ###################################################################
 
-BAD_RELS = ( ('Truc badrelation1 Affaire'),
-             ('Affaire badrelation2 Machin'),
-             )
+
+BAD_RELS = (('Truc badrelation1 Affaire'),
+            ('Affaire badrelation2 Machin'),
+            )
 
 ATTRIBUTE_BAD_VALUES = (
     ('Person', [('nom', 1), ('nom', u'tropcour'),
@@ -128,21 +128,21 @@ ATTRIBUTE_BAD_VALUES = (
                 ('tel', 'notastring'),
                 ('tel', 1000000),
                 ('fax', 11),
-                ('TEST', 'notaboolean'), #('TEST', 0), ('TEST', 1)]), #should we accept this ?
+                ('TEST', 'notaboolean'),  # ('TEST', 0), ('TEST', 1)]), #should we accept this ?
                 ('TEST', 'true'), ('TEST', 'false')]),
-## the date and time are not checked for now
-##    ('Person', [('nom', u' >10 mais < 20 '),
-##               ('datenaiss', '979-06-12')]),
-##    ('Note', [('date', '2229-01-31 minuit')]),
-##    ('Affaire', [('starton', 'midi')]),
+    # the date and time are not checked for now
+    # ('Person', [('nom', u' >10 mais < 20 '),
+    # ('datenaiss', '979-06-12')]),
+    ##    ('Note', [('date', '2229-01-31 minuit')]),
+    ##    ('Affaire', [('starton', 'midi')]),
 
     ('Note', [('type', ['bof', 'peux mieux faire']),
               ('type', 'bof, je suis pas unicode, alors...'),
               ('date', None),
               ]),
-    ('Affaire', [('ref', 'ginco01'), ('ref', 'GINCO'),],
-    ),
-    )
+    ('Affaire', [('ref', 'ginco01'), ('ref', 'GINCO'), ],
+     ),
+)
 
 ATTRIBUTE_GOOD_VALUES = (
     ('Person', [('nom', u'>10 mais < 20 '), ('sexe', 0.5),
@@ -153,16 +153,16 @@ ATTRIBUTE_GOOD_VALUES = (
     ('Note', [('date', '2229-01-31 00:00')]),
     ('Affaire', [('starton', '00:00'),
                  ('ref', u'GINCO01')]),
-    )
+)
 
 RELATIONS_BAD_VALUES = {
     'travaille': [('Person', 'Affaire'), ('Affaire', 'Societe'),
                   ('Affaire', 'Societe'), ('Societe', 'Person')]
-    }
+}
 RELATIONS_GOOD_VALUES = {
     'travaille': [('Person', 'Societe')],
     'concerne': [('Person', 'Affaire'), ('Affaire', 'Societe')]
-    }
+}
 
 
 # test suite ##################################################################
@@ -250,18 +250,18 @@ class EntitySchemaTC(BaseSchemaTC):
         self.assertEqual(eperson.is_metadata('promo'), None)
         self.assertEqual(eperson.is_metadata('promo_enlarged'), None)
         self.assertEqual(eperson.is_metadata('promo_encoding'), ('promo', 'encoding'))
-        self.assertCountEqual([(k.type, v)  for k, v in eperson.meta_attributes().items()],
-                          [('promo_encoding', ('encoding', 'promo')),
-                           ('promo_format', ('format', 'promo'))])
+        self.assertCountEqual([(k.type, v) for k, v in eperson.meta_attributes().items()],
+                              [('promo_encoding', ('encoding', 'promo')),
+                               ('promo_format', ('format', 'promo'))])
 
     def test_defaults(self):
         self.assertEqual(list(eperson.defaults()), [])
         self.assertRaises(StopIteration, next, estring.defaults())
 
     def test_vocabulary(self):
-        #self.assertEqual(eperson.vocabulary('promo')
+        # self.assertEqual(eperson.vocabulary('promo')
         self.assertEqual(eperson.rdef('promo').constraint_by_interface(IVocabularyConstraint).vocabulary(),
-                          ('bon', 'pasbon'))
+                         ('bon', 'pasbon'))
         # self.assertRaises(AssertionError,
         #                   eperson.vocabulary, 'nom')
 
@@ -270,7 +270,6 @@ class EntitySchemaTC(BaseSchemaTC):
         eperson.rdef('prenom').fulltextindexed = True
         self.assertCountEqual(list(eperson.indexable_attributes()), ['nom', 'prenom'])
 
-
     def test_goodValues_relation_default(self):
         """check good values of entity does not raise an exception"""
         eperson.rdef('nom').default = 'No name'
@@ -343,7 +342,6 @@ class RelationSchemaTC(BaseSchemaTC):
         self.assertEqual(d['concerne'], 'p')
         self.assertEqual(d['nom'], 'n')
 
-
     def test_base(self):
         self.assertTrue(repr(rnom))
 
@@ -357,9 +355,9 @@ class RelationSchemaTC(BaseSchemaTC):
         self.assertRaisesMsg(BadSchemaDefinition,
                              'type String can\'t be used as subject in a relation',
                              rconcerne.update, estring, enote, {})
-##         self.assertRaisesMsg(BadSchemaDefinition,
+# self.assertRaisesMsg(BadSchemaDefinition,
 ##                              "can't have a final relation pointing to multiple entity types (nom: ['String', 'Int'])" ,
-##                              rnom.update, enote, eint)
+# rnom.update, enote, eint)
         msgref = ("ambiguous relation: 'Person.nom' is final (String) "
                   "but not 'Note.nom' (Affaire)")
         self.assertRaisesMsg(BadSchemaDefinition, msgref,
@@ -368,14 +366,14 @@ class RelationSchemaTC(BaseSchemaTC):
                           rconcerne.update, enote, estring, {})
 
     def test_association_types(self):
-        expected = [ ('Affaire', ['Societe']),
-                     ('Person', ['Affaire', 'Societe']) ]
+        expected = [('Affaire', ['Societe']),
+                    ('Person', ['Affaire', 'Societe'])]
         assoc_types = rconcerne.associations()
         assoc_types.sort()
         self.assertEqual(assoc_types, expected)
         assoc_types = []
         for _from, _to in rconcerne.associations():
-            assoc_types.append( (_from, _to))
+            assoc_types.append((_from, _to))
             #assoc_types.append( (_from.type, [s.type for s in _to]) )
         assoc_types.sort()
         self.assertEqual(assoc_types, expected)
@@ -407,15 +405,15 @@ class SchemaTC(BaseSchemaTC):
         self.assertEqual(schema.has_entity('Aaire'), False)
 
     def test_raise_add_entity_type(self):
-        self.assertRaisesMsg(BadSchemaDefinition, "entity type Person is already defined" ,
+        self.assertRaisesMsg(BadSchemaDefinition, "entity type Person is already defined",
                              schema.add_entity_type, EntityType('Person'))
 
     def test_raise_relation_def(self):
-        self.assertRaisesMsg(BadSchemaDefinition, "using unknown type 'Afire' in relation evaluee"  ,
+        self.assertRaisesMsg(BadSchemaDefinition, "using unknown type 'Afire' in relation evaluee",
                              schema.add_relation_def, RelationDefinition('Afire', 'evaluee', 'Note'))
-## XXX what is this ?
-##        self.assertRaisesMsg(BadSchemaDefinition, 'the "symmetric" property should appear on every definition of relation evaluee' ,
-##                             schema.add_relation_def, RelationDefinition('Affaire', 'evaluee', 'Note', symmetric=True))
+# XXX what is this ?
+# self.assertRaisesMsg(BadSchemaDefinition, 'the "symmetric" property should appear on every definition of relation evaluee' ,
+# schema.add_relation_def, RelationDefinition('Affaire', 'evaluee', 'Note', symmetric=True))
 
     def test_schema_relations(self):
         all_relations = ['TEST', 'concerne', 'travaille', 'evaluee',
@@ -470,7 +468,7 @@ class SchemaTC(BaseSchemaTC):
     def test_validation_error_translation_2(self):
         eschema = schema.eschema('Person')
         with self.assertRaises(ValidationError) as cm:
-            eschema.check({'nom': u'x'*21, 'prenom': u'x'*65})
+            eschema.check({'nom': u'x' * 21, 'prenom': u'x' * 65})
         cm.exception.translate(str)
         self.assertEqual(cm.exception.errors,
                          {'nom-subject': u'value should have maximum size of 20 but found 21',
@@ -519,17 +517,16 @@ class SchemaTC(BaseSchemaTC):
         self.assertEqual(eperson.ordered_relations(), pschema['Person'].ordered_relations())
         self.assertEqual(eperson.object_relations(), pschema['Person'].object_relations())
 
-
     def test_rename_entity_type(self):
         affaire = schema.eschema('Affaire')
         orig_rprops = affaire.rdef('concerne')
         schema.rename_entity_type('Affaire', 'Workcase')
         self.assertCountEqual(schema._entities.keys(),
-                             ['BigInt', 'Boolean', 'Bytes', 'Date', 'Datetime', 'Float',
-                              'Decimal',
-                              'Int', 'Interval', 'Note', 'Password', 'Person',
-                              'Societe', 'String', 'Time', 'TZDatetime', 'TZTime',
-                              'Workcase'])
+                              ['BigInt', 'Boolean', 'Bytes', 'Date', 'Datetime', 'Float',
+                               'Decimal',
+                               'Int', 'Interval', 'Note', 'Password', 'Person',
+                               'Societe', 'String', 'Time', 'TZDatetime', 'TZTime',
+                               'Workcase'])
         rconcerne = schema.rschema('concerne')
         self.assertCountEqual(rconcerne.subjects(), ['Workcase', 'Person'])
         self.assertCountEqual(rconcerne.objects(), ['Workcase', 'Societe'])
@@ -543,6 +540,7 @@ class SchemaTC(BaseSchemaTC):
             pass
         rdef = RelationDefinition('Plan', 'custom_workflow', 'Workflow')
         _add_relation(Plan.__relations__, rdef)
+
         class TE(Plan):
             pass
         self.assertListEqual(['custom_workflow'],
@@ -576,14 +574,14 @@ class SymetricTC(TestCase):
         subj_types = rsee_also.associations()
         subj_types.sort()
         self.assertEqual(subj_types,
-                          [('Bug', ['Bug', 'Story', 'Project']),
-                           ('Project', ['Bug', 'Story', 'Project']),
-                           ('Story', ['Bug', 'Story', 'Project'])])
+                         [('Bug', ['Bug', 'Story', 'Project']),
+                          ('Project', ['Bug', 'Story', 'Project']),
+                          ('Story', ['Bug', 'Story', 'Project'])])
 
     def test_wildcard_association_types(self):
         class see_also(RelationDefinition):
             subject = '*'
-            object ='*'
+            object = '*'
         see_also.expand_relation_definitions({'see_also': see_also}, schema)
         rsee_also = schema.rschema('see_also')
         subj_types = rsee_also.associations()
@@ -591,9 +589,9 @@ class SymetricTC(TestCase):
         for key, vals in subj_types:
             vals.sort()
         self.assertEqual(subj_types,
-                          [('Bug', ['Bug', 'Project', 'Story']),
-                           ('Project', ['Bug', 'Project', 'Story']),
-                           ('Story', ['Bug', 'Project', 'Story'])])
+                         [('Bug', ['Bug', 'Project', 'Story']),
+                          ('Project', ['Bug', 'Project', 'Story']),
+                          ('Story', ['Bug', 'Project', 'Story'])])
 
 
 class CustomTypeTC(TestCase):
@@ -628,5 +626,6 @@ class CustomTypeTC(TestCase):
         self.assertEqual(t.test1, 1)
         self.assertFalse(hasattr(t, 'test2'))
 
+
 if __name__ == '__main__':
     unittest_main()
diff --git a/test/unittest_schema2dot.py b/test/unittest_schema2dot.py
--- a/test/unittest_schema2dot.py
+++ b/test/unittest_schema2dot.py
@@ -45,6 +45,7 @@ splines=true
 }
 '''
 
+
 class DotTC(TestCase):
 
     def test_schema2dot(self):
@@ -57,5 +58,6 @@ class DotTC(TestCase):
         os.remove('toto.dot')
         self.assertMultiLineEqual(DOT_SOURCE, generated)
 
+
 if __name__ == '__main__':
     unittest_main()
diff --git a/test/unittest_serialize.py b/test/unittest_serialize.py
--- a/test/unittest_serialize.py
+++ b/test/unittest_serialize.py
@@ -3,6 +3,7 @@ from logilab.common import testlib
 from yams.buildobjs import register_base_types, String, EntityType, RelationType, RelationDefinition
 from yams import schema, serialize
 
+
 class MyTests(testlib.TestCase):
 
     def test_yams_serialize(self):
@@ -17,14 +18,15 @@ class MyTests(testlib.TestCase):
         s.add_relation_def(RelationDefinition('Ent1', 'attr1', 'String'))
         out = serialize.serialize_to_python(s)
         self.assertMultiLineEqual(out, '\n'.join([
-                'from yams.buildobjs import *',
-                '',
-                'class Ent2(EntityType):',
-                '    pass',
-                '',
-                'class Ent1(Ent2):',
-                '    attr1 = String()',
-                '\n']))
+            'from yams.buildobjs import *',
+            '',
+            'class Ent2(EntityType):',
+            '    pass',
+            '',
+            'class Ent1(Ent2):',
+            '    attr1 = String()',
+            '\n']))
+
 
 if __name__ == '__main__':
     testlib.unittest_main()
diff --git a/test/unittest_specialization.py b/test/unittest_specialization.py
--- a/test/unittest_specialization.py
+++ b/test/unittest_specialization.py
@@ -22,6 +22,7 @@ from logilab.common.testlib import TestC
 from yams.reader import build_schema_from_namespace
 from yams.buildobjs import EntityType, String, SubjectRelation, RelationDefinition
 
+
 def build_schema():
 
     class Person(EntityType):
@@ -98,7 +99,8 @@ class SpecializationTC(TestCase):
         # company
         company = schema.eschema('Company')
         self.assertEqual(sorted(company.specialized_by(False)), ['Division', 'SubCompany'])
-        self.assertEqual(sorted(company.specialized_by(True)), ['Division', 'SubCompany', 'SubDivision'])
+        self.assertEqual(sorted(company.specialized_by(True)), [
+                         'Division', 'SubCompany', 'SubDivision'])
         # division
         division = schema.eschema('Division')
         self.assertEqual(sorted(division.specialized_by(False)), ['SubDivision'])
@@ -114,7 +116,7 @@ class SpecializationTC(TestCase):
         entities = [str(e) for e in self.schema.entities() if not e.final]
         relations = sorted([r for r in self.schema.relations() if not r.final])
         self.assertListEqual(sorted(entities), ['Company', 'Division', 'Person',
-                                                 'Student', 'SubCompany', 'SubDivision', 'SubSubDivision'])
+                                                'Student', 'SubCompany', 'SubDivision', 'SubSubDivision'])
         self.assertListEqual(relations, ['division_of', 'knows', 'works_for'])
         expected = {('Person', 'Person'): False,
                     ('Person', 'Student'): True,
@@ -129,7 +131,7 @@ class SpecializationTC(TestCase):
             done.add(subjobj)
             self.assertIn(subjobj, expected)
             self.assertEqual(krschema.rdef(subject, object).infered,
-                              expected[subjobj])
+                             expected[subjobj])
         self.assertEqual(len(set(expected) - done), 0, 'missing %s' % (set(expected) - done))
         expected = {('Person', 'Company'): False,
                     ('Person', 'Division'): True,
@@ -146,7 +148,7 @@ class SpecializationTC(TestCase):
             done.add(subjobj)
             self.assertIn(subjobj, expected)
             self.assertEqual(wrschema.rdef(subject, object).infered,
-                              expected[subjobj])
+                             expected[subjobj])
         self.assertEqual(len(set(expected) - done), 0, 'missing %s' % (set(expected) - done))
 
         self.assertIn('custom_attr', self.schema['Student'].subjrels)
@@ -171,18 +173,18 @@ class SpecializationTC(TestCase):
             done.add(subjobj)
             self.assertIn(subjobj, expected)
             self.assertEqual(krschema.rdef(subject, object).infered,
-                              expected[subjobj])
+                             expected[subjobj])
         self.assertEqual(len(set(expected) - done), 0, 'missing %s' % (set(expected) - done))
         expected = {('Person', 'Company'): False,
                     ('Student', 'Company'): False,
-                   }
+                    }
         done = set()
         for subjobj in wrschema.rdefs:
             subject, object = subjobj
             done.add(subjobj)
             self.assertTrue(subjobj in expected)
             self.assertEqual(wrschema.rdef(subject, object).infered,
-                              expected[subjobj])
+                             expected[subjobj])
         self.assertEqual(len(set(expected) - done), 0, 'missing %s' % (set(expected) - done))
 
     def test_no_more_infered_relations(self):
@@ -211,5 +213,6 @@ class SpecializationTC(TestCase):
         self.schema.remove_infered_definitions()
         self.assertIn('works_for', self.schema)
 
+
 if __name__ == '__main__':
     unittest_main()
diff --git a/test/unittest_xy.py b/test/unittest_xy.py
--- a/test/unittest_xy.py
+++ b/test/unittest_xy.py
@@ -18,6 +18,7 @@
 from logilab.common.testlib import TestCase, unittest_main
 from yams.xy import XYRegistry
 
+
 class XYTC(TestCase):
     def test(self):
         xy = XYRegistry()
@@ -43,9 +44,10 @@ class XYTC(TestCase):
 
         self.assertEqual(xy.yeq('doap:Project', isentity=True), ['Project'])
         self.assertEqual(xy.yeq('dc:title'), [('CWUser', 'login', '*'),
-                                               ('Project', 'name', '*')])
+                                              ('Project', 'name', '*')])
         self.assertEqual(xy.yeq('doap:Project doap:maintainer'),
-                          [('Project', 'created_by', 'CWUser')])
+                         [('Project', 'created_by', 'CWUser')])
+
 
 if __name__ == '__main__':
     unittest_main()



More information about the cubicweb-devel mailing list