@@ -37,7 +37,7 @@ def __hash__(self):
3737 self .hash_count += 1
3838 return int .__hash__ (self )
3939
40- class TestJointOps ( unittest . TestCase ) :
40+ class TestJointOps :
4141 # Tests common to both set and frozenset
4242
4343 def setUp (self ):
@@ -361,7 +361,7 @@ class C(object):
361361 gc .collect ()
362362 self .assertTrue (ref () is None , "Cycle was not collected" )
363363
364- class TestSet (TestJointOps ):
364+ class TestSet (TestJointOps , unittest . TestCase ):
365365 thetype = set
366366 basetype = set
367367
@@ -647,7 +647,7 @@ def test_keywords_in_subclass(self):
647647 'SF bug #1486663 -- this used to erroneously raise a TypeError'
648648 SetSubclassWithKeywordArgs (newarg = 1 )
649649
650- class TestFrozenSet (TestJointOps ):
650+ class TestFrozenSet (TestJointOps , unittest . TestCase ):
651651 thetype = frozenset
652652 basetype = frozenset
653653
@@ -748,7 +748,7 @@ def test_singleton_empty_frozenset(self):
748748
749749#==============================================================================
750750
751- class TestBasicOps ( unittest . TestCase ) :
751+ class TestBasicOps :
752752
753753 def test_repr (self ):
754754 if self .repr is not None :
@@ -860,7 +860,7 @@ def test_pickling(self):
860860
861861#------------------------------------------------------------------------------
862862
863- class TestBasicOpsEmpty (TestBasicOps ):
863+ class TestBasicOpsEmpty (TestBasicOps , unittest . TestCase ):
864864 def setUp (self ):
865865 self .case = "empty set"
866866 self .values = []
@@ -871,7 +871,7 @@ def setUp(self):
871871
872872#------------------------------------------------------------------------------
873873
874- class TestBasicOpsSingleton (TestBasicOps ):
874+ class TestBasicOpsSingleton (TestBasicOps , unittest . TestCase ):
875875 def setUp (self ):
876876 self .case = "unit set (number)"
877877 self .values = [3 ]
@@ -888,7 +888,7 @@ def test_not_in(self):
888888
889889#------------------------------------------------------------------------------
890890
891- class TestBasicOpsTuple (TestBasicOps ):
891+ class TestBasicOpsTuple (TestBasicOps , unittest . TestCase ):
892892 def setUp (self ):
893893 self .case = "unit set (tuple)"
894894 self .values = [(0 , "zero" )]
@@ -905,7 +905,7 @@ def test_not_in(self):
905905
906906#------------------------------------------------------------------------------
907907
908- class TestBasicOpsTriple (TestBasicOps ):
908+ class TestBasicOpsTriple (TestBasicOps , unittest . TestCase ):
909909 def setUp (self ):
910910 self .case = "triple set"
911911 self .values = [0 , "zero" , operator .add ]
@@ -916,7 +916,7 @@ def setUp(self):
916916
917917#------------------------------------------------------------------------------
918918
919- class TestBasicOpsString (TestBasicOps ):
919+ class TestBasicOpsString (TestBasicOps , unittest . TestCase ):
920920 def setUp (self ):
921921 self .case = "string set"
922922 self .values = ["a" , "b" , "c" ]
@@ -929,7 +929,7 @@ def test_repr(self):
929929
930930#------------------------------------------------------------------------------
931931
932- class TestBasicOpsBytes (TestBasicOps ):
932+ class TestBasicOpsBytes (TestBasicOps , unittest . TestCase ):
933933 def setUp (self ):
934934 self .case = "string set"
935935 self .values = [b"a" , b"b" , b"c" ]
@@ -942,7 +942,7 @@ def test_repr(self):
942942
943943#------------------------------------------------------------------------------
944944
945- class TestBasicOpsMixedStringBytes (TestBasicOps ):
945+ class TestBasicOpsMixedStringBytes (TestBasicOps , unittest . TestCase ):
946946 def setUp (self ):
947947 self ._warning_filters = support .check_warnings ()
948948 self ._warning_filters .__enter__ ()
@@ -1241,7 +1241,7 @@ def test_update_unit_tuple_non_overlap(self):
12411241
12421242#==============================================================================
12431243
1244- class TestSubsets ( unittest . TestCase ) :
1244+ class TestSubsets :
12451245
12461246 case2method = {"<=" : "issubset" ,
12471247 ">=" : "issuperset" ,
@@ -1279,47 +1279,47 @@ def test_issubset(self):
12791279 self .assertEqual (result , expected )
12801280#------------------------------------------------------------------------------
12811281
1282- class TestSubsetEqualEmpty (TestSubsets ):
1282+ class TestSubsetEqualEmpty (TestSubsets , unittest . TestCase ):
12831283 left = set ()
12841284 right = set ()
12851285 name = "both empty"
12861286 cases = "==" , "<=" , ">="
12871287
12881288#------------------------------------------------------------------------------
12891289
1290- class TestSubsetEqualNonEmpty (TestSubsets ):
1290+ class TestSubsetEqualNonEmpty (TestSubsets , unittest . TestCase ):
12911291 left = set ([1 , 2 ])
12921292 right = set ([1 , 2 ])
12931293 name = "equal pair"
12941294 cases = "==" , "<=" , ">="
12951295
12961296#------------------------------------------------------------------------------
12971297
1298- class TestSubsetEmptyNonEmpty (TestSubsets ):
1298+ class TestSubsetEmptyNonEmpty (TestSubsets , unittest . TestCase ):
12991299 left = set ()
13001300 right = set ([1 , 2 ])
13011301 name = "one empty, one non-empty"
13021302 cases = "!=" , "<" , "<="
13031303
13041304#------------------------------------------------------------------------------
13051305
1306- class TestSubsetPartial (TestSubsets ):
1306+ class TestSubsetPartial (TestSubsets , unittest . TestCase ):
13071307 left = set ([1 ])
13081308 right = set ([1 , 2 ])
13091309 name = "one a non-empty proper subset of other"
13101310 cases = "!=" , "<" , "<="
13111311
13121312#------------------------------------------------------------------------------
13131313
1314- class TestSubsetNonOverlap (TestSubsets ):
1314+ class TestSubsetNonOverlap (TestSubsets , unittest . TestCase ):
13151315 left = set ([1 ])
13161316 right = set ([2 ])
13171317 name = "neither empty, neither contains"
13181318 cases = "!="
13191319
13201320#==============================================================================
13211321
1322- class TestOnlySetsInBinaryOps ( unittest . TestCase ) :
1322+ class TestOnlySetsInBinaryOps :
13231323
13241324 def test_eq_ne (self ):
13251325 # Unlike the others, this is testing that == and != *are* allowed.
@@ -1435,47 +1435,47 @@ def test_difference(self):
14351435
14361436#------------------------------------------------------------------------------
14371437
1438- class TestOnlySetsNumeric (TestOnlySetsInBinaryOps ):
1438+ class TestOnlySetsNumeric (TestOnlySetsInBinaryOps , unittest . TestCase ):
14391439 def setUp (self ):
14401440 self .set = set ((1 , 2 , 3 ))
14411441 self .other = 19
14421442 self .otherIsIterable = False
14431443
14441444#------------------------------------------------------------------------------
14451445
1446- class TestOnlySetsDict (TestOnlySetsInBinaryOps ):
1446+ class TestOnlySetsDict (TestOnlySetsInBinaryOps , unittest . TestCase ):
14471447 def setUp (self ):
14481448 self .set = set ((1 , 2 , 3 ))
14491449 self .other = {1 :2 , 3 :4 }
14501450 self .otherIsIterable = True
14511451
14521452#------------------------------------------------------------------------------
14531453
1454- class TestOnlySetsOperator (TestOnlySetsInBinaryOps ):
1454+ class TestOnlySetsOperator (TestOnlySetsInBinaryOps , unittest . TestCase ):
14551455 def setUp (self ):
14561456 self .set = set ((1 , 2 , 3 ))
14571457 self .other = operator .add
14581458 self .otherIsIterable = False
14591459
14601460#------------------------------------------------------------------------------
14611461
1462- class TestOnlySetsTuple (TestOnlySetsInBinaryOps ):
1462+ class TestOnlySetsTuple (TestOnlySetsInBinaryOps , unittest . TestCase ):
14631463 def setUp (self ):
14641464 self .set = set ((1 , 2 , 3 ))
14651465 self .other = (2 , 4 , 6 )
14661466 self .otherIsIterable = True
14671467
14681468#------------------------------------------------------------------------------
14691469
1470- class TestOnlySetsString (TestOnlySetsInBinaryOps ):
1470+ class TestOnlySetsString (TestOnlySetsInBinaryOps , unittest . TestCase ):
14711471 def setUp (self ):
14721472 self .set = set ((1 , 2 , 3 ))
14731473 self .other = 'abc'
14741474 self .otherIsIterable = True
14751475
14761476#------------------------------------------------------------------------------
14771477
1478- class TestOnlySetsGenerator (TestOnlySetsInBinaryOps ):
1478+ class TestOnlySetsGenerator (TestOnlySetsInBinaryOps , unittest . TestCase ):
14791479 def setUp (self ):
14801480 def gen ():
14811481 for i in range (0 , 10 , 2 ):
@@ -1486,7 +1486,7 @@ def gen():
14861486
14871487#==============================================================================
14881488
1489- class TestCopying ( unittest . TestCase ) :
1489+ class TestCopying :
14901490
14911491 def test_copy (self ):
14921492 dup = self .set .copy ()
@@ -1507,31 +1507,31 @@ def test_deep_copy(self):
15071507
15081508#------------------------------------------------------------------------------
15091509
1510- class TestCopyingEmpty (TestCopying ):
1510+ class TestCopyingEmpty (TestCopying , unittest . TestCase ):
15111511 def setUp (self ):
15121512 self .set = set ()
15131513
15141514#------------------------------------------------------------------------------
15151515
1516- class TestCopyingSingleton (TestCopying ):
1516+ class TestCopyingSingleton (TestCopying , unittest . TestCase ):
15171517 def setUp (self ):
15181518 self .set = set (["hello" ])
15191519
15201520#------------------------------------------------------------------------------
15211521
1522- class TestCopyingTriple (TestCopying ):
1522+ class TestCopyingTriple (TestCopying , unittest . TestCase ):
15231523 def setUp (self ):
15241524 self .set = set (["zero" , 0 , None ])
15251525
15261526#------------------------------------------------------------------------------
15271527
1528- class TestCopyingTuple (TestCopying ):
1528+ class TestCopyingTuple (TestCopying , unittest . TestCase ):
15291529 def setUp (self ):
15301530 self .set = set ([(1 , 2 )])
15311531
15321532#------------------------------------------------------------------------------
15331533
1534- class TestCopyingNested (TestCopying ):
1534+ class TestCopyingNested (TestCopying , unittest . TestCase ):
15351535 def setUp (self ):
15361536 self .set = set ([((1 , 2 ), (3 , 4 ))])
15371537
@@ -1837,58 +1837,5 @@ def test_cuboctahedron(self):
18371837
18381838#==============================================================================
18391839
1840- def test_main (verbose = None ):
1841- test_classes = (
1842- TestSet ,
1843- TestSetSubclass ,
1844- TestSetSubclassWithKeywordArgs ,
1845- TestFrozenSet ,
1846- TestFrozenSetSubclass ,
1847- TestSetOfSets ,
1848- TestExceptionPropagation ,
1849- TestBasicOpsEmpty ,
1850- TestBasicOpsSingleton ,
1851- TestBasicOpsTuple ,
1852- TestBasicOpsTriple ,
1853- TestBasicOpsString ,
1854- TestBasicOpsBytes ,
1855- TestBasicOpsMixedStringBytes ,
1856- TestBinaryOps ,
1857- TestUpdateOps ,
1858- TestMutate ,
1859- TestSubsetEqualEmpty ,
1860- TestSubsetEqualNonEmpty ,
1861- TestSubsetEmptyNonEmpty ,
1862- TestSubsetPartial ,
1863- TestSubsetNonOverlap ,
1864- TestOnlySetsNumeric ,
1865- TestOnlySetsDict ,
1866- TestOnlySetsOperator ,
1867- TestOnlySetsTuple ,
1868- TestOnlySetsString ,
1869- TestOnlySetsGenerator ,
1870- TestCopyingEmpty ,
1871- TestCopyingSingleton ,
1872- TestCopyingTriple ,
1873- TestCopyingTuple ,
1874- TestCopyingNested ,
1875- TestIdentities ,
1876- TestVariousIteratorArgs ,
1877- TestGraphs ,
1878- TestWeirdBugs ,
1879- )
1880-
1881- support .run_unittest (* test_classes )
1882-
1883- # verify reference counting
1884- if verbose and hasattr (sys , "gettotalrefcount" ):
1885- import gc
1886- counts = [None ] * 5
1887- for i in range (len (counts )):
1888- support .run_unittest (* test_classes )
1889- gc .collect ()
1890- counts [i ] = sys .gettotalrefcount ()
1891- print (counts )
1892-
18931840if __name__ == "__main__" :
1894- test_main ( verbose = True )
1841+ unittest . main ( )
0 commit comments