Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
RQL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cubicweb
RQL
Commits
46ea8a04429c
Commit
46ea8a04429c
authored
16 years ago
by
Nicolas Chauvat
Browse files
Options
Downloads
Patches
Plain Diff
fix unwanted shared singleton making tests fail
parent
355006b88d3a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/unittest_analyze.py
+53
-51
53 additions, 51 deletions
test/unittest_analyze.py
test/unittest_compare.py
+12
-15
12 additions, 15 deletions
test/unittest_compare.py
with
65 additions
and
66 deletions
test/unittest_analyze.py
+
53
−
51
View file @
46ea8a04
from
logilab.common.testlib
import
TestCase
,
unittest_main
from
rql
import
RQLHelper
,
TypeResolverException
from
rql.analyze
import
UnifyingETypeResolver
,
ETypeResolver
FINAL_ETYPES
=
(
'
String
'
,
'
Boolean
'
,
'
Int
'
,
'
Float
'
,
'
Date
'
,
'
Datetime
'
)
...
...
@@ -5,7 +4,7 @@
FINAL_ETYPES
=
(
'
String
'
,
'
Boolean
'
,
'
Int
'
,
'
Float
'
,
'
Date
'
,
'
Datetime
'
)
class
ERSchema
:
class
ERSchema
(
object
)
:
def
__cmp__
(
self
,
other
):
other
=
getattr
(
other
,
'
type
'
,
other
)
...
...
@@ -49,32 +48,28 @@
def
is_final
(
self
):
return
self
.
type
in
FINAL_ETYPES
class
DummySchema
:
_types
=
{}
for
type
in
[
'
String
'
,
'
Boolean
'
,
'
Int
'
,
'
Float
'
,
'
Date
'
,
'
Eetype
'
,
'
Person
'
,
'
Company
'
,
'
Address
'
]:
_types
[
type
]
=
EntitySchema
(
type
)
_relations
=
{
'
eid
'
:
RelationSchema
(
(
(
'
Person
'
,
(
'
Int
'
,)
),
(
'
Company
'
,
(
'
Int
'
,)
),
(
'
Address
'
,
(
'
Int
'
,)
),
(
'
Eetype
'
,
(
'
Int
'
,)
),
)
),
'
creation_date
'
:
RelationSchema
(
(
(
'
Person
'
,
(
'
Datetime
'
,)
),
(
'
Company
'
,
(
'
Datetime
'
,)
),
(
'
Address
'
,
(
'
Datetime
'
,)
),
(
'
Eetype
'
,
(
'
Datetime
'
,)
),
)
),
'
name
'
:
RelationSchema
(
(
(
'
Person
'
,
(
'
String
'
,)
),
(
'
Company
'
,
(
'
String
'
,)
),
)
),
'
firstname
'
:
RelationSchema
(
(
(
'
Person
'
,
(
'
String
'
,)
),
)
),
'
work_for
'
:
RelationSchema
(
(
(
'
Person
'
,
(
'
Company
'
,)
),
class
DummySchema
(
object
):
def
__init__
(
self
):
self
.
_types
=
{}
for
etype
in
[
'
String
'
,
'
Boolean
'
,
'
Int
'
,
'
Float
'
,
'
Date
'
,
'
Eetype
'
,
'
Person
'
,
'
Company
'
,
'
Address
'
]:
self
.
_types
[
etype
]
=
EntitySchema
(
etype
)
self
.
_relations
=
{
'
eid
'
:
RelationSchema
(
(
(
'
Person
'
,
(
'
Int
'
,)
),
(
'
Company
'
,
(
'
Int
'
,)
),
(
'
Address
'
,
(
'
Int
'
,)
),
(
'
Eetype
'
,
(
'
Int
'
,)
),
)
),
'
creation_date
'
:
RelationSchema
(
(
(
'
Person
'
,
(
'
Datetime
'
,)
),
(
'
Company
'
,
(
'
Datetime
'
,)
),
(
'
Address
'
,
(
'
Datetime
'
,)
),
(
'
Eetype
'
,
(
'
Datetime
'
,)
),
)
),
'
name
'
:
RelationSchema
(
(
(
'
Person
'
,
(
'
String
'
,)
),
(
'
Company
'
,
(
'
String
'
,)
),
)
),
...
...
@@ -79,14 +74,13 @@
)
),
'
is
'
:
RelationSchema
(
(
(
'
Person
'
,
(
'
Eetype
'
,)
),
(
'
Company
'
,
(
'
Eetype
'
,)
),
(
'
Address
'
,
(
'
Eetype
'
,)
),
)
),
'
connait
'
:
RelationSchema
(
((
'
Person
'
,
(
'
Person
'
,)
),
),
symetric
=
True
),
'
located
'
:
RelationSchema
(
(
(
'
Person
'
,
(
'
Address
'
,)
),
(
'
Company
'
,
(
'
Address
'
,)
),
'
firstname
'
:
RelationSchema
(
(
(
'
Person
'
,
(
'
String
'
,)
),
)
),
'
work_for
'
:
RelationSchema
(
(
(
'
Person
'
,
(
'
Company
'
,)
),
)
),
'
is
'
:
RelationSchema
(
(
(
'
Person
'
,
(
'
Eetype
'
,)
),
(
'
Company
'
,
(
'
Eetype
'
,)
),
(
'
Address
'
,
(
'
Eetype
'
,)
),
)
),
...
...
@@ -91,17 +85,25 @@
)
),
'
owned_by
'
:
RelationSchema
(
(
(
'
Person
'
,
(
'
Person
'
,)
),
(
'
Company
'
,
(
'
Person
'
,)
),
(
'
Eetype
'
,
(
'
Person
'
,)
),
)
),
'
identity
'
:
RelationSchema
(
(
(
'
Person
'
,
(
'
Person
'
,)
),
(
'
Company
'
,
(
'
Company
'
,)
),
(
'
Address
'
,
(
'
Address
'
,)
),
(
'
Eetype
'
,
(
'
Eetype
'
,)
),
)
),
}
'
connait
'
:
RelationSchema
(
((
'
Person
'
,
(
'
Person
'
,)
),
),
symetric
=
True
),
'
located
'
:
RelationSchema
(
(
(
'
Person
'
,
(
'
Address
'
,)
),
(
'
Company
'
,
(
'
Address
'
,)
),
)
),
'
owned_by
'
:
RelationSchema
(
(
(
'
Person
'
,
(
'
Person
'
,)
),
(
'
Company
'
,
(
'
Person
'
,)
),
(
'
Eetype
'
,
(
'
Person
'
,)
),
)
),
'
identity
'
:
RelationSchema
(
(
(
'
Person
'
,
(
'
Person
'
,)
),
(
'
Company
'
,
(
'
Company
'
,)
),
(
'
Address
'
,
(
'
Address
'
,)
),
(
'
Eetype
'
,
(
'
Eetype
'
,)
),
)
),
}
def
entities
(
self
):
return
self
.
_types
.
values
()
...
...
This diff is collapsed.
Click to expand it.
test/unittest_compare.py
+
12
−
15
View file @
46ea8a04
...
...
@@ -4,8 +4,4 @@
from
unittest_analyze
import
RelationSchema
,
EntitySchema
,
DummySchema
as
BaseSchema
class
DummySchema
(
BaseSchema
):
_types
=
BaseSchema
.
_types
for
type
in
[
'
Note
'
,]:
_types
[
type
]
=
EntitySchema
(
type
)
...
...
@@ -11,15 +7,16 @@
_relations
=
BaseSchema
.
_relations
_relations
[
'
a_faire_par
'
]
=
RelationSchema
(
(
(
'
Note
'
,
(
'
Person
'
,)),
)
)
_relations
[
'
creation_date
'
]
=
RelationSchema
(
(
(
'
Note
'
,
(
'
Date
'
,)),
)
)
_relations
[
'
nom
'
]
=
_relations
[
'
name
'
]
_relations
[
'
prenom
'
]
=
_relations
[
'
firstname
'
]
def
__init__
(
self
):
super
(
DummySchema
,
self
).
__init__
()
for
etype
in
[
'
Note
'
,]:
self
.
_types
[
etype
]
=
EntitySchema
(
etype
)
relations
=
[(
'
a_faire_par
'
,
((
'
Note
'
,
(
'
Person
'
,)),)),
(
'
creation_date
'
,
((
'
Note
'
,
(
'
Date
'
,)),)),
]
for
rel_name
,
rel_ent
in
relations
:
self
.
_relations
[
rel_name
]
=
RelationSchema
(
rel_ent
)
self
.
_relations
[
'
nom
'
]
=
self
.
_relations
[
'
name
'
]
self
.
_relations
[
'
prenom
'
]
=
self
.
_relations
[
'
firstname
'
]
class
RQLCompareClassTest
(
TestCase
):
"""
Compare RQL strings
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment