In [7]: a=2
In [8]: assert a is 0 or 1
In [9]: assert (a is 0 or 1)
In [10]: assert a is 0
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-10-84d2b10b4afa> in <module>
----> 1 assert a is 0
AssertionError:
In [11]: assert a == 0
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-11-4321e3980dbd> in <module>
----> 1 assert a == 0
AssertionError:
In [12]: assert a == 0 or 1
In [13]: assert(a == 0 or 1)
In [15]: assert a in (0 , 1)
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-15-51fbe2680d83> in <module>
----> 1 assert a in (0 , 1)
AssertionError:
In [16]: assert a in (0, 1, 2)
This assert's result is unexpected. https://github.com/lizhihao6/Forward-Warp/blob/master/Forward_Warp/forward_warp.py#L19
So I will stick to use "assert x in (...)"