summaryrefslogtreecommitdiffstats
path: root/tests/test_helper.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-09-25 08:20:06 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-09-25 08:20:06 +0000
commitbd2d949d1f2fb728cf4c429dd3ae9a1510e10182 (patch)
treec051102e5aff0ca2d75e5b96b09968c52114060a /tests/test_helper.py
parentAdding upstream version 18.5.1. (diff)
downloadsqlglot-bd2d949d1f2fb728cf4c429dd3ae9a1510e10182.tar.xz
sqlglot-bd2d949d1f2fb728cf4c429dd3ae9a1510e10182.zip
Adding upstream version 18.7.0.upstream/18.7.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_helper.py')
-rw-r--r--tests/test_helper.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/test_helper.py b/tests/test_helper.py
index 7d63c34..a8872e9 100644
--- a/tests/test_helper.py
+++ b/tests/test_helper.py
@@ -1,7 +1,7 @@
import unittest
from sqlglot.dialects import BigQuery, Dialect, Snowflake
-from sqlglot.helper import name_sequence, tsort
+from sqlglot.helper import merge_ranges, name_sequence, tsort
class TestHelper(unittest.TestCase):
@@ -66,3 +66,10 @@ class TestHelper(unittest.TestCase):
self.assertEqual(s1(), "a2")
self.assertEqual(s2(), "b1")
self.assertEqual(s2(), "b2")
+
+ def test_merge_ranges(self):
+ self.assertEqual([], merge_ranges([]))
+ self.assertEqual([(0, 1)], merge_ranges([(0, 1)]))
+ self.assertEqual([(0, 1), (2, 3)], merge_ranges([(0, 1), (2, 3)]))
+ self.assertEqual([(0, 3)], merge_ranges([(0, 1), (1, 3)]))
+ self.assertEqual([(0, 1), (2, 4)], merge_ranges([(2, 3), (0, 1), (3, 4)]))