from tests import base

from tests._testutils import run_until_complete


class TestConversion(base.ODBCTestCase):
    @run_until_complete
    def test_connect(self):
        conn = yield from self.connect()
        self.assertIs(conn.loop, self.loop)
        self.assertEqual(conn.autocommit, False)
        self.assertEqual(conn.timeout, 0)
        yield from conn.close()

    @run_until_complete
    def test_basic_cursor(self):
        conn = yield from self.connect()
        cursor = yield from conn.cursor()
        sql = 'SELECT 10;'
        yield from cursor.execute(sql)
        resp = yield from cursor.fetchall()
        print(resp)
        yield from conn.close()

@@ -1,16 +1,65 @@
+import asyncio%0Afrom aioodbc.cursor import Cursor%0A
 from tests impor
@@ -157,16 +157,17 @@
 tCase):%0A
+%0A
     @run
@@ -386,16 +386,61 @@
 out, 0)%0A
+        self.assertEqual(conn.closed, False)%0A
         
@@ -678,20 +678,24 @@
         
+(
 resp
+, )
  = yield
@@ -716,62 +716,684 @@
 etch
-all()%0A        print(resp)%0A        yield from conn.close()
+one()%0A        yield from conn.close()%0A        self.assertEqual(resp, 10)%0A%0A    @run_until_complete%0A    def test_default_event_loop(self):%0A        asyncio.set_event_loop(self.loop)%0A%0A        conn = yield from self.connect(no_loop=True)%0A        cur = yield from conn.cursor()%0A        self.assertIsInstance(cur, Cursor)%0A        yield from cur.execute('SELECT 1')%0A        (ret, ) = yield from cur.fetchone()%0A        self.assertEqual(1, ret)%0A        self.assertIs(conn._loop, self.loop)%0A%0A    @run_until_complete%0A    def test_close_twice(self):%0A        conn = yield from self.connect()%0A        yield from conn.close()%0A        yield from conn.close()%0A        self.assertTrue(conn.closed)%0A
 %0A

add two more tests for connection