mirror of
https://github.com/hanzoai/datastore-orm.git
synced 2026-09-30 21:40:30 +00:00
This is our fork, so it should read like it. `import datastore_orm` instead of `from infi.clickhouse_orm import ...`: `infi` was the original vendor's org namespace, and carrying someone else's org name through every import in the consuming codebase is not a fork, it is a vendored copy that never got renamed. The `infi` namespace package is gone entirely (src/infi/__init__.py with it), the distribution is `datastore-orm`, and the metadata points at Hanzo rather than at the upstream repo and author. NOT renamed, deliberately: the migration history tables are still `infi_clickhouse_orm_migrations`. That name is persisted state — 448 rows in production key off it — so changing it is a data migration, not a rename. Doing it carelessly reproduces the exact failure this fork just hit, where a package rename orphaned the history and silently blocked every migration.
27 lines
691 B
Python
27 lines
691 B
Python
# -*- coding: utf-8 -*-
|
|
import unittest
|
|
|
|
from datastore_orm.models import BufferModel
|
|
from datastore_orm.engines import *
|
|
from .base_test_with_data import *
|
|
|
|
|
|
class BufferTestCase(TestCaseWithData):
|
|
|
|
def _insert_and_check_buffer(self, data, count):
|
|
self.database.insert(data)
|
|
self.assertEqual(count, self.database.count(PersonBuffer))
|
|
|
|
def _sample_buffer_data(self):
|
|
for entry in data:
|
|
yield PersonBuffer(**entry)
|
|
|
|
def test_insert_buffer(self):
|
|
self.database.create_table(PersonBuffer)
|
|
self._insert_and_check_buffer(self._sample_buffer_data(), len(data))
|
|
|
|
|
|
class PersonBuffer(BufferModel, Person):
|
|
|
|
engine = Buffer(Person)
|