-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add representations for core.FillInto, variables.Variable, flow.{Slic…
…e,Reverse,CountFrom}, improve and develop tests.
- Loading branch information
1 parent
ec3937e
commit 79f3f93
Showing
6 changed files
with
106 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import pytest | ||
|
||
from lena.core import Source, Sequence | ||
from lena.flow import Count, Slice | ||
|
||
from tests.shortcuts import cnt0 | ||
|
||
|
||
def test_repr_sequence(): | ||
# zero-element sequence works | ||
s01 = Sequence() | ||
assert repr(s01) == "Sequence()" | ||
|
||
# one-element sequence works | ||
s02 = Sequence(Sequence()) | ||
assert repr(s02) == "Sequence(\n Sequence()\n)" | ||
|
||
# nesting works | ||
s03 = Sequence(Sequence(Sequence())) | ||
# print(s03) | ||
assert repr(s03) == "Sequence(\n Sequence(\n Sequence()\n )\n)" | ||
|
||
|
||
def test_repr_source(): | ||
# not Lena elements can also be represented | ||
cnt = cnt0 | ||
slice1 = Slice(1) | ||
|
||
# representation with one element works | ||
s1 = Source(cnt) | ||
mnl = "\n" | ||
# print(s1) | ||
assert repr(s1) == "".join(["Source(", mnl, | ||
" "*4, repr(cnt), mnl, ")"]) | ||
|
||
# representation with two elements works | ||
s2 = Source(cnt, slice1) | ||
# print(s2) | ||
assert repr(s2) == "".join(["Source(", mnl, | ||
" "*4, repr(cnt), ",", mnl, | ||
" "*4, repr(slice1), mnl, ")"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters