diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-13 11:11:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-13 11:11:42 +0000 |
commit | 721d458d4c24741ccbc5519b7ca39234a1a21ff6 (patch) | |
tree | b9f72e1d00aba012f06cdf7b0d75ec5e53640eaf /tests/test_expressions.py | |
parent | Adding upstream version 25.1.0. (diff) | |
download | sqlglot-721d458d4c24741ccbc5519b7ca39234a1a21ff6.tar.xz sqlglot-721d458d4c24741ccbc5519b7ca39234a1a21ff6.zip |
Adding upstream version 25.5.1.upstream/25.5.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_expressions.py')
-rw-r--r-- | tests/test_expressions.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/tests/test_expressions.py b/tests/test_expressions.py index 1395b24..b3617ee 100644 --- a/tests/test_expressions.py +++ b/tests/test_expressions.py @@ -1011,12 +1011,18 @@ FROM foo""", "ALTER TABLE t1 RENAME TO t2", ) - def test_is_negative(self): - self.assertTrue(parse_one("-1").is_negative) - self.assertTrue(parse_one("- 1.0").is_negative) - self.assertTrue(exp.Literal.number("-1").is_negative) - self.assertFalse(parse_one("1").is_negative) - self.assertFalse(parse_one("x").is_negative) + def test_to_py(self): + self.assertEqual(parse_one("- -1").to_py(), 1) + self.assertIs(parse_one("TRUE").to_py(), True) + self.assertIs(parse_one("1").to_py(), 1) + self.assertIs(parse_one("'1'").to_py(), "1") + self.assertIs(parse_one("null").to_py(), None) + + with self.assertRaises(ValueError): + parse_one("x").to_py() + + def test_is_int(self): + self.assertTrue(parse_one("- -1").is_int) def test_is_star(self): assert parse_one("*").is_star |