11from datetime import date
2+ from typing import Any
23
34import numpy as np
45import pandas as pd
1516)
1617
1718
19+ # Set the type to `Any` to disable mypy type checking. Used to test if functions
20+ # will raise a `TypeError` when passed an incorrectly-typed argument.
21+ INCORRECT_TYPE : Any = type
22+
23+
1824class TestParsing :
1925 def test_enum_or_str_lowercase_given_none_raises_type_error (self ) -> None :
2026 # Arrange, Act, Assert
@@ -24,7 +30,7 @@ def test_enum_or_str_lowercase_given_none_raises_type_error(self) -> None:
2430 def test_enum_or_str_lowercase_given_incorrect_type_raises_type_error (self ) -> None :
2531 # Arrange, Act, Assert
2632 with pytest .raises (TypeError ):
27- enum_or_str_lowercase (type , "param" )
33+ enum_or_str_lowercase (INCORRECT_TYPE , "param" )
2834
2935 @pytest .mark .parametrize (
3036 "value, expected" ,
@@ -45,7 +51,7 @@ def test_maybe_enum_or_str_lowercase_given_incorrect_types_raises_error(
4551 ) -> None :
4652 # Arrange, Act, Assert
4753 with pytest .raises (TypeError ):
48- maybe_enum_or_str_lowercase (type , "param" )
54+ maybe_enum_or_str_lowercase (INCORRECT_TYPE , "param" )
4955
5056 @pytest .mark .parametrize (
5157 "value, expected" ,
@@ -67,7 +73,7 @@ def test_maybe_values_list_to_string_given_invalid_input_raises_type_error(
6773 ) -> None :
6874 # Arrange, Act, Assert
6975 with pytest .raises (TypeError ):
70- maybe_values_list_to_string (type )
76+ maybe_values_list_to_string (INCORRECT_TYPE )
7177
7278 @pytest .mark .parametrize (
7379 "values, expected" ,
@@ -96,7 +102,7 @@ def test_maybe_symbols_list_to_string_given_invalid_input_raises_type_error(
96102 ) -> None :
97103 # Arrange, Act, Assert
98104 with pytest .raises (TypeError ):
99- maybe_symbols_list_to_string (type )
105+ maybe_symbols_list_to_string (INCORRECT_TYPE )
100106
101107 @pytest .mark .parametrize (
102108 "symbols, expected" ,
0 commit comments