From 433b1b2ebc17bb2cbadf0be0d98d5c42de1db4d0 Mon Sep 17 00:00:00 2001 From: jkleint Date: Tue, 21 Mar 2017 23:10:19 -0700 Subject: [PATCH] TestCase.assertSetEqual() should accept frozenset (#1063) This declares the method to take the union of Set and FrozenSet rather than AbstractSet since that is where `difference()` (used by `assertSetEqual()`) is defined. --- stdlib/2/unittest.pyi | 6 +++--- stdlib/3/unittest/__init__.pyi | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/stdlib/2/unittest.pyi b/stdlib/2/unittest.pyi index dbfccac92..9f3f7d600 100644 --- a/stdlib/2/unittest.pyi +++ b/stdlib/2/unittest.pyi @@ -6,7 +6,7 @@ from typing import ( Any, Callable, Dict, Iterable, Tuple, List, TextIO, Sequence, - overload, Set, TypeVar, Union, Pattern, Type + overload, Set, FrozenSet, TypeVar, Union, Pattern, Type ) from abc import abstractmethod, ABCMeta @@ -101,8 +101,8 @@ class TestCase(Testable): msg: object = ...) -> None: ... def assertTupleEqual(self, first: Tuple[Any, ...], second: Tuple[Any, ...], msg: object = ...) -> None: ... - def assertSetEqual(self, first: Set[Any], second: Set[Any], - msg: object = ...) -> None: ... + def assertSetEqual(self, first: Union[Set[Any], FrozenSet[Any]], + second: Union[Set[Any], FrozenSet[Any]], msg: object = ...) -> None: ... def assertDictEqual(self, first: Dict[Any, Any], second: Dict[Any, Any], msg: object = ...) -> None: ... def assertLess(self, first: Any, second: Any, diff --git a/stdlib/3/unittest/__init__.pyi b/stdlib/3/unittest/__init__.pyi index 7357cffb8..3a3c57ab4 100644 --- a/stdlib/3/unittest/__init__.pyi +++ b/stdlib/3/unittest/__init__.pyi @@ -2,7 +2,7 @@ from typing import ( Any, Callable, Dict, Iterable, Iterator, List, Optional, Pattern, Sequence, - Set, TextIO, Tuple, Type, TypeVar, Union, Generic, + Set, FrozenSet, TextIO, Tuple, Type, TypeVar, Union, Generic, overload, ) import logging @@ -131,8 +131,8 @@ class TestCase: msg: Any = ...) -> None: ... def assertTupleEqual(self, first: Tuple[Any, ...], second: Tuple[Any, ...], msg: Any = ...) -> None: ... - def assertSetEqual(self, first: Set[Any], second: Set[Any], - msg: Any = ...) -> None: ... + def assertSetEqual(self, first: Union[Set[Any], FrozenSet[Any]], + second: Union[Set[Any], FrozenSet[Any]], msg: Any = ...) -> None: ... def assertDictEqual(self, first: Dict[Any, Any], second: Dict[Any, Any], msg: Any = ...) -> None: ... def fail(self, msg: Any = ...) -> None: ...