-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: add concat #20
Merged
Merged
ENH: add concat #20
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ae50f6e
ENH: add concat
tacaswell f978df0
DOC: add concat to docs
tacaswell c3913ba
TST: make tests a less gameable
tacaswell b7df4b7
TST: update travis test matrix
tacaswell 1e11919
DOC: expand docstring
tacaswell 495d0f4
DOC: update other concat docstring
tacaswell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,10 @@ | |
|
||
import six | ||
from six.moves import zip, range | ||
from cycler import cycler, Cycler | ||
from cycler import cycler, Cycler, concat | ||
from nose.tools import (assert_equal, assert_not_equal, | ||
assert_raises, assert_true) | ||
from itertools import product, cycle | ||
from itertools import product, cycle, chain | ||
from operator import add, iadd, mul, imul | ||
|
||
|
||
|
@@ -279,3 +279,19 @@ def test_starange_init(): | |
c2 = cycler('lw', range(3)) | ||
cy = Cycler(list(c), list(c2), zip) | ||
assert_equal(cy, c + c2) | ||
|
||
|
||
def test_concat(): | ||
a = cycler('a', range(3)) | ||
for con, chn in zip(a.concat(a), chain(a, a)): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd be inclined to test this with two different cyclers, the way this is tested it would be possible to completely ignore the |
||
assert_equal(con, chn) | ||
|
||
for con, chn in zip(concat(a, a), chain(a, a)): | ||
assert_equal(con, chn) | ||
|
||
|
||
def test_concat_fail(): | ||
a = cycler('a', range(3)) | ||
b = cycler('b', range(3)) | ||
assert_raises(ValueError, concat, a, b) | ||
assert_raises(ValueError, a.concat, b) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great docstring - I'd be inclined to include the simplest possible example though, so that people can get a visual grasp of what is going on.