[test] fix failure introduced by 1719eab69551: the regexp should be fixed, not the error message
--- a/schema.py Wed May 25 18:46:09 2011 +0200
+++ b/schema.py Thu May 26 08:12:42 2011 +0200
@@ -528,15 +528,15 @@
rschema = self.add_relation_type(ybo.RelationType('identity'))
rschema.final = False
- etype_name_re = r'[A-Z][A-Za-z0-9]*[a-z]+[0-9]*$'
+ etype_name_re = r'[A-Z][A-Za-z0-9]*[a-z]+[A-Za-z0-9]*$'
def add_entity_type(self, edef):
edef.name = edef.name.encode()
edef.name = bw_normalize_etype(edef.name)
if not re.match(self.etype_name_re, edef.name):
raise BadSchemaDefinition(
- '%r is not a valid name for an entity type. It should match '
- 'the following regular expresion: %r' % (edef.name,
- self.etype_name_re))
+ '%r is not a valid name for an entity type. It should start '
+ 'with an upper cased letter and be followed by at least a '
+ 'lower cased letter' % edef.name)
eschema = super(CubicWebSchema, self).add_entity_type(edef)
if not eschema.final:
# automatically add the eid relation to non final entity types
--- a/test/unittest_schema.py Wed May 25 18:46:09 2011 +0200
+++ b/test/unittest_schema.py Thu May 26 08:12:42 2011 +0200
@@ -259,6 +259,11 @@
self.assertEqual([x.expression for x in aschema.get_rqlexprs('update')],
['U has_update_permission X'])
+ def test_nonregr_allowed_type_names(self):
+ schema = CubicWebSchema('Test Schema')
+ schema.add_entity_type(EntityType('NaN'))
+
+
class BadSchemaTC(TestCase):
def setUp(self):
self.loader = CubicWebSchemaLoader()