From 0a8a291a632ff2823db60592e8e13471ac5120e8 Mon Sep 17 00:00:00 2001 From: ds Date: Sun, 24 Sep 2023 14:46:41 +0300 Subject: [PATCH] add test for jql --- pypika/tests/dialects/test_jql.py | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 pypika/tests/dialects/test_jql.py diff --git a/pypika/tests/dialects/test_jql.py b/pypika/tests/dialects/test_jql.py new file mode 100644 index 00000000..e18fab8e --- /dev/null +++ b/pypika/tests/dialects/test_jql.py @@ -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))