Skip to content

Commit

Permalink
Refactor internal uses of .value (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
francium authored Jul 4, 2023
1 parent 81131fc commit 304226d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/result/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def __repr__(self) -> str:
return "Ok({})".format(repr(self._value))

def __eq__(self, other: Any) -> bool:
return isinstance(other, Ok) and self.value == other.value
return isinstance(other, Ok) and self._value == other._value

def __ne__(self, other: Any) -> bool:
return not (self == other)
Expand Down Expand Up @@ -194,7 +194,7 @@ def __repr__(self) -> str:
return "Err({})".format(repr(self._value))

def __eq__(self, other: Any) -> bool:
return isinstance(other, Err) and self.value == other.value
return isinstance(other, Err) and self._value == other._value

def __ne__(self, other: Any) -> bool:
return not (self == other)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ def test_ok() -> None:
res = Ok('haha')
assert res.is_ok() is True
assert res.is_err() is False
assert res.value == 'haha'
assert res.ok_value == 'haha'


def test_err() -> None:
res = Err(':(')
assert res.is_ok() is False
assert res.is_err() is True
assert res.value == ':('
assert res.err_value == ':('


def test_ok_method() -> None:
Expand Down

0 comments on commit 304226d

Please sign in to comment.