Skip to content

Commit

Permalink
Add boilerplate (empty) code for remaining lessons
Browse files Browse the repository at this point in the history
  • Loading branch information
Ignacio Avas committed May 2, 2017
1 parent bf1a5b9 commit 9e8a253
Show file tree
Hide file tree
Showing 34 changed files with 645 additions and 10 deletions.
6 changes: 4 additions & 2 deletions py101/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from story.story import BaseStory
from story.translation import gettext as _

from . import (introduction, variables, lists, operators, formatting)
from . import (introduction, variables, lists, operators, formatting, strings, conditions, loops,
functions, classes, dictionaries, modules)


__author__ = """Sophilabs"""
Expand All @@ -13,4 +14,5 @@ class Story(BaseStory):
"""Python Essentials Adventure"""
name = 'py101'
title = _('Learn Python essentials using the command line')
adventures = (introduction, variables, lists, operators, formatting)
adventures = (introduction, variables, lists, operators, formatting, strings, conditions, loops,
functions, classes, dictionaries, modules)
3 changes: 2 additions & 1 deletion py101/boilerplate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@


class TestOutput(unittest.TestCase):
"""Variables Adventure test"""
"""Adventure test"""

def __init__(self, candidate_code, file_name='<inline>'):
"""Init the test"""
super(TestOutput, self).__init__()
Expand Down
14 changes: 14 additions & 0 deletions py101/classes/README.es.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Boilerplate
-----------

Insertar alguna introducción aquí.

.. sourcecode:: python

print('Some python code here')


Desafío
-------

Describir el desafío aquí.
14 changes: 14 additions & 0 deletions py101/classes/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Boilerplate
-----------

Insert some introduction here.

.. sourcecode:: python

print('Some python code here')


Challenge
---------

Describe the challenge here
3 changes: 3 additions & 0 deletions py101/classes/SOLUTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.. sourcecode:: python

print('Some solution here')
51 changes: 51 additions & 0 deletions py101/classes/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
""""
Classes Adventure
Author: Ignacio Avas ([email protected])
"""
import codecs
import io
import sys
import unittest
from story.adventures import AdventureVerificationError, BaseAdventure
from story.translation import gettext as _


class TestOutput(unittest.TestCase):
"""Adventure test"""

def __init__(self, candidate_code, file_name='<inline>'):
"""Init the test"""
super(TestOutput, self).__init__()
self.candidate_code = candidate_code
self.file_name = file_name

def setUp(self):
self.__old_stdout = sys.stdout
sys.stdout = self.__mockstdout = io.StringIO()

def tearDown(self):
sys.stdout = self.__old_stdout
self.__mockstdout.close()

def runTest(self):
"""Makes a simple test of the output"""

#code = compile(self.candidate_code, self.file_name, 'exec', optimize=0)
#exec(code)
self.fail("Test not implemented")


class Adventure(BaseAdventure):
"""Classes Adventure"""
title = _('Classes')

@classmethod
def test(cls, sourcefile):
"""Test against the provided file"""
suite = unittest.TestSuite()
raw_program = codecs.open(sourcefile).read()
suite.addTest(TestOutput(raw_program, sourcefile))
result = unittest.TextTestRunner().run(suite)
if not result.wasSuccessful():
raise AdventureVerificationError()
14 changes: 14 additions & 0 deletions py101/conditions/README.es.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Boilerplate
-----------

Insertar alguna introducción aquí.

.. sourcecode:: python

print('Some python code here')


Desafío
-------

Describir el desafío aquí.
14 changes: 14 additions & 0 deletions py101/conditions/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Boilerplate
-----------

Insert some introduction here.

.. sourcecode:: python

print('Some python code here')


Challenge
---------

Describe the challenge here
3 changes: 3 additions & 0 deletions py101/conditions/SOLUTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.. sourcecode:: python

print('Some solution here')
51 changes: 51 additions & 0 deletions py101/conditions/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
""""
Conditions Adventure
Author: Ignacio Avas ([email protected])
"""
import codecs
import io
import sys
import unittest
from story.adventures import AdventureVerificationError, BaseAdventure
from story.translation import gettext as _


class TestOutput(unittest.TestCase):
"""Adventure test"""

def __init__(self, candidate_code, file_name='<inline>'):
"""Init the test"""
super(TestOutput, self).__init__()
self.candidate_code = candidate_code
self.file_name = file_name

def setUp(self):
self.__old_stdout = sys.stdout
sys.stdout = self.__mockstdout = io.StringIO()

def tearDown(self):
sys.stdout = self.__old_stdout
self.__mockstdout.close()

def runTest(self):
"""Makes a simple test of the output"""

#code = compile(self.candidate_code, self.file_name, 'exec', optimize=0)
#exec(code)
self.fail("Test not implemented")


class Adventure(BaseAdventure):
"""Conditions Adventure"""
title = _('Conditions')

@classmethod
def test(cls, sourcefile):
"""Test against the provided file"""
suite = unittest.TestSuite()
raw_program = codecs.open(sourcefile).read()
suite.addTest(TestOutput(raw_program, sourcefile))
result = unittest.TextTestRunner().run(suite)
if not result.wasSuccessful():
raise AdventureVerificationError()
14 changes: 14 additions & 0 deletions py101/dictionaries/README.es.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Boilerplate
-----------

Insertar alguna introducción aquí.

.. sourcecode:: python

print('Some python code here')


Desafío
-------

Describir el desafío aquí.
14 changes: 14 additions & 0 deletions py101/dictionaries/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Boilerplate
-----------

Insert some introduction here.

.. sourcecode:: python

print('Some python code here')


Challenge
---------

Describe the challenge here
3 changes: 3 additions & 0 deletions py101/dictionaries/SOLUTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.. sourcecode:: python

print('Some solution here')
51 changes: 51 additions & 0 deletions py101/dictionaries/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
""""
Boilerplate Adventure
Author: Ignacio Avas ([email protected])
"""
import codecs
import io
import sys
import unittest
from story.adventures import AdventureVerificationError, BaseAdventure
from story.translation import gettext as _


class TestOutput(unittest.TestCase):
"""Adventure test"""

def __init__(self, candidate_code, file_name='<inline>'):
"""Init the test"""
super(TestOutput, self).__init__()
self.candidate_code = candidate_code
self.file_name = file_name

def setUp(self):
self.__old_stdout = sys.stdout
sys.stdout = self.__mockstdout = io.StringIO()

def tearDown(self):
sys.stdout = self.__old_stdout
self.__mockstdout.close()

def runTest(self):
"""Makes a simple test of the output"""

#code = compile(self.candidate_code, self.file_name, 'exec', optimize=0)
#exec(code)
self.fail("Test not implemented")


class Adventure(BaseAdventure):
"""Dictionary Adventure"""
title = _('Dictionaries')

@classmethod
def test(cls, sourcefile):
"""Test against the provided file"""
suite = unittest.TestSuite()
raw_program = codecs.open(sourcefile).read()
suite.addTest(TestOutput(raw_program, sourcefile))
result = unittest.TextTestRunner().run(suite)
if not result.wasSuccessful():
raise AdventureVerificationError()
4 changes: 2 additions & 2 deletions py101/formatting/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
""""
Boilerplate Adventure
Formatting Adventure
Author: Ignacio Avas ([email protected])
"""
Expand Down Expand Up @@ -52,7 +52,7 @@ def runTest(self):


class Adventure(BaseAdventure):
"""Boilerplate Adventure"""
"""Formatting Adventure"""
title = _('String Formatting')

@classmethod
Expand Down
14 changes: 14 additions & 0 deletions py101/functions/README.es.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Boilerplate
-----------

Insertar alguna introducción aquí.

.. sourcecode:: python

print('Some python code here')


Desafío
-------

Describir el desafío aquí.
14 changes: 14 additions & 0 deletions py101/functions/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Boilerplate
-----------

Insert some introduction here.

.. sourcecode:: python

print('Some python code here')


Challenge
---------

Describe the challenge here
3 changes: 3 additions & 0 deletions py101/functions/SOLUTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.. sourcecode:: python

print('Some solution here')
52 changes: 52 additions & 0 deletions py101/functions/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
""""
Functions Adventure
Author: Ignacio Avas ([email protected])
"""
import codecs
import io
import sys
import unittest
from story.adventures import AdventureVerificationError, BaseAdventure
from story.translation import gettext as _


class TestOutput(unittest.TestCase):
"""Adventure test"""

def __init__(self, candidate_code, file_name='<inline>'):
"""Init the test"""
super(TestOutput, self).__init__()
self.candidate_code = candidate_code
self.file_name = file_name

def setUp(self):
self.__old_stdout = sys.stdout
sys.stdout = self.__mockstdout = io.StringIO()

def tearDown(self):
sys.stdout = self.__old_stdout
self.__mockstdout.close()

def runTest(self):
"""Makes a simple test of the output"""

#code = compile(self.candidate_code, self.file_name, 'exec', optimize=0)
#exec(code)
self.fail("Test not implemented")


class Adventure(BaseAdventure):
"""Functions Adventure"""

title = _('Functions')

@classmethod
def test(cls, sourcefile):
"""Test against the provided file"""
suite = unittest.TestSuite()
raw_program = codecs.open(sourcefile).read()
suite.addTest(TestOutput(raw_program, sourcefile))
result = unittest.TextTestRunner().run(suite)
if not result.wasSuccessful():
raise AdventureVerificationError()
Loading

0 comments on commit 9e8a253

Please sign in to comment.