-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_01_model_base.txt
More file actions
191 lines (171 loc) · 8.61 KB
/
Copy pathtest_01_model_base.txt
File metadata and controls
191 lines (171 loc) · 8.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
===== RELATÓRIO DO ARQUIVO: test_01_model_base.py =====
===== RESUMO DO TESTE =====
Testes passados: 0
Testes falhados: 1
Erros estruturais (pytest): 0
Warnings: 0
===== TIPOS DE ERROS PYTHON =====
• TypeError: SQLite Date type only accepts Python date objects as input.
• StatementError: (builtins.TypeError) SQLite Date type only accepts Python date objects as input.
===== DETALHES DOS ERROS (TRACEBACKS) =====
Nenhum traceback encontrado.
===== SAÍDA COMPLETA DO PYTEST =====
F [100%]
===================================================================== FAILURES ======================================================================
________________________________________________________________ test_criar_usuario _________________________________________________________________
self = <
Connection|
dialect = sqlite|
driver = pysqlite|
engine = sqlite:///:memory: |
in_transaction=False
>
dialect = <Dialect
name=sqlite
driver=pysqlite
supports_native_boolean=False
supports_sane_rowcount=True
supports_sane_multi_rowcount=True
>
constructor = <bound method DefaultExecutionContext._init_compiled of <class 'sqlalchemy.dialects.sqlite.base.SQLiteExecutionContext'>>
statement = <sqlalchemy.dialects.sqlite.base.SQLiteCompiler object at 0x0000028B6F0F97F0>
parameters = [{'data_nascimento': '1990-01-01', 'email': 'daniel@gmail.com', 'nome': 'Daniel', 'senha_hash': 'abc123'}]
execution_options = immutabledict({'compiled_cache': <sqlalchemy.util._collections.LRUCache object at 0x0000028B6F10C8B0>})
args = (<sqlalchemy.dialects.sqlite.base.SQLiteCompiler object at 0x0000028B6F0F97F0>, [{'data_nascimento': '1990-01-01', 'em...l@gmail.com', 'nome': 'Daniel', 'senha_hash': 'abc123'}], <sqlalchemy.sql.dml.Insert object at 0x0000028B6F0F96A0>, [])
kw = {'cache_hit': <CacheStats.CACHE_MISS: 1>}, yp = None, conn = <sqlalchemy.pool.base._ConnectionFairy object at 0x0000028B6F0C9730>
def _execute_context(
self,
dialect: Dialect,
constructor: Callable[..., ExecutionContext],
statement: Union[str, Compiled],
parameters: Optional[_AnyMultiExecuteParams],
execution_options: _ExecuteOptions,
*args: Any,
**kw: Any,
) -> CursorResult[Any]:
"""Create an :class:`.ExecutionContext` and execute, returning
a :class:`_engine.CursorResult`."""
if execution_options:
yp = execution_options.get("yield_per", None)
if yp:
execution_options = execution_options.union(
{"stream_results": True, "max_row_buffer": yp}
)
try:
conn = self._dbapi_connection
if conn is None:
conn = self._revalidate_connection()
> context = constructor(
dialect, self, conn, execution_options, *args, **kw
)
..\..\miniconda3\Lib\site-packages\sqlalchemy\engine\base.py:1815:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
..\..\miniconda3\Lib\site-packages\sqlalchemy\engine\default.py:1496: in _init_compiled
flattened_processors[key](compiled_params[key])
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value = '1990-01-01'
def process(value):
if value is None:
return None
elif isinstance(value, datetime_date):
return format_ % {
"year": value.year,
"month": value.month,
"day": value.day,
}
else:
> raise TypeError(
"SQLite Date type only accepts Python "
"date objects as input."
)
E TypeError: SQLite Date type only accepts Python date objects as input.
..\..\miniconda3\Lib\site-packages\sqlalchemy\dialects\sqlite\base.py:1287: TypeError
The above exception was the direct cause of the following exception:
session = <Session bind=Engine(sqlite:///:memory:) | dirty(modified)=[] |
new(newly added)=[] |
deleted=[] |
identity_count=0 |
objects=[]
>
def test_criar_usuario(session):
from src.models import Usuario
u = Usuario(
nome = "Daniel",
email = "daniel@gmail.com",
senha_hash = "abc123",
data_nascimento = "1990-01-01"
)
session.add(u)
> session.commit()
formacao_python-developer_dio\SQL_Alchemy\Desafio\projeto\Testes_Fase_1\test_01_model_base.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
..\..\miniconda3\Lib\site-packages\sqlalchemy\orm\session.py:2030: in commit
trans.commit(_to_root=True)
<string>:2: in commit
???
..\..\miniconda3\Lib\site-packages\sqlalchemy\orm\state_changes.py:137: in _go
ret_value = fn(self, *arg, **kw)
^^^^^^^^^^^^^^^^^^^^
..\..\miniconda3\Lib\site-packages\sqlalchemy\orm\session.py:1311: in commit
self._prepare_impl()
<string>:2: in _prepare_impl
???
..\..\miniconda3\Lib\site-packages\sqlalchemy\orm\state_changes.py:137: in _go
ret_value = fn(self, *arg, **kw)
^^^^^^^^^^^^^^^^^^^^
..\..\miniconda3\Lib\site-packages\sqlalchemy\orm\session.py:1286: in _prepare_impl
self.session.flush()
..\..\miniconda3\Lib\site-packages\sqlalchemy\orm\session.py:4331: in flush
self._flush(objects)
..\..\miniconda3\Lib\site-packages\sqlalchemy\orm\session.py:4466: in _flush
with util.safe_reraise():
^^^^^^^^^^^^^^^^^^^
..\..\miniconda3\Lib\site-packages\sqlalchemy\util\langhelpers.py:224: in __exit__
raise exc_value.with_traceback(exc_tb)
..\..\miniconda3\Lib\site-packages\sqlalchemy\orm\session.py:4427: in _flush
flush_context.execute()
..\..\miniconda3\Lib\site-packages\sqlalchemy\orm\unitofwork.py:466: in execute
rec.execute(self)
..\..\miniconda3\Lib\site-packages\sqlalchemy\orm\unitofwork.py:642: in execute
util.preloaded.orm_persistence.save_obj(
..\..\miniconda3\Lib\site-packages\sqlalchemy\orm\persistence.py:93: in save_obj
_emit_insert_statements(
..\..\miniconda3\Lib\site-packages\sqlalchemy\orm\persistence.py:1233: in _emit_insert_statements
result = connection.execute(
..\..\miniconda3\Lib\site-packages\sqlalchemy\engine\base.py:1419: in execute
return meth(
..\..\miniconda3\Lib\site-packages\sqlalchemy\sql\elements.py:527: in _execute_on_connection
return connection._execute_clauseelement(
..\..\miniconda3\Lib\site-packages\sqlalchemy\engine\base.py:1641: in _execute_clauseelement
ret = self._execute_context(
..\..\miniconda3\Lib\site-packages\sqlalchemy\engine\base.py:1821: in _execute_context
self._handle_dbapi_exception(
..\..\miniconda3\Lib\site-packages\sqlalchemy\engine\base.py:2363: in _handle_dbapi_exception
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
..\..\miniconda3\Lib\site-packages\sqlalchemy\engine\base.py:1815: in _execute_context
context = constructor(
..\..\miniconda3\Lib\site-packages\sqlalchemy\engine\default.py:1496: in _init_compiled
flattened_processors[key](compiled_params[key])
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
value = '1990-01-01'
def process(value):
if value is None:
return None
elif isinstance(value, datetime_date):
return format_ % {
"year": value.year,
"month": value.month,
"day": value.day,
}
else:
> raise TypeError(
"SQLite Date type only accepts Python "
"date objects as input."
)
E sqlalchemy.exc.StatementError: (builtins.TypeError) SQLite Date type only accepts Python date objects as input.
E [SQL: INSERT INTO usuarios (nome, email, senha_hash, data_nascimento) VALUES (?, ?, ?, ?)]
E [parameters: [{'senha_hash': 'abc123', 'nome': 'Daniel', 'email': 'daniel@gmail.com', 'data_nascimento': '1990-01-01'}]]
..\..\miniconda3\Lib\site-packages\sqlalchemy\dialects\sqlite\base.py:1287: StatementError
============================================================== short test summary info ==============================================================
FAILED formacao_python-developer_dio/SQL_Alchemy/Desafio/projeto/Testes_Fase_1/test_01_model_base.py::test_criar_usuario - sqlalchemy.exc.Statement...
1 failed in 1.75s