def test_equality(): """Ensures that containers can be compared.""" assert Nothing is Nothing # noqa: WPS312 assert Nothing == _Nothing() == _Nothing(None) assert Some(5) == Some(5) assert hash(Some(1)) assert hash(Nothing)
def test_nonequality(): """Ensures that containers are not compared to regular values.""" assert Nothing is not None assert Nothing != None # noqa: E711 assert _Nothing(None) is not None assert _Nothing(None) != None # noqa: E711 assert Some(5) != 5 and Some(3) is not Some(3)
def test_failure_immutable_deepcopy(): """Ensures that Failure returns it self when passed to deepcopy function.""" nothing = _Nothing() assert nothing is deepcopy(nothing)
def test_nothing_singleton(): """Ensures `_Nothing` is a singleton.""" assert _Nothing() is _Nothing()