College: | CUNY School of Professional Studies |
---|---|
Course-Name: | Software Application Programming I |
Course-Code: | IS 210 |
Lesson: | 02 |
The synthesizing tasks in this lesson will challenge you to use some of our advanced tools like reStructuredText nd our various testing tools. From this point forward, unless otherwise directed, please add and commit all
The following tasks will either have you interacting with existing files in the assignment repository or creating new ones on the fly. Don't forget to add your interpreter directive, utf-8 encoding, and a short docstring with any new files that you create!
Important
In these exercises, you may, on occasion, come across a task that requres you to research or use a function or method not directly covered by the course text. Since Python is such a large language it would be impossible for the author to have included descriptions of each and every available function which would largely duplicate the offical Python documentation.
A vital skill to successful programming is being comfortable searching for and using official language documentation sources like the Python String Documentation page. Throughout our coursework we will be practicing both the use of the language in practice and the search skills necessary to become functional programmers.
The first synthesizing task this week will have you create a reStructuredText file capable of producing a duplicate of the included reference file. This will challenge you to get comfortable with some of the reStructuredText syntax and directives.
Open the included reference file,
reference\task_01.html
in Firefox.Create a new reStructuredText file called
task_01.rst
with a text editor like Idle.Add the correct reStructuredText to
task_01.rst
to replicate the content and structure of your reference file.As you complete sections and wish to test your output, use
rst2html
to output an html file.$ rst2html task_01.rst task_01.html
Open
task_01.html
and compare it againstreference\task_01.html
Once
task_01.rst
andtask_01.html
are complete, add both files to the repository and commit your changes.
Note
This task does not use automated testing.
For the next task, you'll need to add a docstring to a python file that happens to be missing this all-important element.
- Open
task_02.py
and add a docstring in the appropriate location. - Be sure to run your tests to make sure you got it in the right location!
- Add and commit your changes.
Your final task this week will be to interpret the test results for a given Python file in order to fix it so that it no longer produces errors.
- Run your tests locally with
runtests.sh
to see what errors are currently being reported fortask_03.py
- Interpret the test results in order to make corrections to
task_03.py
and modifytask_03.py
accordingly. - Keep running tests periodically to make sure you're moving in the right direction.
- Once you have no-more lint or unittest errors, commit your changes and submit.
Code must be functional and pass tests before it will be eligible for credit.
Lint tests check your code for syntactic or stylistic errors To execute lint tests against a specific file, simply open a terminal in the same directory as your code repository and type:
$ pylint filename.py
Where filename.py
is the name of the file you wish to lint test.
Unit tests check that your code performs the tested objectives. Unit tests may be executed individually by opening a terminal in the same directory as your code repository and typing:
$ nosetests tests/name_of_test.py
Where name_of_test.py
is the name of the testfile found in the tests
directory of your source code.
All tests may be run simultaneously by executing the runtests.sh
script
from the root of your assignment repository. To execute all tests, open a
terminal in the same directory as your code repository and type:
$ sh runtests.sh
Code should be submitted to GitHub by means of opening a pull request.
As-of Lesson 02, each student will have a branch named after his or her
GitHub username. Pull requests should be made against the branch that
matches your GitHub username. Pull requests made against other branches will
be closed. This work flow mimics the steps you took to open a pull request
against the pull
branch in Week Two.
For a refresher on how to open a pull request, please see homework instructions in Lesson 01. It is recommended that you run PyLint locally after each file is edited in order to reduce the number of errors found in testing.
In order to receive full credit you must complete the assignment as-instructed and without any violations (reported in the build status). There will be automated tests for this assignment to provide early feedback on program code.
When you have completed this assignment, please post the link to your pull request in the body of the assignment on Blackboard in order to receive credit.