Skip to content

Commit 1fb7433

Browse files
committed
working on exercise 1
1 parent 920f62a commit 1fb7433

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed

docs/exercise_1.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Exercise #1: Vector addition
55
A. Preparation
66
---------------
77

8-
1. Install ``py.test``:: ``pip install pytest`
8+
1. Install ``py.test``:: ``pip install pytest``
99

1010
2. Clone or download repo at https://github.com/fluentpython/pythonic-api
1111

@@ -15,6 +15,6 @@ B. Vector unary ``-``
1515

1616
1. Go to ``exercises/vector`` directory
1717

18-
2. Run the tests: ``py.test`
18+
2. Run the tests: ``py.test``
1919

2020
3. Open the ``vector/vector.py``.

docs/inspiration.rst

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,22 @@ Using ``urllib2``::
6060

6161
# ------
6262
# 200
63-
# 'application/json'
63+
# 'application/json'
64+
65+
66+
67+
The ``py.test`` library and test runner
68+
----------------------------------------
69+
70+
With ``py.test``:
71+
72+
.. literalinclude:: ../exercises/vector/test_vector_neg.py
73+
74+
75+
With ``unittest``:
76+
77+
.. literalinclude:: ../exercises/vector/test_xunit_vector_neg.py
78+
79+
80+
81+
740 Bytes
Binary file not shown.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import unittest
2+
3+
from vector import Vector
4+
5+
class TestStringMethods(unittest.TestCase):
6+
7+
def test_vector_unary_minus(self):
8+
self.assertEqual(-Vector([1, 2, 3]), Vector([-1, -2, -3]))

0 commit comments

Comments
 (0)