Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
9a1f48be
Unverified
Commit
9a1f48be
authored
4 years ago
by
Simon Belak
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
MBQL: add nil comparison tests (#12290)
parent
7c5fddb2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/metabase/query_processor_test/filter_test.clj
+35
-29
35 additions, 29 deletions
test/metabase/query_processor_test/filter_test.clj
with
35 additions
and
29 deletions
test/metabase/query_processor_test/filter_test.clj
+
35
−
29
View file @
9a1f48be
...
...
@@ -49,35 +49,41 @@
nil
false
x
))
;;; filter = true
(
qp.test/expect-with-non-timeseries-dbs
[[
1
"Tempest"
true
]
[
2
"Bullit"
true
]]
(
qp.test/formatted-rows
[
int
str
->bool
]
:format-nil-values
(
data/dataset
places-cam-likes
(
data/run-mbql-query
places
{
:filter
[
:=
$liked
true
]
:order-by
[[
:asc
$id
]]}))))
;;; filter != false
(
qp.test/expect-with-non-timeseries-dbs
[[
1
"Tempest"
true
]
[
2
"Bullit"
true
]]
(
qp.test/formatted-rows
[
int
str
->bool
]
:format-nil-values
(
data/dataset
places-cam-likes
(
data/run-mbql-query
places
{
:filter
[
:!=
$liked
false
]
:order-by
[[
:asc
$id
]]}))))
;;; filter != true
(
qp.test/expect-with-non-timeseries-dbs
[[
3
"The Dentist"
false
]]
(
qp.test/formatted-rows
[
int
str
->bool
]
:format-nil-values
(
data/dataset
places-cam-likes
(
data/run-mbql-query
places
{
:filter
[
:!=
$liked
true
]
:order-by
[[
:asc
$id
]]}))))
(
deftest
comparison-test
(
datasets/test-drivers
(
qp.test/normal-drivers
)
(
testing
"Can we use true literal in comparisons"
(
is
(
=
[[
1
"Tempest"
true
]
[
2
"Bullit"
true
]]
(
->>
{
:filter
[
:=
$liked
true
]
:order-by
[[
:asc
$id
]]}
(
data/run-mbql-query
places
)
(
data/dataset
places-cam-likes
)
(
qp.test/formatted-rows
[
int
str
->bool
]
:format-nil-values
))))
(
is
(
=
[[
3
"The Dentist"
false
]]
(
->>
{
:filter
[
:!=
$liked
true
]
:order-by
[[
:asc
$id
]]}
(
data/run-mbql-query
places
)
(
data/dataset
places-cam-likes
)
(
qp.test/formatted-rows
[
int
str
->bool
]
:format-nil-values
))))
(
testing
"Can we use false literal in comparisons"
(
is
(
=
[[
1
"Tempest"
true
]
[
2
"Bullit"
true
]]
(
->>
{
:filter
[
:!=
$liked
false
]
:order-by
[[
:asc
$id
]]}
(
data/run-mbql-query
places
)
(
data/dataset
places-cam-likes
)
(
qp.test/formatted-rows
[
int
str
->bool
]
:format-nil-values
))))
(
testing
"Can we use nil literal in comparisons"
(
is
(
=
[[
12
]]
(
->>
{
:filter
[
:!=
$flock_id
nil
]
:aggregation
[[
:count
]]}
(
data/run-mbql-query
bird
)
(
data/dataset
bird-flocks
)
qp.test/rows
)))
(
is
(
=
[[
6
]]
(
->>
{
:filter
[
:=
$flock_id
nil
]
:aggregation
[[
:count
]]}
(
data/run-mbql-query
bird
)
(
data/dataset
bird-flocks
)
qp.test/rows
))))))))
(
deftest
between-test
(
datasets/test-drivers
(
qp.test/normal-drivers
)
...
...
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