# Path: animanager/sqlite/utils.py
# def _sqlpformat(name):
# def upsert(db, table, key_cols, update_dict):


import unittest
from apsw import Connection
from animanager.sqlite import utils
        self.assertEqual((2, 'Ion', 'Preciel'), cur.fetchone())

    def test_upsert_update(self):
        utils.upsert(self.db, 'mytable', ['id'], {
            'id': 1,
            'lastname': 'Teiwaz',
        })
        cur = self.db.cursor()
        cur.execute('SELECT * FROM mytable')
        self.assertEqual((1, 'Mir', 'Teiwaz'), cur.fetchone())


class MultipleKeyTestCase(unittest.TestCase):

    def setUp(self):
        self.db = Connection(':memory:')
        cur = self.db.cursor()
        cur.execute("""
        CREATE TABLE mytable (
            firstname TEXT,
            lastname TEXT,
            age INTEGER
        )""")
        cur.execute("""
        INSERT INTO mytable (firstname, lastname, age)
        VALUES
        ('Mir', 'Jakuri', 10)
        """)

    def test_upsert_multiple_key_insert(self):

# Path: animanager/sqlite/utils.py
# def _sqlpformat(name):
# def upsert(db, table, key_cols, update_dict):


# Path: tests/sqlite/test_utils.py
import unittest
from apsw import Connection
from animanager.sqlite import utils

        self.assertEqual((2, 'Ion', 'Preciel'), cur.fetchone())

    def test_upsert_update(self):
        utils.upsert(self.db, 'mytable', ['id'], {
            'id': 1,
            'lastname': 'Teiwaz',
        })
        cur = self.db.cursor()
        cur.execute('SELECT * FROM mytable')
        self.assertEqual((1, 'Mir', 'Teiwaz'), cur.fetchone())


class MultipleKeyTestCase(unittest.TestCase):

    def setUp(self):
        self.db = Connection(':memory:')
        cur = self.db.cursor()
        cur.execute("""
        CREATE TABLE mytable (
            firstname TEXT,
            lastname TEXT,
            age INTEGER
        )""")
        cur.execute("""
        INSERT INTO mytable (firstname, lastname, age)
        VALUES
        ('Mir', 'Jakuri', 10)
        """)

    def test_upsert_multiple_key_insert(self):

        utils.upsert(self.db, 'mytable', ['firstname', 'lastname'], {