def test_sql_core(cls) -> None:
        """
        Tests some core SQL features.
        """
        log.info("Testing join_op")
        test_succeed(cls.join_op, ",")
        test_succeed(cls.join_op, "INNER JOIN")

        log.info("Testing join_source")
        test_succeed(cls.join_source, "a")
        test_succeed(cls.join_source, "a INNER JOIN b")
        test_succeed(cls.join_source, "a, b")

        log.info("Testing result_column")
        test_succeed(cls.result_column, "t1.a")
        test_succeed(cls.result_column, "col1")
        test_succeed(cls.result_column, "t1.col1")
        test_succeed(cls.result_column, "col1 AS alias")
        test_succeed(cls.result_column, "t1.col1 AS alias")
        # test_succeed(cls.result_column, "*")
        test_succeed(cls.result_column, "COUNT(*)")
        test_succeed(cls.result_column, "COUNT(*) AS alias")
        test_fail(cls.result_column, "COUNT")

        test_succeed(Combine(COUNT + LPAR) + '*', "COUNT(*")
        test_succeed(Combine(COUNT + LPAR) + '*', "COUNT( *")
        test_fail(Combine(COUNT + LPAR) + '*', "COUNT (*")

        test_fail(cls.result_column, "COUNT (*)")  # space disallowed
        test_succeed(cls.result_column, "COUNT(DISTINCT col)")
        test_succeed(cls.result_column, "MAX(col)")
        test_fail(cls.result_column, "MAX (col)")

        log.info("Testing select_statement")
        cls.test_select("SELECT t1.a, t1.b FROM t1 WHERE t1.col1 IN (1, 2, 3)")
        cls.test_select("SELECT a, b FROM c")  # no WHERE
        cls.test_select("SELECT a, b FROM c WHERE d > 5 AND e = 4")
        cls.test_select("SELECT a, b FROM c INNER JOIN f WHERE d > 5 AND e = 4")
        cls.test_select("SELECT t1.a, t1.b FROM t1 WHERE t1.col1 > 5")

        log.info("Testing SELECT something AS alias")
        cls.test_select("SELECT col1 AS alias FROM t1")
        cls.test_select("SELECT t1.col1 AS alias FROM t1")

        log.info("Testing nested query: IN")
        cls.test_select("SELECT col1 FROM table1 WHERE col2 IN (SELECT col3 FROM table2)")  # noqa

        log.info("Testing COUNT(*)")
        cls.test_select("SELECT col1, COUNT(*) FROM table1 GROUP BY col1")

        log.info("MySQL rejects COUNT (*) and other aggregate functions with "
                 "a space between the function and the opening bracket")
        cls.test_select_fail(
            "SELECT col1, COUNT (*) FROM table1 GROUP BY col1")

        log.info("Testing SELECT with literal")
        cls.test_select("SELECT 'blah' AS some_literal")

        log.info("Testing SELECT result columns")
        test_succeed(cls.get_result_column(), "somecol")
        test_succeed(cls.get_result_column(), "somecol AS alias")
        test_succeed(cls.get_result_column(), "COUNT(*)")
        test_succeed(cls.get_result_column(), "COUNT(*) AS alias")
        test_succeed(cls.get_result_column(), "'blah'")
        test_succeed(cls.get_result_column(), "'blah' AS alias")
        test_succeed(cls.get_result_column(), "NULL")
        test_succeed(cls.get_result_column(), "NULL AS alias")
def test_sql_core ( cls ) -> None : log . info ( "Testing join_op" ) test_succeed ( cls . join_op , "," ) test_succeed ( cls . join_op , "INNER JOIN" ) log . info ( "Testing join_source" ) test_succeed ( cls . join_source , "a" ) test_succeed ( cls . join_source , "a INNER JOIN b" ) test_succeed ( cls . join_source , "a, b" ) log . info ( "Testing result_column" ) test_succeed ( cls . result_column , "t1.a" ) test_succeed ( cls . result_column , "col1" ) test_succeed ( cls . result_column , "t1.col1" ) test_succeed ( cls . result_column , "col1 AS alias" ) test_succeed ( cls . result_column , "t1.col1 AS alias" ) test_succeed ( cls . result_column , "COUNT(*)" ) test_succeed ( cls . result_column , "COUNT(*) AS alias" ) test_fail ( cls . result_column , "COUNT" ) test_succeed ( Combine ( COUNT + LPAR ) + '*' , "COUNT(*" ) test_succeed ( Combine ( COUNT + LPAR ) + '*' , "COUNT( *" ) test_fail ( Combine ( COUNT + LPAR ) + '*' , "COUNT (*" ) test_fail ( cls . result_column , "COUNT (*)" ) test_succeed ( cls . result_column , "COUNT(DISTINCT col)" ) test_succeed ( cls . result_column , "MAX(col)" ) test_fail ( cls . result_column , "MAX (col)" ) log . info ( "Testing select_statement" ) cls . test_select ( "SELECT t1.a, t1.b FROM t1 WHERE t1.col1 IN (1, 2, 3)" ) cls . test_select ( "SELECT a, b FROM c" ) cls . test_select ( "SELECT a, b FROM c WHERE d > 5 AND e = 4" ) cls . test_select ( "SELECT a, b FROM c INNER JOIN f WHERE d > 5 AND e = 4" ) cls . test_select ( "SELECT t1.a, t1.b FROM t1 WHERE t1.col1 > 5" ) log . info ( "Testing SELECT something AS alias" ) cls . test_select ( "SELECT col1 AS alias FROM t1" ) cls . test_select ( "SELECT t1.col1 AS alias FROM t1" ) log . info ( "Testing nested query: IN" ) cls . test_select ( "SELECT col1 FROM table1 WHERE col2 IN (SELECT col3 FROM table2)" ) log . info ( "Testing COUNT(*)" ) cls . test_select ( "SELECT col1, COUNT(*) FROM table1 GROUP BY col1" ) log . info ( "MySQL rejects COUNT (*) and other aggregate functions with " "a space between the function and the opening bracket" ) cls . test_select_fail ( "SELECT col1, COUNT (*) FROM table1 GROUP BY col1" ) log . info ( "Testing SELECT with literal" ) cls . test_select ( "SELECT 'blah' AS some_literal" ) log . info ( "Testing SELECT result columns" ) test_succeed ( cls . get_result_column ( ) , "somecol" ) test_succeed ( cls . get_result_column ( ) , "somecol AS alias" ) test_succeed ( cls . get_result_column ( ) , "COUNT(*)" ) test_succeed ( cls . get_result_column ( ) , "COUNT(*) AS alias" ) test_succeed ( cls . get_result_column ( ) , "'blah'" ) test_succeed ( cls . get_result_column ( ) , "'blah' AS alias" ) test_succeed ( cls . get_result_column ( ) , "NULL" ) test_succeed ( cls . get_result_column ( ) , "NULL AS alias" )
Tests some core SQL features.