-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ds
committed
Sep 24, 2023
1 parent
09291e5
commit 0a8a291
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import unittest | ||
|
||
from pypika.dialects import JiraQueryBuilder, JiraTable | ||
|
||
|
||
class SelectTests(unittest.TestCase): | ||
table_abc = JiraTable() | ||
|
||
def test_in_query(self): | ||
q = ( | ||
JiraQueryBuilder() | ||
.where(self.table_abc.project.isin(["PROJ1", "PROJ2"])) | ||
) | ||
|
||
self.assertEqual('project IN ("PROJ1","PROJ2")', str(q)) | ||
|
||
def test_eq_query(self): | ||
q = ( | ||
JiraQueryBuilder() | ||
.where(self.table_abc.issuetype == "My issue") | ||
) | ||
|
||
self.assertEqual('issuetype="My issue"', str(q)) | ||
|
||
def test_or_query(self): | ||
q = ( | ||
JiraQueryBuilder() | ||
.where(self.table_abc.labels.isempty() | self.table_abc.labels.notin(["stale", "bug fix"])) | ||
) | ||
|
||
self.assertEqual('labels is EMPTY OR labels NOT IN ("stale","bug fix")', str(q)) | ||
|
||
def test_and_query(self): | ||
q = ( | ||
JiraQueryBuilder() | ||
.where(self.table_abc.repos.notempty() & self.table_abc.repos.notin(["main", "dev"])) | ||
) | ||
|
||
self.assertEqual('repos is not EMPTY AND repos NOT IN ("main","dev")', str(q)) |