1 Star 0 Fork 6

ZoeDong/python-django

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
15168.patch 1.62 KB
一键复制 编辑 原始数据 按行查看 历史
From 402ed030933ffa1af74db50f737872d48f0152bb Mon Sep 17 00:00:00 2001
From: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Date: Thu, 9 Dec 2021 13:21:36 +0100
Subject: [PATCH] Fixed inspectdb.tests.InspectDBTestCase.test_custom_fields()
on SQLite 3.37+.
Use FlexibleFieldLookupDict which is case-insensitive mapping because
SQLite 3.37+ returns some data type names uppercased e.g. TEXT.
---
tests/inspectdb/tests.py | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/tests/inspectdb/tests.py b/tests/inspectdb/tests.py
index 1deffff14047e..20da7ade4d512 100644
--- a/tests/inspectdb/tests.py
+++ b/tests/inspectdb/tests.py
@@ -312,18 +312,17 @@ def test_custom_fields(self):
Introspection of columns with a custom field (#21090)
"""
out = StringIO()
- orig_data_types_reverse = connection.introspection.data_types_reverse
- try:
- connection.introspection.data_types_reverse = {
+ with mock.patch(
+ 'django.db.connection.introspection.data_types_reverse.base_data_types_reverse',
+ {
'text': 'myfields.TextField',
'bigint': 'BigIntegerField',
- }
+ },
+ ):
call_command('inspectdb', 'inspectdb_columntypes', stdout=out)
output = out.getvalue()
self.assertIn("text_field = myfields.TextField()", output)
self.assertIn("big_int_field = models.BigIntegerField()", output)
- finally:
- connection.introspection.data_types_reverse = orig_data_types_reverse
def test_introspection_errors(self):
"""
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ZoeDong/python-django.git
git@gitee.com:ZoeDong/python-django.git
ZoeDong
python-django
python-django
master

搜索帮助