File: test_registered_response.py

package info (click to toggle)
python-globus-sdk 4.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,172 kB
  • sloc: python: 35,227; sh: 44; makefile: 35
file content (20 lines) | stat: -rw-r--r-- 579 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import http
import sys
import typing as t

import pytest

from globus_sdk.testing import RegisteredResponse


@pytest.mark.skipif(
    sys.version_info < (3, 11), reason="test requires http.HTTPMethod (Python 3.11+)"
)
def test_registered_response_method_literal_type_is_correct():
    all_known_methods = [m.value for m in http.HTTPMethod]
    init_signature = t.get_type_hints(RegisteredResponse.__init__)

    method_arg_type = init_signature["method"]
    expected_method_arg_type = t.Literal[tuple(all_known_methods)]

    assert method_arg_type == expected_method_arg_type