feat: new alternate syntax and switch to black + isort (yeah, maybe not the best time, but that is done).

This commit is contained in:
Romain Dorgueil
2018-07-29 18:21:56 +01:00
parent 3094e43f9f
commit 89dda0dca6
123 changed files with 1672 additions and 1640 deletions

View File

@ -1,7 +1,7 @@
import pytest
from bonobo.util import sortedlist, ensure_tuple
from bonobo.util.collections import tuplize, cast
from bonobo.util import ensure_tuple, sortedlist
from bonobo.util.collections import cast, tuplize
def test_sortedlist():
@ -14,20 +14,20 @@ def test_sortedlist():
def test_ensure_tuple():
assert ensure_tuple('a') == ('a', )
assert ensure_tuple(('a', )) == ('a', )
assert ensure_tuple("a") == ("a",)
assert ensure_tuple(("a",)) == ("a",)
assert ensure_tuple(()) is ()
@pytest.mark.parametrize('tuplize', [tuplize, cast(tuple)])
@pytest.mark.parametrize("tuplize", [tuplize, cast(tuple)])
def test_tuplize(tuplize):
tuplized_lambda = tuplize(lambda: [1, 2, 3])
assert tuplized_lambda() == (1, 2, 3)
@tuplize
def some_generator():
yield 'c'
yield 'b'
yield 'a'
yield "c"
yield "b"
yield "a"
assert some_generator() == ('c', 'b', 'a')
assert some_generator() == ("c", "b", "a")