Пример #1
0
 def test_AndQueryInFormatter(self):
     self.assertEqual(
         sqlformatter.format(
             "select * from folders f join iter i on i.id = f.id and i.id > 0 where f.name is not null and f.udefval1>0"
         ),
         "SELECT * \nFROM folders f\nJOIN iter i ON i.id = f.id\nAND i.id > 0\nWHERE f.name IS NOT NULL\n  AND f.udefval1 > 0"
     )
Пример #2
0
 def test_NoneInFormatter(self):
     self.assertEqual(sqlformatter.format(None), "")
Пример #3
0
 def test_EmptyStringInFormatter(self):
     self.assertEqual(sqlformatter.format(""), "")
Пример #4
0
 def test_OperatorSpacing(self):
     self.assertEqual(sqlformatter.format("8*8 *8* 8"), "8 * 8 * 8 * 8")
Пример #5
0
 def test_JoinQueryInFormatter(self):
     self.assertEqual(
         sqlformatter.format(
             "select * from folders f join iter i on i.id = f.id"),
         "SELECT * \nFROM folders f\nJOIN iter i ON i.id = f.id")
Пример #6
0
 def test_SimpleQueryInFormatter(self):
     self.assertEqual(sqlformatter.format("select * from folders"),
                      "SELECT * \nFROM folders")