1
0
Fork 0

Adding upstream version 6.0.4.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-13 06:15:54 +01:00
parent d01130b3f1
commit 527597d2af
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
122 changed files with 23162 additions and 0 deletions

31
tests/test_helper.py Normal file
View file

@ -0,0 +1,31 @@
import unittest
from sqlglot.helper import tsort
class TestHelper(unittest.TestCase):
def test_tsort(self):
self.assertEqual(tsort({"a": []}), ["a"])
self.assertEqual(tsort({"a": ["b", "b"]}), ["b", "a"])
self.assertEqual(tsort({"a": ["b"]}), ["b", "a"])
self.assertEqual(tsort({"a": ["c"], "b": [], "c": []}), ["c", "a", "b"])
self.assertEqual(
tsort(
{
"a": ["b", "c"],
"b": ["c"],
"c": [],
"d": ["a"],
}
),
["c", "b", "a", "d"],
)
with self.assertRaises(ValueError):
tsort(
{
"a": ["b", "c"],
"b": ["a"],
"c": [],
}
)