Skip to content

Commit 6883b90

Browse files
committed
Fix tests
- Update setup.py
1 parent 4265e91 commit 6883b90

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

expression/core/option.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ def __match__(self, pattern: Any) -> Iterable[TSource]:
211211
return []
212212

213213
def __lt__(self, other: Any) -> bool:
214-
# if isinstance(other, Some):
215-
# return self._value < other._value # type: ignore
214+
if isinstance(other, Some):
215+
return self._value < other._value # type: ignore
216216
return False
217217

218218
def __eq__(self, other: Any) -> bool:

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
long_description=long_description,
1919
long_description_content_type="text/markdown",
2020
author="Dag Brattli",
21-
author_email="dag@brattli.net",
21+
author_email="dag.brattli@cognite.com",
2222
license="MIT License",
23-
url="https://github.com/dbrattli/expression",
24-
download_url="https://github.com/dbrattli/expression",
23+
url="https://github.com/cognitedata/expression",
24+
download_url="https://github.com/cognitedata/expression",
2525
zip_safe=True,
2626
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
2727
classifiers=[

tests/test_frozenlist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def unfolder(state: int) -> Option[Tuple[int, int]]:
206206
return Some((state, state + 1))
207207
return Nothing
208208

209-
result = frozenlist.unfold(unfolder, 0)
209+
result = pipe(0, frozenlist.unfold(unfolder))
210210

211211
assert list(result) == list(range(x))
212212

tests/test_seq.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import functools
22
from itertools import accumulate
3-
from typing import Callable, Generator, Iterable, List
3+
from typing import Callable, Generator, Iterable, List, Tuple
44

55
import pytest
66
from expression import effect
77
from expression.collections import Seq, seq
8-
from expression.core import pipe
8+
from expression.core import Nothing, Option, Some, pipe
99
from hypothesis import given
1010
from hypothesis import strategies as st
1111

@@ -100,6 +100,18 @@ def test_seq_fold_fluent(xs: List[int], s: int):
100100
assert value == sum(xs) + s
101101

102102

103+
@given(st.integers(max_value=100))
104+
def test_list_unfold(x: int):
105+
def unfolder(state: int) -> Option[Tuple[int, int]]:
106+
if state < x:
107+
return Some((state, state + 1))
108+
return Nothing
109+
110+
result = pipe(0, seq.unfold(unfolder))
111+
112+
assert list(result) == list(range(x))
113+
114+
103115
@given(st.lists(st.integers(), min_size=1), st.integers())
104116
def test_seq_scan_pipe(xs: List[int], s: int):
105117
func: Callable[[int, int], int] = lambda s, v: s + v

0 commit comments

Comments
 (0)