Skip to content

Commit

Permalink
add test for jql
Browse files Browse the repository at this point in the history
  • Loading branch information
ds committed Sep 24, 2023
1 parent 09291e5 commit 0a8a291
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions pypika/tests/dialects/test_jql.py
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))

0 comments on commit 0a8a291

Please sign in to comment.