Skip to content

Commit

Permalink
tests: clean up some formatting, ensure system compatibillity
Browse files Browse the repository at this point in the history
  • Loading branch information
niall-byrne committed Nov 22, 2019
1 parent 905ad4a commit d353968
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 45 deletions.
8 changes: 4 additions & 4 deletions tests/test_deduce_swagger_type.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import sys

import pytest
from flask_restful import fields

Expand All @@ -11,7 +13,7 @@
("Simple False", False, {"type": "boolean"}),
("Simple True", True, {"type": "boolean"}),
("Integer", 1, {"type": "integer"}),
("Very large integer", 9223372036854775807, {"type": "integer"}),
("Very large integer", sys.maxsize, {"type": "integer"}),
("Float less than 1", 0.8092, {"type": "number"}),
("Float greater than 1", 98763.09, {"type": "number"}),
("String", "helloWorld!", {"type": "string"}),
Expand All @@ -36,7 +38,6 @@ def test_deduce_swagger_type_flask_field(field_type, expected):
assert swagger.deduce_swagger_type(new_field) == expected


# Objects that are subclasses
@pytest.mark.parametrize(
"case_name, object_type, expected",
[
Expand All @@ -53,7 +54,6 @@ class NewSubClass(object_type):
assert swagger.deduce_swagger_type(new_instance) == expected


# Objects that are subclasses
@pytest.mark.parametrize(
"case_name, object_type, expected",
[
Expand All @@ -70,7 +70,7 @@ class NewSubClass(object_type):
assert swagger.deduce_swagger_type(NewSubClass) == expected


def test_deduce_swagger_type_fields_FormattedString():
def test_deduce_swagger_type_fields_formatted_string():
new_instance = fields.FormattedString("Hello {name}")

assert swagger.deduce_swagger_type(new_instance) == {"type": "string"}
Expand Down
31 changes: 0 additions & 31 deletions tests/test_deduce_swagger_type_flat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,6 @@

from flask_restful_swagger import swagger

"""
the "predicate" in the function determines whether
the argument is a class or an instance chooses whether to apply
"issubclass" or "isinstance" to the remaining conditions
Cases
Argument 1:
String
integer
float
boolean
date-time
child class of each of those
Argument 2:
blank
None
Something
"""

# Instances of types


@pytest.mark.parametrize(
"case_name, test_input, expected",
Expand All @@ -47,9 +21,6 @@ def test_deduce_swagger_type_flat_instances(case_name, test_input, expected):
assert swagger.deduce_swagger_type_flat(test_input) == expected


# instances of fields from flask


@pytest.mark.parametrize(
"field_type, expected",
[
Expand All @@ -65,7 +36,6 @@ def test_deduce_swagger_type_flat_flask_field(field_type, expected):
assert swagger.deduce_swagger_type_flat(new_field) == expected


# Objects that are subclasses
@pytest.mark.parametrize(
"case_name, object_type, expected",
[
Expand All @@ -85,7 +55,6 @@ class NewSubClass(object_type):


def test_deduce_swagger_type_flat_with_nested_object():
# new_object = fields.Nested({})
assert swagger.deduce_swagger_type_flat("anything", "cookies") == "cookies"


Expand Down
10 changes: 0 additions & 10 deletions tests/test_extract_swagger_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@
from flask_restful_swagger import swagger


"""
Docstring from extract_swagger_path:
Extracts a swagger type path from the given flask style path.
This /path/<parameter> turns into this /path/{parameter}
And this /<string(length=2):lang_code>/<string:id>/<float:probability>
to this: /{lang_code}/{id}/{probability}
"""


@pytest.mark.parametrize(
"case_name, test_input, expected",
[
Expand Down

0 comments on commit d353968

Please sign in to comment.