Pandas: Fix mypy errors for pandas\tests\*

Created on 11 Oct 2019  Â·  21Comments  Â·  Source: pandas-dev/pandas

For a full list, expand details.

pandas\tests\tseries\offsets\test_offsets_properties.py:54: error: Argument "min_value" to "datetimes" has incompatible type "Tuple[Any]"; expected "datetime"
pandas\tests\tseries\offsets\test_offsets_properties.py:54: error: Argument "max_value" to "datetimes" has incompatible type "Tuple[Any]"; expected "datetime"
pandas\tests\io\parser\conftest.py:11: error: Need type annotation for 'float_precision_choices' (hint: "float_precision_choices: List[<type>] = ...")
pandas\tests\io\parser\conftest.py:29: error: Incompatible types in assignment (expression has type "str", base class "BaseParser" defined the type as "None")
pandas\tests\io\parser\conftest.py:42: error: Incompatible types in assignment (expression has type "str", base class "BaseParser" defined the type as "None")
pandas\tests\io\parser\conftest.py:62: error: Unsupported operand types for + ("List[CParser]" and "List[PythonParser]")
pandas\tests\extension\json\array.py:30: error: Need type annotation for 'na_value'
pandas\conftest.py:11: error: Module 'pytz' has no attribute 'FixedOffset'
pandas\conftest.py:486: error: Unsupported operand types for + ("List[str]" and "List[object]")
pandas\conftest.py:500: error: Unsupported operand types for + ("List[object]" and "List[str]")
pandas\conftest.py:505: error: Unsupported operand types for + ("List[object]" and "List[str]")
pandas\conftest.py:506: error: Unsupported operand types for + ("List[object]" and "List[str]")
pandas\tests\test_base.py:1312: error: Argument "freq" to "period_array" has incompatible type "str"; expected "Optional[Tick]"
pandas\tests\test_base.py:1354: error: Argument "freq" to "period_array" has incompatible type "str"; expected "Optional[Tick]"
pandas\tests\test_algos.py:770: error: Invalid signature "def (self: Any) -> Any"
pandas\tests\tseries\offsets\test_offsets.py:662: error: Incompatible types in assignment (expression has type "Type[BusinessDay]", base class "Base" defined the type as "None")
pandas\tests\tseries\offsets\test_offsets.py:757: error: Argument 1 to "append" of "list" has incompatible type "Tuple[int, Dict[datetime, datetime]]"; expected "Tuple[BusinessDay, Dict[datetime, datetime]]"
pandas\tests\tseries\offsets\test_offsets.py:784: error: Argument 1 to "append" of "list" has incompatible type "Tuple[int, Dict[datetime, datetime]]"; expected "Tuple[BusinessDay, Dict[datetime, datetime]]"
pandas\tests\tseries\offsets\test_offsets.py:849: error: Incompatible types in assignment (expression has type "Type[BusinessHour]", base class "Base" defined the type as "None")
pandas\tests\tseries\offsets\test_offsets.py:2255: error: Incompatible types in assignment (expression has type "Type[CustomBusinessHour]", base class "Base" defined the type as "None")
pandas\tests\tseries\offsets\test_offsets.py:2547: error: Incompatible types in assignment (expression has type "Type[CustomBusinessDay]", base class "Base" defined the type as "None")
pandas\tests\tseries\offsets\test_offsets.py:2645: error: Argument 1 to "append" of "list" has incompatible type "Tuple[int, Dict[datetime, datetime]]"; expected "Tuple[CustomBusinessDay, Dict[datetime, datetime]]"
pandas\tests\tseries\offsets\test_offsets.py:2672: error: Argument 1 to "append" of "list" has incompatible type "Tuple[int, Dict[datetime, datetime]]"; expected "Tuple[CustomBusinessDay, Dict[datetime, datetime]]"
pandas\tests\tseries\offsets\test_offsets.py:2826: error: Incompatible types in assignment (expression has type "Type[CustomBusinessMonthEnd]", base class "Base" defined the type as "None")
pandas\tests\tseries\offsets\test_offsets.py:2889: error: Argument 1 to "append" of "list" has incompatible type "Tuple[int, Dict[datetime, datetime]]"; expected "Tuple[CustomBusinessMonthEnd, Dict[datetime, datetime]]"
pandas\tests\tseries\offsets\test_offsets.py:2909: error: Argument 1 to "append" of "list" has incompatible type "Tuple[int, Dict[datetime, datetime]]"; expected "Tuple[CustomBusinessMonthEnd, Dict[datetime, datetime]]"
pandas\tests\tseries\offsets\test_offsets.py:2975: error: Incompatible types in assignment (expression has type "Type[CustomBusinessMonthBegin]", base class "Base" defined the type as "None")
pandas\tests\tseries\offsets\test_offsets.py:3038: error: Argument 1 to "append" of "list" has incompatible type "Tuple[int, Dict[datetime, datetime]]"; expected "Tuple[CustomBusinessMonthBegin, Dict[datetime, datetime]]"
pandas\tests\tseries\offsets\test_offsets.py:3058: error: Argument 1 to "append" of "list" has incompatible type "Tuple[int, Dict[datetime, datetime]]"; expected "Tuple[CustomBusinessMonthBegin, Dict[datetime, datetime]]"
pandas\tests\tseries\offsets\test_offsets.py:3123: error: Incompatible types in assignment (expression has type "Type[Week]", base class "Base" defined the type as "None")
pandas\tests\tseries\offsets\test_offsets.py:3125: error: Cannot determine type of '_offset'
pandas\tests\tseries\offsets\test_offsets.py:3126: error: Cannot determine type of '_offset'
pandas\tests\tseries\offsets\test_offsets.py:3222: error: Incompatible types in assignment (expression has type "Type[WeekOfMonth]", base class "Base" defined the type as "None")
pandas\tests\tseries\offsets\test_offsets.py:3223: error: Cannot determine type of '_offset'
pandas\tests\tseries\offsets\test_offsets.py:3224: error: Cannot determine type of '_offset'
pandas\tests\tseries\offsets\test_offsets.py:3322: error: Incompatible types in assignment (expression has type "Type[LastWeekOfMonth]", base class "Base" defined the type as "None")
pandas\tests\tseries\offsets\test_offsets.py:3323: error: Cannot determine type of '_offset'
pandas\tests\tseries\offsets\test_offsets.py:3324: error: Cannot determine type of '_offset'
pandas\tests\tseries\offsets\test_offsets.py:3399: error: Incompatible types in assignment (expression has type "Type[SemiMonthEnd]", base class "Base" defined the type as "None")
pandas\tests\tseries\offsets\test_offsets.py:3400: error: Cannot determine type of '_offset'
pandas\tests\tseries\offsets\test_offsets.py:3401: error: Cannot determine type of '_offset'
pandas\tests\tseries\offsets\test_offsets.py:3658: error: Incompatible types in assignment (expression has type "Type[SemiMonthBegin]", base class "Base" defined the type as "None")
pandas\tests\tseries\offsets\test_offsets.py:3659: error: Cannot determine type of '_offset'
pandas\tests\tseries\offsets\test_offsets.py:3660: error: Cannot determine type of '_offset'
pandas\tests\series\test_constructors.py:48: error: Need type annotation for 'x'
pandas\tests\series\test_constructors.py:53: error: Need type annotation for 'x'
pandas\tests\plotting\test_backend.py:12: error: Module has no attribute "plot"
pandas\tests\io\test_sql.py:964: error: Incompatible types in assignment (expression has type "str", base class "_TestSQLApi" defined the type as "None")
pandas\tests\io\test_sql.py:1156: error: Incompatible types in assignment (expression has type "str", base class "_TestSQLApi" defined the type as "None")
pandas\tests\io\test_sql.py:2075: error: Definition of "flavor" in base class "_TestMySQLAlchemy" is incompatible with definition in base class "_TestSQLAlchemy"
pandas\tests\io\test_sql.py:2081: error: Definition of "flavor" in base class "_TestMySQLAlchemy" is incompatible with definition in base class "_TestSQLAlchemy"
pandas\tests\io\test_sql.py:2087: error: Definition of "flavor" in base class "_TestPostgreSQLAlchemy" is incompatible with definition in base class "_TestSQLAlchemy"
pandas\tests\io\test_sql.py:2093: error: Definition of "flavor" in base class "_TestPostgreSQLAlchemy" is incompatible with definition in base class "_TestSQLAlchemy"
pandas\tests\io\test_sql.py:2098: error: Definition of "flavor" in base class "_TestSQLiteAlchemy" is incompatible with definition in base class "_TestSQLAlchemy"
pandas\tests\io\test_sql.py:2103: error: Definition of "flavor" in base class "_TestSQLiteAlchemy" is incompatible with definition in base class "_TestSQLAlchemy"
pandas\tests\io\json\test_ujson.py:4: error: Name 'json' already defined (by an import)
pandas\tests\indexing\test_coercion.py:933: error: List item 0 has incompatible type "int"; expected "str"
pandas\tests\indexing\test_coercion.py:933: error: List item 1 has incompatible type "int"; expected "str"
pandas\tests\indexing\test_coercion.py:934: error: List item 0 has incompatible type "float"; expected "str"
pandas\tests\indexing\test_coercion.py:934: error: List item 1 has incompatible type "float"; expected "str"
pandas\tests\indexing\test_coercion.py:935: error: List item 0 has incompatible type "complex"; expected "str"
pandas\tests\indexing\test_coercion.py:935: error: List item 1 has incompatible type "complex"; expected "str"
pandas\tests\indexing\test_coercion.py:936: error: List item 0 has incompatible type "bool"; expected "str"
pandas\tests\indexing\test_coercion.py:936: error: List item 1 has incompatible type "bool"; expected "str"
pandas\tests\indexes\interval\test_interval_tree.py:157: error: Argument 1 to "map" has incompatible type "Type[List[Any]]"; expected "Callable[[Tuple[int, ...]], List[_T]]"
pandas\tests\indexes\interval\test_interval_tree.py:164: error: Argument 1 to "map" has incompatible type "Type[List[Any]]"; expected "Callable[[Tuple[int, ...]], List[_T]]"
pandas\tests\frame\test_constructors.py:53: error: Need type annotation for 'x'
pandas\tests\frame\test_constructors.py:59: error: Need type annotation for 'x'
pandas\tests\frame\test_constructors.py:75: error: Need type annotation for 'x'
pandas\tests\dtypes\test_inference.py:78: error: Need type annotation for 'x'
pandas\tests\dtypes\test_inference.py:291: error: Too many arguments for "tuple"
pandas\tests\dtypes\test_inference.py:291: error: Argument 1 to "tuple" has incompatible type "int"; expected "Iterable[Any]"
pandas\tests\computation\test_eval.py:1883: error: Dict entry 1 has incompatible type "str": "Type[ExprVisitor]"; expected "str": "Type[BaseExprVisitor]"
pandas\tests\arrays\test_period.py:245: error: Argument "freq" to "period_array" has incompatible type "str"; expected "Optional[Tick]"
pandas\tests\arrays\test_datetimelike.py:225: error: Incompatible types in assignment (expression has type "Type[DatetimeIndex]", base class "SharedTests" defined the type as "None")
pandas\tests\arrays\test_datetimelike.py:476: error: Incompatible types in assignment (expression has type "Type[TimedeltaIndex]", base class "SharedTests" defined the type as "None")
pandas\tests\arrays\test_datetimelike.py:586: error: Incompatible types in assignment (expression has type "Type[PeriodIndex]", base class "SharedTests" defined the type as "None")
pandas\tests\arithmetic\test_datetime64.py:2164: error: "DatetimeIndex" has no attribute "tz_localize"
pandas\tests\tseries\offsets\test_yqm_offsets.py:545: error: Incompatible types in assignment (expression has type "Type[QuarterEnd]", base class "Base" defined the type as "None")
pandas\tests\tseries\offsets\test_yqm_offsets.py:692: error: Incompatible types in assignment (expression has type "Type[BQuarterBegin]", base class "Base" defined the type as "None")
pandas\tests\tseries\offsets\test_yqm_offsets.py:817: error: Incompatible types in assignment (expression has type "Type[BQuarterEnd]", base class "Base" defined the type as "None")
pandas\tests\tseries\offsets\test_yqm_offsets.py:964: error: Incompatible types in assignment (expression has type "Type[YearBegin]", base class "Base" defined the type as "None")
pandas\tests\tseries\offsets\test_yqm_offsets.py:1118: error: Incompatible types in assignment (expression has type "Type[YearEnd]", base class "Base" defined the type as "None")
pandas\tests\tseries\offsets\test_yqm_offsets.py:1267: error: Incompatible types in assignment (expression has type "Type[BYearBegin]", base class "Base" defined the type as "None")
pandas\tests\tseries\offsets\test_yqm_offsets.py:1340: error: Incompatible types in assignment (expression has type "Type[BYearEnd]", base class "Base" defined the type as "None")
pandas\tests\tseries\offsets\test_yqm_offsets.py:1413: error: Incompatible types in assignment (expression has type "Type[BYearEnd]", base class "Base" defined the type as "None")
pandas\tests\series\test_operators.py:787: error: "Type[Series]" has no attribute "div"
pandas\tests\series\test_operators.py:787: error: "Type[Series]" has no attribute "rdiv"
pandas\tests\indexing\test_loc.py:819: error: No overload variant of "slice" matches argument types "None", "str", "None"
pandas\tests\indexing\test_loc.py:819: note: Possible overload variant:
pandas\tests\indexing\test_loc.py:819: note:     def __init__(self, start: Optional[int], stop: Optional[int], step: Optional[int] = ...) -> slice
pandas\tests\indexing\test_loc.py:819: note:     <1 more non-matching overload not shown>
pandas\tests\indexes\test_numeric.py:99: error: Incompatible types in assignment (expression has type "Type[Float64Index]", base class "Base" defined the type as "None")
pandas\tests\indexes\test_numeric.py:605: error: Incompatible types in assignment (expression has type "Type[Int64Index]", base class "Base" defined the type as "None")
pandas\tests\indexes\test_numeric.py:889: error: Incompatible types in assignment (expression has type "Type[UInt64Index]", base class "Base" defined the type as "None")
pandas\tests\indexes\test_category.py:20: error: Incompatible types in assignment (expression has type "Type[CategoricalIndex]", base class "Base" defined the type as "None")
pandas\tests\indexes\test_base.py:49: error: Incompatible types in assignment (expression has type "Type[Index]", base class "Base" defined the type as "None")
pandas\tests\indexes\test_base.py:526: error: Need type annotation for 'x'
pandas\tests\indexes\test_base.py:549: error: Need type annotation for 'x'
pandas\tests\indexes\test_base.py:1743: error: Slice index must be an integer or None
pandas\tests\indexes\test_base.py:1744: error: Slice index must be an integer or None
pandas\tests\indexes\test_base.py:1745: error: Slice index must be an integer or None
pandas\tests\indexes\test_base.py:1746: error: Slice index must be an integer or None
pandas\tests\indexes\test_base.py:1747: error: Slice index must be an integer or None
pandas\tests\indexes\test_base.py:1748: error: Slice index must be an integer or None
pandas\tests\indexes\test_base.py:1750: error: Slice index must be an integer or None
pandas\tests\indexes\test_base.py:1751: error: Slice index must be an integer or None
pandas\tests\indexes\test_base.py:1752: error: Slice index must be an integer or None
pandas\tests\indexes\test_base.py:1753: error: Slice index must be an integer or None
pandas\tests\indexes\test_base.py:1754: error: Slice index must be an integer or None
pandas\tests\indexes\test_base.py:1755: error: Slice index must be an integer or None
pandas\tests\indexes\test_base.py:1756: error: Slice index must be an integer or None
pandas\tests\indexes\test_base.py:1757: error: Slice index must be an integer or None
pandas\tests\indexes\test_base.py:1758: error: Slice index must be an integer or None
pandas\tests\indexes\test_base.py:2438: error: Incompatible types in assignment (expression has type "Type[Index]", base class "Base" defined the type as "None")
pandas\tests\indexes\interval\test_base.py:15: error: Incompatible types in assignment (expression has type "Type[IntervalIndex]", base class "Base" defined the type as "None")
pandas\tests\frame\test_convert_to.py:579: error: Argument 1 to "defaultdict" has incompatible type "Type[List[Any]]"; expected "Optional[Callable[[], Dict[str, float]]]"
pandas\tests\dtypes\test_common.py:327: error: Unsupported operand types for + ("List[Series]" and "List[str]")
pandas\tests\dtypes\test_common.py:355: error: Unsupported operand types for + ("List[Series]" and "List[object]")
pandas\tests\dtypes\test_common.py:387: error: Unsupported operand types for + ("List[Series]" and "List[str]")
pandas\tests\api\test_api.py:44: error: Need type annotation for 'deprecated_modules' (hint: "deprecated_modules: List[<type>] = ...")
pandas\tests\api\test_api.py:95: error: Need type annotation for 'deprecated_classes' (hint: "deprecated_classes: List[<type>] = ...")
pandas\tests\api\test_api.py:98: error: Need type annotation for 'deprecated_classes_in_future' (hint: "deprecated_classes_in_future: List[<type>] = ...")
pandas\tests\api\test_api.py:174: error: Need type annotation for 'deprecated_funcs_in_future' (hint: "deprecated_funcs_in_future: List[<type>] = ...")
pandas\tests\api\test_api.py:177: error: Need type annotation for 'deprecated_funcs' (hint: "deprecated_funcs: List[<type>] = ...")
pandas\tests\indexes\test_range.py:22: error: Incompatible types in assignment (expression has type "Type[RangeIndex]", base class "Base" defined the type as "None")
pandas\tests\indexes\timedeltas\test_timedelta.py:31: error: Incompatible types in assignment (expression has type "Type[TimedeltaIndex]", base class "Base" defined the type as "None")
pandas\tests\indexes\period\test_period.py:26: error: Incompatible types in assignment (expression has type "Type[PeriodIndex]", base class "Base" defined the type as "None")
pandas\tests\indexes\datetimes\test_datetimelike.py:10: error: Incompatible types in assignment (expression has type "Type[DatetimeIndex]", base class "Base" defined the type as "None")
pandas\tests\arrays\test_array.py:36: error: Argument "freq" to "period_array" has incompatible type "str"; expected "Optional[Tick]"
pandas\tests\arrays\test_array.py:42: error: Argument "freq" to "period_array" has incompatible type "str"; expected "Optional[Tick]"
pandas\tests\arrays\test_array.py:128: error: Argument "freq" to "period_array" has incompatible type "str"; expected "Optional[Tick]"
pandas\tests\arrays\test_array.py:163: error: Argument "freq" to "period_array" has incompatible type "str"; expected "Optional[Tick]"
pandas\tests\extension\test_sparse.py:311: error: Incompatible types in assignment (expression has type "None", base class "BaseArithmeticOpsTests" defined the type as "Type[TypeError]")
pandas\tests\extension\test_sparse.py:312: error: Incompatible types in assignment (expression has type "None", base class "BaseArithmeticOpsTests" defined the type as "Type[TypeError]")
pandas\tests\extension\test_sparse.py:313: error: Incompatible types in assignment (expression has type "None", base class "BaseArithmeticOpsTests" defined the type as "Type[TypeError]")
pandas\tests\extension\test_sparse.py:314: error: Incompatible types in assignment (expression has type "None", base class "BaseArithmeticOpsTests" defined the type as "Type[TypeError]")
pandas\tests\extension\test_numpy.py:252: error: Incompatible types in assignment (expression has type "None", base class "BaseArithmeticOpsTests" defined the type as "Type[TypeError]")
pandas\tests\extension\test_numpy.py:253: error: Incompatible types in assignment (expression has type "None", base class "BaseArithmeticOpsTests" defined the type as "Type[TypeError]")
pandas\tests\extension\test_numpy.py:254: error: Incompatible types in assignment (expression has type "None", base class "BaseArithmeticOpsTests" defined the type as "Type[TypeError]")
pandas\tests\extension\test_numpy.py:255: error: Incompatible types in assignment (expression has type "None", base class "BaseArithmeticOpsTests" defined the type as "Type[TypeError]")
pandas\tests\extension\json\test_json.py:118: error: Definition of "assert_series_equal" in base class "BaseJSON" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\json\test_json.py:118: error: Definition of "assert_frame_equal" in base class "BaseJSON" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\json\test_json.py:122: error: Definition of "assert_series_equal" in base class "BaseJSON" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\json\test_json.py:122: error: Definition of "assert_frame_equal" in base class "BaseJSON" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\json\test_json.py:145: error: Definition of "assert_series_equal" in base class "BaseJSON" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\json\test_json.py:145: error: Definition of "assert_frame_equal" in base class "BaseJSON" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\json\test_json.py:152: error: Definition of "assert_series_equal" in base class "BaseJSON" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\json\test_json.py:152: error: Definition of "assert_frame_equal" in base class "BaseJSON" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\json\test_json.py:168: error: Definition of "assert_series_equal" in base class "BaseJSON" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\json\test_json.py:168: error: Definition of "assert_frame_equal" in base class "BaseJSON" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\json\test_json.py:172: error: Definition of "assert_series_equal" in base class "BaseJSON" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\json\test_json.py:172: error: Definition of "assert_frame_equal" in base class "BaseJSON" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\json\test_json.py:192: error: Definition of "assert_series_equal" in base class "BaseJSON" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\json\test_json.py:192: error: Definition of "assert_frame_equal" in base class "BaseJSON" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\json\test_json.py:248: error: Definition of "assert_series_equal" in base class "BaseJSON" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\json\test_json.py:248: error: Definition of "assert_frame_equal" in base class "BaseJSON" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\json\test_json.py:261: error: Definition of "assert_series_equal" in base class "BaseJSON" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\json\test_json.py:261: error: Definition of "assert_frame_equal" in base class "BaseJSON" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\json\test_json.py:289: error: Definition of "assert_series_equal" in base class "BaseJSON" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\json\test_json.py:289: error: Definition of "assert_frame_equal" in base class "BaseJSON" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\json\test_json.py:307: error: Definition of "assert_series_equal" in base class "BaseJSON" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\json\test_json.py:307: error: Definition of "assert_frame_equal" in base class "BaseJSON" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\json\test_json.py:311: error: Definition of "assert_series_equal" in base class "BaseJSON" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\json\test_json.py:311: error: Definition of "assert_frame_equal" in base class "BaseJSON" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\decimal\test_decimal.py:113: error: Definition of "assert_series_equal" in base class "BaseDecimal" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\decimal\test_decimal.py:113: error: Definition of "assert_frame_equal" in base class "BaseDecimal" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\decimal\test_decimal.py:118: error: Definition of "assert_series_equal" in base class "BaseDecimal" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\decimal\test_decimal.py:118: error: Definition of "assert_frame_equal" in base class "BaseDecimal" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\decimal\test_decimal.py:122: error: Definition of "assert_series_equal" in base class "BaseDecimal" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\decimal\test_decimal.py:122: error: Definition of "assert_frame_equal" in base class "BaseDecimal" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\decimal\test_decimal.py:129: error: Definition of "assert_series_equal" in base class "BaseDecimal" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\decimal\test_decimal.py:129: error: Definition of "assert_frame_equal" in base class "BaseDecimal" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\decimal\test_decimal.py:133: error: Definition of "assert_series_equal" in base class "BaseDecimal" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\decimal\test_decimal.py:133: error: Definition of "assert_frame_equal" in base class "BaseDecimal" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\decimal\test_decimal.py:141: error: Definition of "assert_series_equal" in base class "BaseDecimal" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\decimal\test_decimal.py:141: error: Definition of "assert_frame_equal" in base class "BaseDecimal" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\decimal\test_decimal.py:166: error: Definition of "assert_series_equal" in base class "BaseDecimal" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\decimal\test_decimal.py:166: error: Definition of "assert_frame_equal" in base class "BaseDecimal" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\decimal\test_decimal.py:182: error: Definition of "assert_series_equal" in base class "BaseDecimal" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\decimal\test_decimal.py:182: error: Definition of "assert_frame_equal" in base class "BaseDecimal" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\decimal\test_decimal.py:186: error: Definition of "assert_series_equal" in base class "BaseDecimal" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\decimal\test_decimal.py:186: error: Definition of "assert_frame_equal" in base class "BaseDecimal" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\decimal\test_decimal.py:194: error: Definition of "assert_series_equal" in base class "BaseDecimal" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\decimal\test_decimal.py:194: error: Definition of "assert_frame_equal" in base class "BaseDecimal" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\decimal\test_decimal.py:198: error: Definition of "assert_series_equal" in base class "BaseDecimal" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\decimal\test_decimal.py:198: error: Definition of "assert_frame_equal" in base class "BaseDecimal" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\decimal\test_decimal.py:267: error: Definition of "assert_series_equal" in base class "BaseDecimal" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\decimal\test_decimal.py:267: error: Definition of "assert_frame_equal" in base class "BaseDecimal" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\decimal\test_decimal.py:301: error: Definition of "assert_series_equal" in base class "BaseDecimal" is incompatible with definition in base class "BaseExtensionTests"
pandas\tests\extension\decimal\test_decimal.py:301: error: Definition of "assert_frame_equal" in base class "BaseDecimal" is incompatible with definition in base class "BaseExtensionTests"
(pandas-dev) 

This breaks down to the following number of errors in relevant modules:

  • [x] 29 pandas\tests\tseries\offsets\test_offsets.py #29340
  • [x] 26 pandas\tests\extension\decimal\test_decimal.py #31730
  • [x] 24 pandas\tests\extension\json\test_json.py #31836
  • [x] 19 pandas\tests\indexes\test_base.py #29188
  • [x] 8 pandas\tests\tseries\offsets\test_yqm_offsets.py #28996
  • [x] 8 pandas\tests\io\test_sql.py #29006
  • [x] 8 pandas\tests\indexing\test_coercion.py #28990
  • [x] 5 pandas\tests\api\test_api.py #28935
  • [ ] 5 pandas\conftest.py #29046
  • [x] 4 pandas\tests\io\parser\conftest.py #28973
  • [x] 4 pandas\tests\extension\test_sparse.py #28947
  • [x] 4 pandas\tests\extension\test_numpy.py #28947
  • [x] 4 pandas\tests\arrays\test_array.py #28970
  • [x] 3 pandas\tests\indexes\test_numeric.py #28961
  • [x] 3 pandas\tests\frame\test_constructors.py #29115
  • [x] 3 pandas\tests\dtypes\test_inference.py #29114
  • [x] 3 pandas\tests\dtypes\test_common.py #29179
  • [x] 3 pandas\tests\arrays\test_datetimelike.py #29014
  • [x] 2 pandas\tests\tseries\offsets\test_offsets_properties.py #28972
  • [x] 2 pandas\tests\test_base.py #28970
  • [x] 2 pandas\tests\series\test_operators.py #29826
  • [x] 2 pandas\tests\series\test_constructors.py #29108
  • [x] 2 pandas\tests\indexes\interval\test_interval_tree.py #29021
  • [x] 1 pandas\tests\test_algos.py #28960
  • [x] 1 pandas\tests\plotting\test_backend.py #29016
  • [x] 1 pandas\tests\io\json\test_ujson.py #29022
  • [x] 1 pandas\tests\indexing\test_loc.py
  • [x] 1 pandas\tests\indexes\timedeltas\test_timedelta.py #28961
  • [x] 1 pandas\tests\indexes\test_range.py #28961
  • [x] 1 pandas\tests\indexes\test_category.py #28961
  • [x] 1 pandas\tests\indexes\period\test_period.py #28961
  • [x] 1 pandas\tests\indexes\interval\test_base.py #28961
  • [x] 1 pandas\tests\indexes\datetimes\test_datetimelike.py #28961
  • [x] 1 pandas\tests\frame\test_convert_to.py #28965
  • [x] 1 pandas\tests\extension\json\array.py #31718
  • [x] 1 pandas\tests\computation\test_eval.py #29007
  • [x] 1 pandas\tests\arrays\test_period.py #28970
  • [ ] 1 pandas\tests\arithmetic\test_datetime64.py #31716

assume that the degree of difficulty to resolve will vary, but some should be good first issues.

PRs to tackle individual modules preferred and remove from whitelist in setup.cfg.

Typing good first issue

All 21 comments

✋ I'd like to work on this! I can take the mypy errors in pandas\conftest.py.

I would like to work on \api\test_api.py.

I would like to work on \extension\test_numpy.py to get started. Will be my first pull request.

working on
pandas\tests\arrays\test_array.py

for this i changed pandas/core/arrays/period.py
freq: Optional[Tick] => freq: Optional[Union[str, Tick]] .
Is this correct approach to resolve this.
Also one more option "offset" is possible.Test cases are not using offset object in freq so Union[str, Tick] is not giving any mypy issue.

First time contributing 👶
having a look at:

  • [x] /pandas/tests/tseries/test_offsets_properties.py
  • [x] /pandas/tests/io/parser/conftest.py
  • [x] /pandas/tests/io/test_sql.py
  • [x] /pandas/tests/extension/json/array.py

Having a look at

  • [ ] pandas\tests\dtypes\test_inference.py
    line291: The Problem here is due to mypy not being able to correctly infer types when unpacking the values tuple.
    A fix would be to use the defaults keyword to fill in default values with the Problem that this was introduced in python 3.7 (so not backwards compatible)
    Another fix would be to use typing.NamedTuple which bars using the pytest.mark.parametrize annotation since one cannot instantiate the NamedTuple inline because this would result in a new mypy error: NamedTuple not callable.

    So really, this is just due to a current limitation of mypy.
    For the sake of backwards compatibility, maybe the most straightforward fix would be to just #type: ignore or remove the mark.parametrize on that test and provide the test object in a different manner.
    Any thoughts on what is better?

I'll work on indexing\test_coercion.py.

Now looking into

  • [x] extension\json\test_json.py
  • [x] tseries\offsets\test_yqm_offsets.py

Having a look at

  • [ ] pandas\tests\dtypes\test_inference.py
    line291: The Problem here is due to mypy not being able to correctly infer types when unpacking the values tuple.
    A fix would be to use the defaults keyword to fill in default values with the Problem that this was introduced in python 3.7 (so not backwards compatible)
    Another fix would be to use typing.NamedTuple which bars using the pytest.mark.parametrize annotation since one cannot instantiate the NamedTuple inline because this would result in a new mypy error: NamedTuple not callable.
    So really, this is just due to a current limitation of mypy.
    For the sake of backwards compatibility, maybe the most straightforward fix would be to just #type: ignore or remove the mark.parametrize on that test and provide the test object in a different manner.
    Any thoughts on what is better?
TestTuple = collections.namedtuple("TestTuple", ["a", "b", "c"])
@pytest.mark.parametrize("ll", [TestTuple(1, 2, 3)])

seems to work

PR sent for 'pandas/tests/computation/test_eval.py' :grin:

I'll work on 'pandas/tests/io/json/test_ujson.py'

I'll start checking out plotting/test_backend.py

Was working on _pandas/tests/indexes/test_category.py_, but this will also be fixed with #28976

I'll be working on _pandas\tests\arrays\test_datetimelike.py_

I'll check out dtypes\test_common.py.

Regarding pandas\tests\indexing\test_loc.py, the offending line is line 819
@pytest.mark.parametrize( "indexer", [["A"], slice(None, "A", None), np.array(["A"])] )
Particularly, it is the call to slice(None, "A", None) which is causing mypy to complain.

However, slice is a builtin library function with a (overloaded) function signature of def __init__(self, start: Optional[int], stop: Optional[int], step: Optional[int] = ...) -> None: .... Modifying this does not seem to be practical (since it is a built-in), and it seems mypy is not recognizing that the custom slice object is handled in the _getitem__ method for DataFrames.

Looking into pandas\tests\frame\test_constructors.py

Looking into pandas\tests\indexes\test_base.py

take

I will take care of the issues where the stale PRs were closed:

  • pandas\tests\extension\decimal\test_decimal.py
  • pandas\tests\extension\json\array.py
  • pandas\tests\arithmetic\test_datetime64.py

take

Was this page helpful?
0 / 5 - 0 ratings