1+ import sys
12from flask_parameter_validation .docs_blueprint import get_route_docs
23
34def test_http_ok (client ):
45 r = client .get ("/docs/" )
56 assert r .status_code == 200
67 r = client .get ("/docs/json" )
78 assert r .status_code == 200
8-
9+ import sys
910def test_routes_added (app ):
1011 routes = []
1112 for rule in app .url_map .iter_rules ():
@@ -20,18 +21,19 @@ def test_doc_types_of_default(app):
2021 "query" : "Query" ,
2122 "route" : "Route"
2223 }
24+ optional_as_str = "Optional" if sys .version_info >= (3 ,10 ) else "Union"
2325 types = {
24- "bool" : {"opt" : "Optional [bool, NoneType]" , "n_opt" : "bool" },
25- "date" : {"opt" : "Optional [date, NoneType]" , "n_opt" : "date" },
26- "datetime" : {"opt" : "Optional [datetime, NoneType]" , "n_opt" : "datetime" },
27- "dict" : {"opt" : "Optional [dict, NoneType]" , "n_opt" : "dict" },
28- "float" : {"opt" : "Optional [float, NoneType]" , "n_opt" : "float" },
29- "int" : {"opt" : "Optional [int, NoneType]" , "n_opt" : "int" },
30- "int_enum" : {"opt" : "Optional [Binary, NoneType]" , "n_opt" : "Binary" },
31- "list" : {"opt" : "Optional [List[int], NoneType]" , "n_opt" : "List[str]" },
32- "str" : {"opt" : "Optional [str, NoneType]" , "n_opt" : "str" },
33- "str_enum" : {"opt" : "Optional [Fruits, NoneType]" , "n_opt" : "Fruits" },
34- "time" : {"opt" : "Optional [time, NoneType]" , "n_opt" : "time" },
26+ "bool" : {"opt" : f" { optional_as_str } [bool, NoneType]" , "n_opt" : "bool" },
27+ "date" : {"opt" : f" { optional_as_str } [date, NoneType]" , "n_opt" : "date" },
28+ "datetime" : {"opt" : f" { optional_as_str } [datetime, NoneType]" , "n_opt" : "datetime" },
29+ "dict" : {"opt" : f" { optional_as_str } [dict, NoneType]" , "n_opt" : "dict" },
30+ "float" : {"opt" : f" { optional_as_str } [float, NoneType]" , "n_opt" : "float" },
31+ "int" : {"opt" : f" { optional_as_str } [int, NoneType]" , "n_opt" : "int" },
32+ "int_enum" : {"opt" : f" { optional_as_str } [Binary, NoneType]" , "n_opt" : "Binary" },
33+ "list" : {"opt" : f" { optional_as_str } [List[int], NoneType]" , "n_opt" : "List[str]" },
34+ "str" : {"opt" : f" { optional_as_str } [str, NoneType]" , "n_opt" : "str" },
35+ "str_enum" : {"opt" : f" { optional_as_str } [Fruits, NoneType]" , "n_opt" : "Fruits" },
36+ "time" : {"opt" : f" { optional_as_str } [time, NoneType]" , "n_opt" : "time" },
3537 "union" : {"opt" : "Union[bool, int, NoneType]" , "n_opt" : "Union[bool, int]" }
3638 }
3739 route_unsupported_types = ["dict" , "list" ]
0 commit comments