File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change
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 ))
You can’t perform that action at this time.
0 commit comments