Skip to content

Instantly share code, notes, and snippets.

View fracaron's full-sized avatar

Francis Caron fracaron

  • Québec, Canada
View GitHub Profile
@fracaron
fracaron / test_abstracts.py
Last active March 1, 2021 12:44
Base class for tests of abstract models.
from typing import Type
from django.db import connection, models
from django.test import TestCase
from django.test.utils import isolate_apps
@isolate_apps(__name__)
class AbstractModelMixinTestCase(TestCase):
"""
Base class for tests of abstract models.
@fracaron
fracaron / BatchSelect.kt
Created September 12, 2019 21:29 — forked from ps-feng/BatchSelect.kt
Batch select in Exposed, inspired by Rails' find_in_batches
package org.jetbrains.exposed.sql
import org.jetbrains.exposed.dao.EntityID
import org.jetbrains.exposed.sql.FieldSet
import org.jetbrains.exposed.sql.Op
import org.jetbrains.exposed.sql.ResultRow
import org.jetbrains.exposed.sql.SortOrder
import org.jetbrains.exposed.sql.SqlExpressionBuilder
import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.sql.isAutoInc