Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
cubicweb
Commits
74dbbb3f04ab
Commit
666d51d9
authored
Feb 16, 2021
by
François Ferry
Browse files
revert(test): take back RemoveUnusedSolutionsTC from
615f5fbf8718
parent
f15cce27fd4e
Pipeline
#36126
passed with stage
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
cubicweb/server/test/unittest_rql2sql.py
View file @
74dbbb3f
...
...
@@ -2016,5 +2016,29 @@ WHERE _Y.cw_creation_date>(DATETIME(_X.cw_creation_date, "+10 days"))'''),
self
.
_check
(
rql
,
sql
)
class
RemoveUnsusedSolutionsTC
(
unittest
.
TestCase
):
def
test_invariant_not_varying
(
self
):
rqlst
=
mock_object
(
defined_vars
=
{})
rqlst
.
defined_vars
[
'A'
]
=
mock_object
(
scope
=
rqlst
,
stinfo
=
{},
_q_invariant
=
True
)
rqlst
.
defined_vars
[
'B'
]
=
mock_object
(
scope
=
rqlst
,
stinfo
=
{},
_q_invariant
=
False
)
self
.
assertEqual
(
rql2sql
.
remove_unused_solutions
(
rqlst
,
[{
'A'
:
'RugbyGroup'
,
'B'
:
'RugbyTeam'
},
{
'A'
:
'FootGroup'
,
'B'
:
'FootTeam'
}],
None
),
([{
'A'
:
'RugbyGroup'
,
'B'
:
'RugbyTeam'
},
{
'A'
:
'FootGroup'
,
'B'
:
'FootTeam'
}],
{},
set
(
'B'
))
)
def
test_invariant_varying
(
self
):
rqlst
=
mock_object
(
defined_vars
=
{})
rqlst
.
defined_vars
[
'A'
]
=
mock_object
(
scope
=
rqlst
,
stinfo
=
{},
_q_invariant
=
True
)
rqlst
.
defined_vars
[
'B'
]
=
mock_object
(
scope
=
rqlst
,
stinfo
=
{},
_q_invariant
=
False
)
self
.
assertEqual
(
rql2sql
.
remove_unused_solutions
(
rqlst
,
[{
'A'
:
'RugbyGroup'
,
'B'
:
'RugbyTeam'
},
{
'A'
:
'FootGroup'
,
'B'
:
'RugbyTeam'
}],
None
),
([{
'A'
:
'RugbyGroup'
,
'B'
:
'RugbyTeam'
}],
{},
set
())
)
if
__name__
==
'__main__'
:
unittest
.
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment