summaryrefslogtreecommitdiffstats
path: root/tests/test_time.py
blob: 17821c2f02b7cd6df2831e3e211ea34d7b4e944a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import unittest

from sqlglot.time import format_time


class TestTime(unittest.TestCase):
    def test_format_time(self):
        self.assertEqual(format_time("", {}), "")
        self.assertEqual(format_time(" ", {}), " ")
        mapping = {"a": "b", "aa": "c"}
        self.assertEqual(format_time("a", mapping), "b")
        self.assertEqual(format_time("aa", mapping), "c")
        self.assertEqual(format_time("aaada", mapping), "cbdb")
        self.assertEqual(format_time("da", mapping), "db")