Skip to content

Commit

Permalink
added example on list comprehension
Browse files Browse the repository at this point in the history
  • Loading branch information
Hans Sebastian committed Mar 1, 2012
1 parent bdf6d03 commit 6b4c714
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions python/native_datatypes/test_lists.py
@@ -1,9 +1,10 @@
import logging
import math
import os


logging.basicConfig(format='%(asctime)s %(levelname)-8s %(message)s',
filemode='w', level=logging.INFO)
logging.basicConfig(format='%(asctime)s %(levelname)-8s %(message)s', filename="debug.log", filemode='w',
level=logging.INFO)


class TestLists(object):
Expand All @@ -23,6 +24,13 @@ def test_negative_list_indices(self):
days_week += days[i]
assert days_week == 'mtwtfss'

def test_mapping_list(self):
maximum = 10
cube_sides = range(1, maximum)
cube_volumes = [ side * side * side for side in cube_sides]
for side in cube_sides:
assert int(math.pow(side, 3)) == cube_volumes.pop(0)

def test_adding_items(self):
raise AssertionError, "TODO"

Expand Down

0 comments on commit 6b4c714

Please sign in to comment.