1
0
mirror of https://github.com/django/django.git synced 2024-12-25 02:26:12 +00:00
django/tests/utils_tests/test_deprecation.py
Olexander Yermakov b7fb608142 Fixed #27154 -- Allowed comparing CallableBool with bitwise or.
Thanks Tim for the review.
2016-08-31 08:27:37 -04:00

28 lines
1.0 KiB
Python

from django.test import SimpleTestCase
from django.utils.deprecation import CallableFalse, CallableTrue
class TestCallableBool(SimpleTestCase):
def test_true(self):
self.assertTrue(CallableTrue)
self.assertEqual(CallableTrue, True)
self.assertFalse(CallableTrue != True) # noqa: E712
self.assertNotEqual(CallableTrue, False)
def test_false(self):
self.assertFalse(CallableFalse)
self.assertEqual(CallableFalse, False)
self.assertFalse(CallableFalse != False) # noqa: E712
self.assertNotEqual(CallableFalse, True)
def test_or(self):
self.assertIs(CallableTrue | CallableTrue, True)
self.assertIs(CallableTrue | CallableFalse, True)
self.assertIs(CallableFalse | CallableTrue, True)
self.assertIs(CallableFalse | CallableFalse, False)
self.assertIs(CallableTrue | True, True)
self.assertIs(CallableTrue | False, True)
self.assertIs(CallableFalse | True, True)
self.assertFalse(CallableFalse | False, False)