Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
added examples of assigning multiple values and consecutive values
- Loading branch information
Hans Sebastian
committed
Mar 1, 2012
1 parent
75987d5
commit bdf6d03
Showing
1 changed file
with
16 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,21 @@ | ||
import types | ||
|
||
|
||
class TestAssignment(object): | ||
def test_assigning_multiple_values_at_once(self): | ||
raise AssertionError | ||
comics = ('dono', 'kasino', 'indro') | ||
assert len(comics) == 3 | ||
x, y, z = comics | ||
assert x == 'dono' | ||
assert y == comics[1] | ||
assert z == 'indro' | ||
|
||
|
||
def test_assigning_consecutive_values(self): | ||
raise AssertionError | ||
length = 6 | ||
my_list = range(length) | ||
assert type(my_list) == types.ListType | ||
a, b, c, d, e, f = range(length) | ||
assert type(a) == types.IntType | ||
assert a == my_list[0] | ||
|