-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
90eba6b
commit c73de92
Showing
5 changed files
with
64 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,37 @@ | ||
from backports.httpmethod import HTTPMethod | ||
|
||
|
||
def test_equals_string(): | ||
assert HTTPMethod.GET == "GET" | ||
|
||
import sys | ||
import unittest | ||
|
||
def test_value(): | ||
assert HTTPMethod.GET.value == "GET" | ||
|
||
|
||
def test_description(): | ||
assert HTTPMethod.GET.description == "Retrieve the target." | ||
from backports.httpmethod import HTTPMethod | ||
|
||
|
||
def test_available_methods(): | ||
assert list(HTTPMethod) == [ | ||
HTTPMethod.CONNECT, | ||
HTTPMethod.DELETE, | ||
HTTPMethod.GET, | ||
HTTPMethod.HEAD, | ||
HTTPMethod.OPTIONS, | ||
HTTPMethod.PATCH, | ||
HTTPMethod.POST, | ||
HTTPMethod.PUT, | ||
HTTPMethod.TRACE, | ||
] | ||
class TestHTTPMethod(unittest.TestCase): | ||
def test_equals_string(self): | ||
self.assertEqual(HTTPMethod.GET, "GET") | ||
|
||
def test_value(self): | ||
self.assertEqual(HTTPMethod.GET.value, "GET") | ||
|
||
def test_description(self): | ||
self.assertEqual(HTTPMethod.GET.description, "Retrieve the target.") | ||
|
||
def test_available_methods(self): | ||
self.assertListEqual( | ||
list(HTTPMethod), | ||
[ | ||
HTTPMethod.CONNECT, | ||
HTTPMethod.DELETE, | ||
HTTPMethod.GET, | ||
HTTPMethod.HEAD, | ||
HTTPMethod.OPTIONS, | ||
HTTPMethod.PATCH, | ||
HTTPMethod.POST, | ||
HTTPMethod.PUT, | ||
HTTPMethod.TRACE, | ||
], | ||
) | ||
|
||
@unittest.skipIf(sys.version_info < (3, 11), "requires Python 3.11+") | ||
def test_equality(self): | ||
from http import HTTPMethod as PyHTTPMethod # noqa: PLC0415 | ||
|
||
self.assertDictEqual(HTTPMethod.__members__, PyHTTPMethod.__members__) |