Skip to content

Commit 2937755

Browse files
committed
Adds hash test for IO
1 parent 06b9a7a commit 2937755

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ We follow Semantic Versions since the `0.1.0` release.
55

66
## 0.10.0 WIP
77

8+
### Features
9+
10+
- Adds `__hash__` magic methods to all containers
11+
812
### Misc
913

1014
- Updates `mypy` version

tests/test_io/test_io_equality.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# -*- coding: utf-8 -*-
2+
3+
import pytest
4+
5+
from returns.io import IO
6+
7+
8+
def test_equality():
9+
"""Ensures that containers can be compared."""
10+
assert IO(1) == IO(1)
11+
assert str(IO(1)) == '<IO: 1>'
12+
assert hash(IO(1))
13+
14+
15+
def test_nonequality():
16+
"""Ensures that containers are not compared to regular values."""
17+
assert IO(1) != 1
18+
assert IO(1) is not IO(1)
19+
assert IO(1) != IO(2)

0 commit comments

Comments
 (0)