|
1 | 1 | import json
|
2 | 2 | from dataclasses import dataclass
|
3 |
| -from decimal import Decimal |
4 | 3 | from enum import Enum
|
5 | 4 | from pathlib import PurePath
|
6 | 5 | from typing import Tuple
|
@@ -128,46 +127,6 @@ def handler() -> Tuple:
|
128 | 127 | assert result["body"] == list(sample_tuple)
|
129 | 128 |
|
130 | 129 |
|
131 |
| -def test_validate_return_decimal_as_int(): |
132 |
| - # GIVEN an APIGatewayRestResolver with validation enabled |
133 |
| - app = APIGatewayRestResolver(enable_validation=True) |
134 |
| - |
135 |
| - sample_decimal = Decimal(10) |
136 |
| - |
137 |
| - # WHEN a handler is defined with a return type as Decimal |
138 |
| - @app.get("/") |
139 |
| - def handler() -> Decimal: |
140 |
| - return sample_decimal |
141 |
| - |
142 |
| - LOAD_GW_EVENT["path"] = "/" |
143 |
| - |
144 |
| - # THEN the handler should be invoked and return 200 |
145 |
| - # THEN the body must be a decimal as int |
146 |
| - result = app(LOAD_GW_EVENT, {}) |
147 |
| - assert result["statusCode"] == 200 |
148 |
| - assert result["body"] == 10 |
149 |
| - |
150 |
| - |
151 |
| -def test_validate_return_decimal_as_float(): |
152 |
| - # GIVEN an APIGatewayRestResolver with validation enabled |
153 |
| - app = APIGatewayRestResolver(enable_validation=True) |
154 |
| - |
155 |
| - sample_decimal = Decimal(10.22) |
156 |
| - |
157 |
| - # WHEN a handler is defined with a return type as Decimal |
158 |
| - @app.get("/") |
159 |
| - def handler() -> Decimal: |
160 |
| - return sample_decimal |
161 |
| - |
162 |
| - LOAD_GW_EVENT["path"] = "/" |
163 |
| - |
164 |
| - # THEN the handler should be invoked and return 200 |
165 |
| - # THEN the body must be a decimal as float |
166 |
| - result = app(LOAD_GW_EVENT, {}) |
167 |
| - assert result["statusCode"] == 200 |
168 |
| - assert result["body"] == 10.22 |
169 |
| - |
170 |
| - |
171 | 130 | def test_validate_return_purepath():
|
172 | 131 | # GIVEN an APIGatewayRestResolver with validation enabled
|
173 | 132 | app = APIGatewayRestResolver(enable_validation=True)
|
|
0 commit comments