make property deletions evaluate to false for convenience

This commit is contained in:
Jakob Ketterl 2021-06-01 11:37:51 +02:00
parent 85a58eefa9
commit 845f937fa3
2 changed files with 10 additions and 1 deletions

View File

@ -11,7 +11,8 @@ class PropertyError(Exception):
class PropertyDeletion(object):
pass
def __bool__(self):
return False
# a special object that will be sent in events when a deletion occured

View File

@ -0,0 +1,8 @@
from unittest import TestCase
from owrx.property import PropertyDeletion
class PropertyDeletionTest(TestCase):
def testDeletionEvaluatesToFalse(self):
deletion = PropertyDeletion()
self.assertFalse(deletion)