How to use assertIsNot method in autotest

Best Python code snippet using autotest_python

test_copy.py

Source:test_copy.py Github

copy

Full Screen

...90 def test_copy_list(self):91 x = [1, 2, 3]92 y = copy.copy(x)93 self.assertEqual(y, x)94 self.assertIsNot(y, x)95 x = []96 y = copy.copy(x)97 self.assertEqual(y, x)98 self.assertIsNot(y, x)99 def test_copy_tuple(self):100 x = (1, 2, 3)101 self.assertIs(copy.copy(x), x)102 x = ()103 self.assertIs(copy.copy(x), x)104 x = (1, 2, 3, [])105 self.assertIs(copy.copy(x), x)106 def test_copy_dict(self):107 x = {"foo": 1, "bar": 2}108 y = copy.copy(x)109 self.assertEqual(y, x)110 self.assertIsNot(y, x)111 x = {}112 y = copy.copy(x)113 self.assertEqual(y, x)114 self.assertIsNot(y, x)115 def test_copy_set(self):116 x = {1, 2, 3}117 y = copy.copy(x)118 self.assertEqual(y, x)119 self.assertIsNot(y, x)120 x = set()121 y = copy.copy(x)122 self.assertEqual(y, x)123 self.assertIsNot(y, x)124 def test_copy_frozenset(self):125 x = frozenset({1, 2, 3})126 self.assertIs(copy.copy(x), x)127 x = frozenset()128 self.assertIs(copy.copy(x), x)129 def test_copy_bytearray(self):130 x = bytearray(b'abc')131 y = copy.copy(x)132 self.assertEqual(y, x)133 self.assertIsNot(y, x)134 x = bytearray()135 y = copy.copy(x)136 self.assertEqual(y, x)137 self.assertIsNot(y, x)138 def test_copy_inst_vanilla(self):139 class C:140 def __init__(self, foo):141 self.foo = foo142 def __eq__(self, other):143 return self.foo == other.foo144 x = C(42)145 self.assertEqual(copy.copy(x), x)146 def test_copy_inst_copy(self):147 class C:148 def __init__(self, foo):149 self.foo = foo150 def __copy__(self):151 return C(self.foo)152 def __eq__(self, other):153 return self.foo == other.foo154 x = C(42)155 self.assertEqual(copy.copy(x), x)156 def test_copy_inst_getinitargs(self):157 class C:158 def __init__(self, foo):159 self.foo = foo160 def __getinitargs__(self):161 return (self.foo,)162 def __eq__(self, other):163 return self.foo == other.foo164 x = C(42)165 self.assertEqual(copy.copy(x), x)166 def test_copy_inst_getnewargs(self):167 class C(int):168 def __new__(cls, foo):169 self = int.__new__(cls)170 self.foo = foo171 return self172 def __getnewargs__(self):173 return self.foo,174 def __eq__(self, other):175 return self.foo == other.foo176 x = C(42)177 y = copy.copy(x)178 self.assertIsInstance(y, C)179 self.assertEqual(y, x)180 self.assertIsNot(y, x)181 self.assertEqual(y.foo, x.foo)182 def test_copy_inst_getnewargs_ex(self):183 class C(int):184 def __new__(cls, *, foo):185 self = int.__new__(cls)186 self.foo = foo187 return self188 def __getnewargs_ex__(self):189 return (), {'foo': self.foo}190 def __eq__(self, other):191 return self.foo == other.foo192 x = C(foo=42)193 y = copy.copy(x)194 self.assertIsInstance(y, C)195 self.assertEqual(y, x)196 self.assertIsNot(y, x)197 self.assertEqual(y.foo, x.foo)198 def test_copy_inst_getstate(self):199 class C:200 def __init__(self, foo):201 self.foo = foo202 def __getstate__(self):203 return {"foo": self.foo}204 def __eq__(self, other):205 return self.foo == other.foo206 x = C(42)207 self.assertEqual(copy.copy(x), x)208 def test_copy_inst_setstate(self):209 class C:210 def __init__(self, foo):211 self.foo = foo212 def __setstate__(self, state):213 self.foo = state["foo"]214 def __eq__(self, other):215 return self.foo == other.foo216 x = C(42)217 self.assertEqual(copy.copy(x), x)218 def test_copy_inst_getstate_setstate(self):219 class C:220 def __init__(self, foo):221 self.foo = foo222 def __getstate__(self):223 return self.foo224 def __setstate__(self, state):225 self.foo = state226 def __eq__(self, other):227 return self.foo == other.foo228 x = C(42)229 self.assertEqual(copy.copy(x), x)230 # State with boolean value is false (issue #25718)231 x = C(0.0)232 self.assertEqual(copy.copy(x), x)233 # The deepcopy() method234 def test_deepcopy_basic(self):235 x = 42236 y = copy.deepcopy(x)237 self.assertEqual(y, x)238 def test_deepcopy_memo(self):239 # Tests of reflexive objects are under type-specific sections below.240 # This tests only repetitions of objects.241 x = []242 x = [x, x]243 y = copy.deepcopy(x)244 self.assertEqual(y, x)245 self.assertIsNot(y, x)246 self.assertIsNot(y[0], x[0])247 self.assertIs(y[0], y[1])248 def test_deepcopy_issubclass(self):249 # XXX Note: there's no way to test the TypeError coming out of250 # issubclass() -- this can only happen when an extension251 # module defines a "type" that doesn't formally inherit from252 # type.253 class Meta(type):254 pass255 class C(metaclass=Meta):256 pass257 self.assertEqual(copy.deepcopy(C), C)258 def test_deepcopy_deepcopy(self):259 class C(object):260 def __init__(self, foo):261 self.foo = foo262 def __deepcopy__(self, memo=None):263 return C(self.foo)264 x = C(42)265 y = copy.deepcopy(x)266 self.assertEqual(y.__class__, x.__class__)267 self.assertEqual(y.foo, x.foo)268 def test_deepcopy_registry(self):269 class C(object):270 def __new__(cls, foo):271 obj = object.__new__(cls)272 obj.foo = foo273 return obj274 def pickle_C(obj):275 return (C, (obj.foo,))276 x = C(42)277 self.assertRaises(TypeError, copy.deepcopy, x)278 copyreg.pickle(C, pickle_C, C)279 y = copy.deepcopy(x)280 def test_deepcopy_reduce_ex(self):281 class C(object):282 def __reduce_ex__(self, proto):283 c.append(1)284 return ""285 def __reduce__(self):286 self.fail("shouldn't call this")287 c = []288 x = C()289 y = copy.deepcopy(x)290 self.assertIs(y, x)291 self.assertEqual(c, [1])292 def test_deepcopy_reduce(self):293 class C(object):294 def __reduce__(self):295 c.append(1)296 return ""297 c = []298 x = C()299 y = copy.deepcopy(x)300 self.assertIs(y, x)301 self.assertEqual(c, [1])302 def test_deepcopy_cant(self):303 class C(object):304 def __getattribute__(self, name):305 if name.startswith("__reduce"):306 raise AttributeError(name)307 return object.__getattribute__(self, name)308 x = C()309 self.assertRaises(copy.Error, copy.deepcopy, x)310 # Type-specific _deepcopy_xxx() methods311 def test_deepcopy_atomic(self):312 class Classic:313 pass314 class NewStyle(object):315 pass316 def f():317 pass318 tests = [None, 42, 2**100, 3.14, True, False, 1j,319 "hello", "hello\u1234", f.__code__,320 NewStyle, Classic, max]321 for x in tests:322 self.assertIs(copy.deepcopy(x), x)323 def test_deepcopy_list(self):324 x = [[1, 2], 3]325 y = copy.deepcopy(x)326 self.assertEqual(y, x)327 self.assertIsNot(x, y)328 self.assertIsNot(x[0], y[0])329 def test_deepcopy_reflexive_list(self):330 x = []331 x.append(x)332 y = copy.deepcopy(x)333 for op in comparisons:334 self.assertRaises(RecursionError, op, y, x)335 self.assertIsNot(y, x)336 self.assertIs(y[0], y)337 self.assertEqual(len(y), 1)338 def test_deepcopy_empty_tuple(self):339 x = ()340 y = copy.deepcopy(x)341 self.assertIs(x, y)342 def test_deepcopy_tuple(self):343 x = ([1, 2], 3)344 y = copy.deepcopy(x)345 self.assertEqual(y, x)346 self.assertIsNot(x, y)347 self.assertIsNot(x[0], y[0])348 def test_deepcopy_tuple_of_immutables(self):349 x = ((1, 2), 3)350 y = copy.deepcopy(x)351 self.assertIs(x, y)352 def test_deepcopy_reflexive_tuple(self):353 x = ([],)354 x[0].append(x)355 y = copy.deepcopy(x)356 for op in comparisons:357 self.assertRaises(RecursionError, op, y, x)358 self.assertIsNot(y, x)359 self.assertIsNot(y[0], x[0])360 self.assertIs(y[0][0], y)361 def test_deepcopy_dict(self):362 x = {"foo": [1, 2], "bar": 3}363 y = copy.deepcopy(x)364 self.assertEqual(y, x)365 self.assertIsNot(x, y)366 self.assertIsNot(x["foo"], y["foo"])367 def test_deepcopy_reflexive_dict(self):368 x = {}369 x['foo'] = x370 y = copy.deepcopy(x)371 for op in order_comparisons:372 self.assertRaises(TypeError, op, y, x)373 for op in equality_comparisons:374 self.assertRaises(RecursionError, op, y, x)375 self.assertIsNot(y, x)376 self.assertIs(y['foo'], y)377 self.assertEqual(len(y), 1)378 def test_deepcopy_keepalive(self):379 memo = {}380 x = []381 y = copy.deepcopy(x, memo)382 self.assertIs(memo[id(memo)][0], x)383 def test_deepcopy_dont_memo_immutable(self):384 memo = {}385 x = [1, 2, 3, 4]386 y = copy.deepcopy(x, memo)387 self.assertEqual(y, x)388 # There's the entry for the new list, and the keep alive.389 self.assertEqual(len(memo), 2)390 memo = {}391 x = [(1, 2)]392 y = copy.deepcopy(x, memo)393 self.assertEqual(y, x)394 # Tuples with immutable contents are immutable for deepcopy.395 self.assertEqual(len(memo), 2)396 def test_deepcopy_inst_vanilla(self):397 class C:398 def __init__(self, foo):399 self.foo = foo400 def __eq__(self, other):401 return self.foo == other.foo402 x = C([42])403 y = copy.deepcopy(x)404 self.assertEqual(y, x)405 self.assertIsNot(y.foo, x.foo)406 def test_deepcopy_inst_deepcopy(self):407 class C:408 def __init__(self, foo):409 self.foo = foo410 def __deepcopy__(self, memo):411 return C(copy.deepcopy(self.foo, memo))412 def __eq__(self, other):413 return self.foo == other.foo414 x = C([42])415 y = copy.deepcopy(x)416 self.assertEqual(y, x)417 self.assertIsNot(y, x)418 self.assertIsNot(y.foo, x.foo)419 def test_deepcopy_inst_getinitargs(self):420 class C:421 def __init__(self, foo):422 self.foo = foo423 def __getinitargs__(self):424 return (self.foo,)425 def __eq__(self, other):426 return self.foo == other.foo427 x = C([42])428 y = copy.deepcopy(x)429 self.assertEqual(y, x)430 self.assertIsNot(y, x)431 self.assertIsNot(y.foo, x.foo)432 def test_deepcopy_inst_getnewargs(self):433 class C(int):434 def __new__(cls, foo):435 self = int.__new__(cls)436 self.foo = foo437 return self438 def __getnewargs__(self):439 return self.foo,440 def __eq__(self, other):441 return self.foo == other.foo442 x = C([42])443 y = copy.deepcopy(x)444 self.assertIsInstance(y, C)445 self.assertEqual(y, x)446 self.assertIsNot(y, x)447 self.assertEqual(y.foo, x.foo)448 self.assertIsNot(y.foo, x.foo)449 def test_deepcopy_inst_getnewargs_ex(self):450 class C(int):451 def __new__(cls, *, foo):452 self = int.__new__(cls)453 self.foo = foo454 return self455 def __getnewargs_ex__(self):456 return (), {'foo': self.foo}457 def __eq__(self, other):458 return self.foo == other.foo459 x = C(foo=[42])460 y = copy.deepcopy(x)461 self.assertIsInstance(y, C)462 self.assertEqual(y, x)463 self.assertIsNot(y, x)464 self.assertEqual(y.foo, x.foo)465 self.assertIsNot(y.foo, x.foo)466 def test_deepcopy_inst_getstate(self):467 class C:468 def __init__(self, foo):469 self.foo = foo470 def __getstate__(self):471 return {"foo": self.foo}472 def __eq__(self, other):473 return self.foo == other.foo474 x = C([42])475 y = copy.deepcopy(x)476 self.assertEqual(y, x)477 self.assertIsNot(y, x)478 self.assertIsNot(y.foo, x.foo)479 def test_deepcopy_inst_setstate(self):480 class C:481 def __init__(self, foo):482 self.foo = foo483 def __setstate__(self, state):484 self.foo = state["foo"]485 def __eq__(self, other):486 return self.foo == other.foo487 x = C([42])488 y = copy.deepcopy(x)489 self.assertEqual(y, x)490 self.assertIsNot(y, x)491 self.assertIsNot(y.foo, x.foo)492 def test_deepcopy_inst_getstate_setstate(self):493 class C:494 def __init__(self, foo):495 self.foo = foo496 def __getstate__(self):497 return self.foo498 def __setstate__(self, state):499 self.foo = state500 def __eq__(self, other):501 return self.foo == other.foo502 x = C([42])503 y = copy.deepcopy(x)504 self.assertEqual(y, x)505 self.assertIsNot(y, x)506 self.assertIsNot(y.foo, x.foo)507 # State with boolean value is false (issue #25718)508 x = C([])509 y = copy.deepcopy(x)510 self.assertEqual(y, x)511 self.assertIsNot(y, x)512 self.assertIsNot(y.foo, x.foo)513 def test_deepcopy_reflexive_inst(self):514 class C:515 pass516 x = C()517 x.foo = x518 y = copy.deepcopy(x)519 self.assertIsNot(y, x)520 self.assertIs(y.foo, y)521 def test_deepcopy_range(self):522 class I(int):523 pass524 x = range(I(10))525 y = copy.deepcopy(x)526 self.assertIsNot(y, x)527 self.assertEqual(y, x)528 self.assertIsNot(y.stop, x.stop)529 self.assertEqual(y.stop, x.stop)530 self.assertIsInstance(y.stop, I)531 # _reconstruct()532 def test_reconstruct_string(self):533 class C(object):534 def __reduce__(self):535 return ""536 x = C()537 y = copy.copy(x)538 self.assertIs(y, x)539 y = copy.deepcopy(x)540 self.assertIs(y, x)541 def test_reconstruct_nostate(self):542 class C(object):543 def __reduce__(self):544 return (C, ())545 x = C()546 x.foo = 42547 y = copy.copy(x)548 self.assertIs(y.__class__, x.__class__)549 y = copy.deepcopy(x)550 self.assertIs(y.__class__, x.__class__)551 def test_reconstruct_state(self):552 class C(object):553 def __reduce__(self):554 return (C, (), self.__dict__)555 def __eq__(self, other):556 return self.__dict__ == other.__dict__557 x = C()558 x.foo = [42]559 y = copy.copy(x)560 self.assertEqual(y, x)561 y = copy.deepcopy(x)562 self.assertEqual(y, x)563 self.assertIsNot(y.foo, x.foo)564 def test_reconstruct_state_setstate(self):565 class C(object):566 def __reduce__(self):567 return (C, (), self.__dict__)568 def __setstate__(self, state):569 self.__dict__.update(state)570 def __eq__(self, other):571 return self.__dict__ == other.__dict__572 x = C()573 x.foo = [42]574 y = copy.copy(x)575 self.assertEqual(y, x)576 y = copy.deepcopy(x)577 self.assertEqual(y, x)578 self.assertIsNot(y.foo, x.foo)579 def test_reconstruct_reflexive(self):580 class C(object):581 pass582 x = C()583 x.foo = x584 y = copy.deepcopy(x)585 self.assertIsNot(y, x)586 self.assertIs(y.foo, y)587 # Additions for Python 2.3 and pickle protocol 2588 def test_reduce_4tuple(self):589 class C(list):590 def __reduce__(self):591 return (C, (), self.__dict__, iter(self))592 def __eq__(self, other):593 return (list(self) == list(other) and594 self.__dict__ == other.__dict__)595 x = C([[1, 2], 3])596 y = copy.copy(x)597 self.assertEqual(x, y)598 self.assertIsNot(x, y)599 self.assertIs(x[0], y[0])600 y = copy.deepcopy(x)601 self.assertEqual(x, y)602 self.assertIsNot(x, y)603 self.assertIsNot(x[0], y[0])604 def test_reduce_5tuple(self):605 class C(dict):606 def __reduce__(self):607 return (C, (), self.__dict__, None, self.items())608 def __eq__(self, other):609 return (dict(self) == dict(other) and610 self.__dict__ == other.__dict__)611 x = C([("foo", [1, 2]), ("bar", 3)])612 y = copy.copy(x)613 self.assertEqual(x, y)614 self.assertIsNot(x, y)615 self.assertIs(x["foo"], y["foo"])616 y = copy.deepcopy(x)617 self.assertEqual(x, y)618 self.assertIsNot(x, y)619 self.assertIsNot(x["foo"], y["foo"])620 def test_copy_slots(self):621 class C(object):622 __slots__ = ["foo"]623 x = C()624 x.foo = [42]625 y = copy.copy(x)626 self.assertIs(x.foo, y.foo)627 def test_deepcopy_slots(self):628 class C(object):629 __slots__ = ["foo"]630 x = C()631 x.foo = [42]632 y = copy.deepcopy(x)633 self.assertEqual(x.foo, y.foo)634 self.assertIsNot(x.foo, y.foo)635 def test_deepcopy_dict_subclass(self):636 class C(dict):637 def __init__(self, d=None):638 if not d:639 d = {}640 self._keys = list(d.keys())641 super().__init__(d)642 def __setitem__(self, key, item):643 super().__setitem__(key, item)644 if key not in self._keys:645 self._keys.append(key)646 x = C(d={'foo':0})647 y = copy.deepcopy(x)648 self.assertEqual(x, y)649 self.assertEqual(x._keys, y._keys)650 self.assertIsNot(x, y)651 x['bar'] = 1652 self.assertNotEqual(x, y)653 self.assertNotEqual(x._keys, y._keys)654 def test_copy_list_subclass(self):655 class C(list):656 pass657 x = C([[1, 2], 3])658 x.foo = [4, 5]659 y = copy.copy(x)660 self.assertEqual(list(x), list(y))661 self.assertEqual(x.foo, y.foo)662 self.assertIs(x[0], y[0])663 self.assertIs(x.foo, y.foo)664 def test_deepcopy_list_subclass(self):665 class C(list):666 pass667 x = C([[1, 2], 3])668 x.foo = [4, 5]669 y = copy.deepcopy(x)670 self.assertEqual(list(x), list(y))671 self.assertEqual(x.foo, y.foo)672 self.assertIsNot(x[0], y[0])673 self.assertIsNot(x.foo, y.foo)674 def test_copy_tuple_subclass(self):675 class C(tuple):676 pass677 x = C([1, 2, 3])678 self.assertEqual(tuple(x), (1, 2, 3))679 y = copy.copy(x)680 self.assertEqual(tuple(y), (1, 2, 3))681 def test_deepcopy_tuple_subclass(self):682 class C(tuple):683 pass684 x = C([[1, 2], 3])685 self.assertEqual(tuple(x), ([1, 2], 3))686 y = copy.deepcopy(x)687 self.assertEqual(tuple(y), ([1, 2], 3))688 self.assertIsNot(x, y)689 self.assertIsNot(x[0], y[0])690 def test_getstate_exc(self):691 class EvilState(object):692 def __getstate__(self):693 raise ValueError("ain't got no stickin' state")694 self.assertRaises(ValueError, copy.copy, EvilState())695 def test_copy_function(self):696 self.assertEqual(copy.copy(global_foo), global_foo)697 def foo(x, y): return x+y698 self.assertEqual(copy.copy(foo), foo)699 bar = lambda: None700 self.assertEqual(copy.copy(bar), bar)701 def test_deepcopy_function(self):702 self.assertEqual(copy.deepcopy(global_foo), global_foo)703 def foo(x, y): return x+y704 self.assertEqual(copy.deepcopy(foo), foo)705 bar = lambda: None706 self.assertEqual(copy.deepcopy(bar), bar)707 def _check_weakref(self, _copy):708 class C(object):709 pass710 obj = C()711 x = weakref.ref(obj)712 y = _copy(x)713 self.assertIs(y, x)714 del obj715 y = _copy(x)716 self.assertIs(y, x)717 def test_copy_weakref(self):718 self._check_weakref(copy.copy)719 def test_deepcopy_weakref(self):720 self._check_weakref(copy.deepcopy)721 def _check_copy_weakdict(self, _dicttype):722 class C(object):723 pass724 a, b, c, d = [C() for i in range(4)]725 u = _dicttype()726 u[a] = b727 u[c] = d728 v = copy.copy(u)729 self.assertIsNot(v, u)730 self.assertEqual(v, u)731 self.assertEqual(v[a], b)732 self.assertEqual(v[c], d)733 self.assertEqual(len(v), 2)734 del c, d735 self.assertEqual(len(v), 1)736 x, y = C(), C()737 # The underlying containers are decoupled738 v[x] = y739 self.assertNotIn(x, u)740 def test_copy_weakkeydict(self):741 self._check_copy_weakdict(weakref.WeakKeyDictionary)742 def test_copy_weakvaluedict(self):743 self._check_copy_weakdict(weakref.WeakValueDictionary)744 def test_deepcopy_weakkeydict(self):745 class C(object):746 def __init__(self, i):747 self.i = i748 a, b, c, d = [C(i) for i in range(4)]749 u = weakref.WeakKeyDictionary()750 u[a] = b751 u[c] = d752 # Keys aren't copied, values are753 v = copy.deepcopy(u)754 self.assertNotEqual(v, u)755 self.assertEqual(len(v), 2)756 self.assertIsNot(v[a], b)757 self.assertIsNot(v[c], d)758 self.assertEqual(v[a].i, b.i)759 self.assertEqual(v[c].i, d.i)760 del c761 self.assertEqual(len(v), 1)762 def test_deepcopy_weakvaluedict(self):763 class C(object):764 def __init__(self, i):765 self.i = i766 a, b, c, d = [C(i) for i in range(4)]767 u = weakref.WeakValueDictionary()768 u[a] = b769 u[c] = d770 # Keys are copied, values aren't771 v = copy.deepcopy(u)772 self.assertNotEqual(v, u)773 self.assertEqual(len(v), 2)774 (x, y), (z, t) = sorted(v.items(), key=lambda pair: pair[0].i)775 self.assertIsNot(x, a)776 self.assertEqual(x.i, a.i)777 self.assertIs(y, b)778 self.assertIsNot(z, c)779 self.assertEqual(z.i, c.i)780 self.assertIs(t, d)781 del x, y, z, t782 del d783 self.assertEqual(len(v), 1)784 def test_deepcopy_bound_method(self):785 class Foo(object):786 def m(self):787 pass788 f = Foo()789 f.b = f.m790 g = copy.deepcopy(f)791 self.assertEqual(g.m, g.b)792 self.assertIs(g.b.__self__, g)...

Full Screen

Full Screen

test_bool.py

Source:test_bool.py Github

copy

Full Screen

...31 self.assertEqual(str(False), 'False')32 self.assertEqual(str(True), 'True')33 def test_int(self):34 self.assertEqual(int(False), 0)35 self.assertIsNot(int(False), False)36 self.assertEqual(int(True), 1)37 self.assertIsNot(int(True), True)38 def test_float(self):39 self.assertEqual(float(False), 0.0)40 self.assertIsNot(float(False), False)41 self.assertEqual(float(True), 1.0)42 self.assertIsNot(float(True), True)43 def test_long(self):44 self.assertEqual(long(False), 0L)45 self.assertIsNot(long(False), False)46 self.assertEqual(long(True), 1L)47 self.assertIsNot(long(True), True)48 def test_math(self):49 self.assertEqual(+False, 0)50 self.assertIsNot(+False, False)51 self.assertEqual(-False, 0)52 self.assertIsNot(-False, False)53 self.assertEqual(abs(False), 0)54 self.assertIsNot(abs(False), False)55 self.assertEqual(+True, 1)56 self.assertIsNot(+True, True)57 self.assertEqual(-True, -1)58 self.assertEqual(abs(True), 1)59 self.assertIsNot(abs(True), True)60 self.assertEqual(~False, -1)61 self.assertEqual(~True, -2)62 self.assertEqual(False+2, 2)63 self.assertEqual(True+2, 3)64 self.assertEqual(2+False, 2)65 self.assertEqual(2+True, 3)66 self.assertEqual(False+False, 0)67 self.assertIsNot(False+False, False)68 self.assertEqual(False+True, 1)69 self.assertIsNot(False+True, True)70 self.assertEqual(True+False, 1)71 self.assertIsNot(True+False, True)72 self.assertEqual(True+True, 2)73 self.assertEqual(True-True, 0)74 self.assertIsNot(True-True, False)75 self.assertEqual(False-False, 0)76 self.assertIsNot(False-False, False)77 self.assertEqual(True-False, 1)78 self.assertIsNot(True-False, True)79 self.assertEqual(False-True, -1)80 self.assertEqual(True*1, 1)81 self.assertEqual(False*1, 0)82 self.assertIsNot(False*1, False)83 self.assertEqual(True//1, 1)84 self.assertIsNot(True//1, True)85 self.assertEqual(False//1, 0)86 self.assertIsNot(False//1, False)87 for b in False, True:88 for i in 0, 1, 2:89 self.assertEqual(b**i, int(b)**i)90 self.assertIsNot(b**i, bool(int(b)**i))91 for a in False, True:92 for b in False, True:93 self.assertIs(a&b, bool(int(a)&int(b)))94 self.assertIs(a|b, bool(int(a)|int(b)))95 self.assertIs(a^b, bool(int(a)^int(b)))96 self.assertEqual(a&int(b), int(a)&int(b))97 self.assertIsNot(a&int(b), bool(int(a)&int(b)))98 self.assertEqual(a|int(b), int(a)|int(b))99 self.assertIsNot(a|int(b), bool(int(a)|int(b)))100 self.assertEqual(a^int(b), int(a)^int(b))101 self.assertIsNot(a^int(b), bool(int(a)^int(b)))102 self.assertEqual(int(a)&b, int(a)&int(b))103 self.assertIsNot(int(a)&b, bool(int(a)&int(b)))104 self.assertEqual(int(a)|b, int(a)|int(b))105 self.assertIsNot(int(a)|b, bool(int(a)|int(b)))106 self.assertEqual(int(a)^b, int(a)^int(b))107 self.assertIsNot(int(a)^b, bool(int(a)^int(b)))108 self.assertIs(1==1, True)109 self.assertIs(1==0, False)110 self.assertIs(0<1, True)111 self.assertIs(1<0, False)112 self.assertIs(0<=0, True)113 self.assertIs(1<=0, False)114 self.assertIs(1>0, True)115 self.assertIs(1>1, False)116 self.assertIs(1>=1, True)117 self.assertIs(0>=1, False)118 self.assertIs(0!=1, True)119 self.assertIs(0!=0, False)120 x = [1]121 self.assertIs(x is x, True)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful