Skip to content

Commit c27d64d

Browse files
author
ds
committed
add test for jql
1 parent 31992fa commit c27d64d

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

pypika/tests/dialects/test_jql.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import unittest
2+
3+
from pypika.dialects import JiraQueryBuilder, JiraTable
4+
5+
6+
class SelectTests(unittest.TestCase):
7+
table_abc = JiraTable()
8+
9+
def test_in_query(self):
10+
q = (
11+
JiraQueryBuilder()
12+
.where(self.table_abc.project.isin(["PROJ1", "PROJ2"]))
13+
)
14+
15+
self.assertEqual('project IN ("PROJ1","PROJ2")', str(q))
16+
17+
def test_eq_query(self):
18+
q = (
19+
JiraQueryBuilder()
20+
.where(self.table_abc.issuetype == "My issue")
21+
)
22+
23+
self.assertEqual('issuetype="My issue"', str(q))
24+
25+
def test_or_query(self):
26+
q = (
27+
JiraQueryBuilder()
28+
.where(self.table_abc.labels.isempty() | self.table_abc.labels.notin(["stale", "bug fix"]))
29+
)
30+
31+
self.assertEqual('labels is EMPTY OR labels NOT IN ("stale","bug fix")', str(q))
32+
33+
def test_and_query(self):
34+
q = (
35+
JiraQueryBuilder()
36+
.where(self.table_abc.repos.notempty() & self.table_abc.repos.notin(["main", "dev"]))
37+
)
38+
39+
self.assertEqual('repos is not EMPTY AND repos NOT IN ("main","dev")', str(q))

0 commit comments

Comments
 (0)