File: test_compose.py

package info (click to toggle)
python-returns 0.26.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,652 kB
  • sloc: python: 11,000; makefile: 18
file content (17 lines) | stat: -rw-r--r-- 408 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from returns.functions import compose


def _first(argument: int) -> str:
    return str(argument)


def _second(argument: str) -> bool:
    return bool(argument)


def test_function_composition():
    """Ensures that functions can be composed and return type is correct."""
    second_after_first = compose(_first, _second)

    assert second_after_first(1) is True
    assert second_after_first(0) is True