summaryrefslogtreecommitdiffstats
path: root/tests/test_expressions.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_expressions.py')
-rw-r--r--tests/test_expressions.py18
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