@@ -457,15 +457,16 @@ class B:
457
457
458
458
self .assertEqual (implementedBy (A ), implementedBy (A ))
459
459
self .assertEqual (hash (implementedBy (A )), hash (implementedBy (A )))
460
- self .assertTrue (implementedBy (A ) < None )
461
- self .assertTrue (
462
- None > implementedBy (A )
463
- ) # pylint:disable=misplaced-comparison-constant
464
- self .assertTrue (implementedBy (A ) < implementedBy (B ))
465
- self .assertTrue (implementedBy (A ) > IFoo )
466
- self .assertTrue (implementedBy (A ) <= implementedBy (B ))
467
- self .assertTrue (implementedBy (A ) >= IFoo )
468
- self .assertTrue (implementedBy (A ) != IFoo )
460
+ self .assertLess (implementedBy (A ), None )
461
+ self .assertGreater (
462
+ None ,
463
+ implementedBy (A )
464
+ )
465
+ self .assertLess (implementedBy (A ), implementedBy (B ))
466
+ self .assertGreater (implementedBy (A ), IFoo )
467
+ self .assertLessEqual (implementedBy (A ), implementedBy (B ))
468
+ self .assertGreaterEqual (implementedBy (A ), IFoo )
469
+ self .assertNotEqual (implementedBy (A ), IFoo )
469
470
470
471
def test_proxy_equality (self ):
471
472
# https://github.com/zopefoundation/zope.interface/issues/55
@@ -496,19 +497,20 @@ class B:
496
497
497
498
# The order of arguments to the operators matters,
498
499
# test both
499
- self .assertTrue (
500
- implementedByA == implementedByA
501
- ) # pylint:disable=comparison-with-itself
502
- self .assertTrue (implementedByA != implementedByB )
503
- self .assertTrue (implementedByB != implementedByA )
500
+ self .assertEqual (
501
+ implementedByA ,
502
+ implementedByA
503
+ )
504
+ self .assertNotEqual (implementedByA , implementedByB )
505
+ self .assertNotEqual (implementedByB , implementedByA )
504
506
505
- self .assertTrue (proxy == implementedByA )
506
- self .assertTrue (implementedByA == proxy )
507
- self .assertFalse (proxy != implementedByA )
508
- self .assertFalse (implementedByA != proxy )
507
+ self .assertEqual (proxy , implementedByA )
508
+ self .assertEqual (implementedByA , proxy )
509
+ self .assertEqual (proxy , implementedByA )
510
+ self .assertEqual (implementedByA , proxy )
509
511
510
- self .assertTrue (proxy != implementedByB )
511
- self .assertTrue (implementedByB != proxy )
512
+ self .assertNotEqual (proxy , implementedByB )
513
+ self .assertNotEqual (implementedByB , proxy )
512
514
513
515
def test_changed_deletes_super_cache (self ):
514
516
impl = self ._makeOne ()
@@ -581,7 +583,7 @@ class Foo:
581
583
with _MonkeyDict (declarations ,
582
584
'BuiltinImplementationSpecifications' ) as specs :
583
585
specs [foo ] = reg
584
- self .assertTrue (self ._callFUT (foo ) is reg )
586
+ self .assertIs (self ._callFUT (foo ), reg )
585
587
586
588
def test_dictless_w_existing_Implements (self ):
587
589
from zope .interface .declarations import Implements
@@ -592,7 +594,7 @@ class Foo:
592
594
593
595
foo = Foo ()
594
596
foo .__implemented__ = impl
595
- self .assertTrue (self ._callFUT (foo ) is impl )
597
+ self .assertIs (self ._callFUT (foo ), impl )
596
598
597
599
def test_dictless_w_existing_not_Implements (self ):
598
600
from zope .interface .interface import InterfaceClass
@@ -612,7 +614,7 @@ def test_w_existing_attr_as_Implements(self):
612
614
class Foo :
613
615
__implemented__ = impl
614
616
615
- self .assertTrue (self ._callFUT (Foo ) is impl )
617
+ self .assertIs (self ._callFUT (Foo ), impl )
616
618
617
619
def test_builtins_added_to_cache (self ):
618
620
from zope .interface import declarations
@@ -637,9 +639,9 @@ def test_builtins_w_existing_cache(self):
637
639
specs [tuple ] = t_spec
638
640
specs [list ] = l_spec
639
641
specs [dict ] = d_spec
640
- self .assertTrue (self ._callFUT (tuple ) is t_spec )
641
- self .assertTrue (self ._callFUT (list ) is l_spec )
642
- self .assertTrue (self ._callFUT (dict ) is d_spec )
642
+ self .assertIs (self ._callFUT (tuple ), t_spec )
643
+ self .assertIs (self ._callFUT (list ), l_spec )
644
+ self .assertIs (self ._callFUT (dict ), d_spec )
643
645
644
646
def test_oldstyle_class_no_assertions (self ):
645
647
# TODO: Figure out P3 story
@@ -714,7 +716,7 @@ def test_w_existing_Implements(self):
714
716
class Foo :
715
717
__implemented__ = impl
716
718
717
- self .assertTrue (self ._callFUT (Foo ) is impl )
719
+ self .assertIs (self ._callFUT (Foo ), impl )
718
720
719
721
def test_super_when_base_implements_interface (self ):
720
722
from zope .interface import Interface
@@ -963,7 +965,7 @@ class Foo:
963
965
impl .inherit = Foo
964
966
self ._callFUT (Foo , IBar )
965
967
# Same spec, now different values
966
- self .assertTrue (Foo .__implemented__ is impl )
968
+ self .assertIs (Foo .__implemented__ , impl )
967
969
self .assertEqual (impl .inherit , None )
968
970
self .assertEqual (impl .declared , (IBar ,))
969
971
@@ -1172,7 +1174,7 @@ class Foo:
1172
1174
foo = Foo ()
1173
1175
decorator = self ._makeOne (IFoo )
1174
1176
returned = decorator (foo )
1175
- self .assertTrue (returned is foo )
1177
+ self .assertIs (returned , foo )
1176
1178
spec = foo .__implemented__ # pylint:disable=no-member
1177
1179
self .assertEqual (
1178
1180
spec .__name__ , 'zope.interface.tests.test_declarations.?'
@@ -1564,7 +1566,7 @@ class Foo:
1564
1566
with _Monkey (declarations , InstanceDeclarations = cache ):
1565
1567
spec = self ._callFUT (Foo , IFoo )
1566
1568
self .assertEqual (list (spec ), [IFoo ])
1567
- self .assertTrue (cache [(Foo , IFoo )] is spec )
1569
+ self .assertIs (cache [(Foo , IFoo )], spec )
1568
1570
1569
1571
def test_w_cached_spec (self ):
1570
1572
from zope .interface import declarations
@@ -1578,7 +1580,7 @@ class Foo:
1578
1580
cache = {(Foo , IFoo ): prior }
1579
1581
with _Monkey (declarations , InstanceDeclarations = cache ):
1580
1582
spec = self ._callFUT (Foo , IFoo )
1581
- self .assertTrue (spec is prior )
1583
+ self .assertIs (spec , prior )
1582
1584
1583
1585
1584
1586
class Test_directlyProvides (unittest .TestCase ):
@@ -1775,7 +1777,7 @@ class Foo:
1775
1777
pass
1776
1778
1777
1779
cpbp = Foo .__provides__ = self ._makeOne (Foo , IFoo )
1778
- self .assertTrue (Foo .__provides__ is cpbp )
1780
+ self .assertIs (Foo .__provides__ , cpbp )
1779
1781
1780
1782
def test_w_same_class_via_instance (self ):
1781
1783
from zope .interface .interface import InterfaceClass
@@ -1841,7 +1843,7 @@ class Foo:
1841
1843
pass
1842
1844
1843
1845
cp = Foo .__provides__ = self ._makeOne (Foo , type (Foo ), IBar )
1844
- self .assertTrue (Foo .__provides__ is cp )
1846
+ self .assertIs (Foo .__provides__ , cp )
1845
1847
self .assertEqual (list (Foo ().__provides__ ), [IFoo ])
1846
1848
1847
1849
def test___reduce__ (self ):
@@ -2323,7 +2325,7 @@ class Foo:
2323
2325
foo .__providedBy__ = object ()
2324
2326
expected = foo .__provides__ = object ()
2325
2327
spec = self ._callFUT (foo )
2326
- self .assertTrue (spec is expected )
2328
+ self .assertIs (spec , expected )
2327
2329
2328
2330
def test_w_providedBy_invalid_spec_w_provides_diff_provides_on_class (self ):
2329
2331
@@ -2335,7 +2337,7 @@ class Foo:
2335
2337
expected = foo .__provides__ = object ()
2336
2338
Foo .__provides__ = object ()
2337
2339
spec = self ._callFUT (foo )
2338
- self .assertTrue (spec is expected )
2340
+ self .assertIs (spec , expected )
2339
2341
2340
2342
def test_w_providedBy_invalid_spec_w_provides_same_provides_on_class (self ):
2341
2343
from zope .interface .declarations import implementer
0 commit comments