| 1 |
from functools import partial |
| 2 |
|
| 3 |
from ..utils import isort_test |
| 4 |
|
| 5 |
hug_isort_test = partial(isort_test, profile="hug", known_first_party=["hug"]) |
| 6 |
|
| 7 |
|
| 8 |
def test_hug_code_snippet_one() -> None: |
| 9 |
hug_isort_test( |
| 10 |
''' |
| 11 |
from __future__ import absolute_import |
| 12 |
|
| 13 |
import asyncio |
| 14 |
import sys |
| 15 |
from collections import OrderedDict, namedtuple |
| 16 |
from distutils.util import strtobool |
| 17 |
from functools import partial |
| 18 |
from itertools import chain |
| 19 |
from types import ModuleType |
| 20 |
from wsgiref.simple_server import make_server |
| 21 |
|
| 22 |
import falcon |
| 23 |
from falcon import HTTP_METHODS |
| 24 |
|
| 25 |
import hug.defaults |
| 26 |
import hug.output_format |
| 27 |
from hug import introspect |
| 28 |
from hug._version import current |
| 29 |
|
| 30 |
INTRO = """ |
| 31 |
/#######################################################################\\ |
| 32 |
`.----``..-------..``.----. |
| 33 |
:/:::::--:---------:--::::://. |
| 34 |
.+::::----##/-/oo+:-##----::::// |
| 35 |
`//::-------/oosoo-------::://. ## ## ## ## ##### |
| 36 |
.-:------./++o/o-.------::-` ``` ## ## ## ## ## |
| 37 |
`----.-./+o+:..----. `.:///. ######## ## ## ## |
| 38 |
``` `----.-::::::------ `.-:::://. ## ## ## ## ## #### |
| 39 |
://::--.``` -:``...-----...` `:--::::::-.` ## ## ## ## ## ## |
| 40 |
:/:::::::::-:- ````` .:::::-.` ## ## #### ###### |
| 41 |
``.--:::::::. .:::.` |
| 42 |
``..::. .:: EMBRACE THE APIs OF THE FUTURE |
| 43 |
::- .:- |
| 44 |
-::` ::- VERSION {0} |
| 45 |
`::- -::` |
| 46 |
-::-` -::- |
| 47 |
\\########################################################################/ |
| 48 |
Copyright (C) 2016 Timothy Edmund Crosley |
| 49 |
Under the MIT License |
| 50 |
""".format( |
| 51 |
current |
| 52 |
)''' |
| 53 |
) |
| 54 |
|
| 55 |
|
| 56 |
def test_hug_code_snippet_two() -> None: |
| 57 |
hug_isort_test( |
| 58 |
"""from __future__ import absolute_import |
| 59 |
|
| 60 |
import functools |
| 61 |
from collections import namedtuple |
| 62 |
|
| 63 |
from falcon import HTTP_METHODS |
| 64 |
|
| 65 |
import hug.api |
| 66 |
import hug.defaults |
| 67 |
import hug.output_format |
| 68 |
from hug import introspect |
| 69 |
from hug.format import underscore |
| 70 |
|
| 71 |
|
| 72 |
def default_output_format( |
| 73 |
content_type="application/json", apply_globally=False, api=None, cli=False, http=True |
| 74 |
): |
| 75 |
""" |
| 76 |
) |
| 77 |
|
| 78 |
|
| 79 |
def test_hug_code_snippet_three() -> None: |
| 80 |
hug_isort_test( |
| 81 |
"""from __future__ import absolute_import |
| 82 |
|
| 83 |
import argparse |
| 84 |
import asyncio |
| 85 |
import os |
| 86 |
import sys |
| 87 |
from collections import OrderedDict |
| 88 |
from functools import lru_cache, partial, wraps |
| 89 |
|
| 90 |
import falcon |
| 91 |
from falcon import HTTP_BAD_REQUEST |
| 92 |
|
| 93 |
import hug._empty as empty |
| 94 |
import hug.api |
| 95 |
import hug.output_format |
| 96 |
import hug.types as types |
| 97 |
from hug import introspect |
| 98 |
from hug.exceptions import InvalidTypeData |
| 99 |
from hug.format import parse_content_type |
| 100 |
from hug.types import ( |
| 101 |
MarshmallowInputSchema, |
| 102 |
MarshmallowReturnSchema, |
| 103 |
Multiple, |
| 104 |
OneOf, |
| 105 |
SmartBoolean, |
| 106 |
Text, |
| 107 |
text, |
| 108 |
) |
| 109 |
|
| 110 |
DOC_TYPE_MAP = {str: "String", bool: "Boolean", list: "Multiple", int: "Integer", float: "Float"} |
| 111 |
""" |
| 112 |
) |