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.
32 lines
1.5 KiB
Python
32 lines
1.5 KiB
Python
import unittest
|
|
|
|
from datastore_orm.database import ServerError
|
|
|
|
|
|
class ServerErrorTest(unittest.TestCase):
|
|
|
|
def test_old_format(self):
|
|
|
|
code, msg = ServerError.get_error_code_msg("Code: 81, e.displayText() = DB::Exception: Database db_not_here doesn't exist, e.what() = DB::Exception (from [::1]:33458)")
|
|
self.assertEqual(code, 81)
|
|
self.assertEqual(msg, "Database db_not_here doesn't exist")
|
|
|
|
code, msg = ServerError.get_error_code_msg("Code: 161, e.displayText() = DB::Exception: Limit for number of columns to read exceeded. Requested: 11, maximum: 1, e.what() = DB::Exception\n")
|
|
self.assertEqual(code, 161)
|
|
self.assertEqual(msg, "Limit for number of columns to read exceeded. Requested: 11, maximum: 1")
|
|
|
|
|
|
def test_new_format(self):
|
|
|
|
code, msg = ServerError.get_error_code_msg("Code: 164, e.displayText() = DB::Exception: Cannot drop table in readonly mode")
|
|
self.assertEqual(code, 164)
|
|
self.assertEqual(msg, "Cannot drop table in readonly mode")
|
|
|
|
code, msg = ServerError.get_error_code_msg("Code: 48, e.displayText() = DB::Exception: Method write is not supported by storage Merge")
|
|
self.assertEqual(code, 48)
|
|
self.assertEqual(msg, "Method write is not supported by storage Merge")
|
|
|
|
code, msg = ServerError.get_error_code_msg("Code: 60, e.displayText() = DB::Exception: Table default.zuzu doesn't exist.\n")
|
|
self.assertEqual(code, 60)
|
|
self.assertEqual(msg, "Table default.zuzu doesn't exist.")
|