from django.db import connection, models
from django.db.models.expressions import RawSQL


def test_plain():
    cursor = connection.cursor()
    cursor.execute("some sql")  # $getSql="some sql"


def test_context():
    with connection.cursor() as cursor:
        cursor.execute("some sql")  # $getSql="some sql"
        cursor.execute(sql="some sql")  # $getSql="some sql"


class User(models.Model):
    pass


def test_model():
    User.objects.raw("some sql")  # $getSql="some sql"
    User.objects.annotate(RawSQL("some sql"))  # $getSql="some sql"
    User.objects.annotate(val=RawSQL("some sql"))  # $getSql="some sql"
    User.objects.extra("some sql")  # $getSql="some sql"

    raw = RawSQL("so raw")
    Users.objects.annotate(val=raw)  # $f-:getSql="so raw"

@@ -676,16 +676,181 @@
 ome sql%22
+%0A    User.objects.extra(select=%22select%22, where=%22where%22, tables=%22tables%22, order_by=%22order_by%22)  # $getSql=%22select%22 $getSql=%22where%22 $getSql=%22tables%22 $getSql=%22order_by%22
 %0A%0A    ra

test for keyword arguments to extra