Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 948543e

Browse files
committedApr 4, 2018
removing jupyter notebook tests
1 parent f552383 commit 948543e

File tree

2 files changed

+21
-226
lines changed

2 files changed

+21
-226
lines changed
 

‎README.md‎

Lines changed: 2 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ top_travel_cities = ['Solta', 'Greenville', 'Buenos Aires', 'Los Cabos', 'Walla
2222

2323
> Remember to press shift+enter to run each gray block of code (including the one above). Otherwise, the variables will not be defined.
2424
25+
In this lesson we will work with a list of associated countries corresponding to each of the top travel cities.
26+
2527

2628
```python
2729
countries = ['Croatia',
@@ -44,24 +46,6 @@ Ok, so the list of countries associated with each city has been assigned to the
4446

4547
### Accessing elements from lists
4648

47-
For the tests in this lab to work, please run the following two cells.
48-
49-
50-
```python
51-
!pip install ipython_unittest
52-
```
53-
54-
Collecting ipython_unittest
55-
Downloading ipython_unittest-0.3.1-py2.py3-none-any.whl
56-
Installing collected packages: ipython-unittest
57-
Successfully installed ipython-unittest-0.3.1
58-
59-
60-
61-
```python
62-
%load_ext ipython_unittest
63-
```
64-
6549
First, set the variable `italy` to be equal to the third to last element from `countries`.
6650
>**Note:** If you see an **error** stating that `countries` is undefined, it means you must press shift+enter in the second gray box where `countries` variable is assigned.
6751
@@ -78,14 +62,6 @@ italy
7862
italy # 'Italy'
7963
```
8064

81-
82-
```python
83-
%%unittest_testcase
84-
85-
def test_italy(self):
86-
self.assertEqual(italy, 'Italy')
87-
```
88-
8965
Now access the fourth element and set it equal to the variable `mexico`.
9066

9167

@@ -94,14 +70,6 @@ mexico = None
9470
mexico
9571
```
9672

97-
98-
```python
99-
%%unittest_testcase
100-
101-
def test_mexico(self):
102-
self.assertEqual(mexico, 'Mexico')
103-
```
104-
10573
Notice that the second through fifth elements are all in a row and all in the Western Hemisphere. Assign that subset of elements to a variable called `kindof_neighbors`.
10674

10775

@@ -110,14 +78,6 @@ kindof_neighbors = None
11078
kindof_neighbors
11179
```
11280

113-
114-
```python
115-
%%unittest_testcase
116-
117-
def test_kindof_neighbors(self):
118-
self.assertEqual(kindof_neighbors, ['USA', 'Argentina', 'Mexico', 'USA'])
119-
```
120-
12181
### Changing Elements
12282

12383
Ok, now let's add a couple of countries onto this list. At the end of the list, add the country 'Malta'.
@@ -143,14 +103,6 @@ countries
143103
# 'Argentina', 'Italy', 'Canada', 'South Korea', 'Malta', 'Thailand']
144104
```
145105

146-
147-
```python
148-
%%unittest_testcase
149-
150-
def test_countries(self):
151-
self.assertItemsEqual(countries, ['Croatia', 'USA', 'Argentina', 'Mexico', 'USA', 'Morocco', 'New Mexico', 'Finland', 'Argentina', 'Italy', 'Canada', 'South Korea', 'Malta', 'Thailand'])
152-
```
153-
154106
You may have noticed that "New Mexico" is included in our list of countries. That doesn't seem right. Let's change 'New Mexico' to 'USA'.
155107

156108

@@ -165,14 +117,6 @@ countries
165117
# 'Argentina', 'Italy', 'Canada', 'South Korea', 'Malta', 'Thailand']
166118
```
167119

168-
169-
```python
170-
%%unittest_testcase
171-
172-
def test_countries_with_usa(self):
173-
self.assertNotIn('New Mexico', countries)
174-
```
175-
176120
Finally, let's remove Thailand from the list. No good reason, we're acting on whimsy.
177121

178122

@@ -215,14 +159,6 @@ countries
215159

216160

217161

218-
219-
```python
220-
%%unittest_testcase
221-
222-
def test_countries_with_usa(self):
223-
self.assertNotIn('Thailand', countries)
224-
```
225-
226162
### Exploring Lists with Methods
227163

228164
Ok, now we notice that some countries are mentioned more than once. Let's see how many repeat countries are on this list.
@@ -240,14 +176,6 @@ unique_countries # ['Canada', 'Italy', 'USA', 'Mexico', 'Finland',
240176
#'Malta', 'Morocco', 'Croatia', 'Argentina', 'South Korea']
241177
```
242178

243-
244-
```python
245-
%%unittest_testcase
246-
247-
def test_unique_countries(self):
248-
self.assertItemsEqual(unique_countries, ['USA', 'South Korea', 'Morocco', 'Finland', 'Italy', 'Mexico', 'Argentina', 'Malta', 'Croatia', 'Canada'])
249-
```
250-
251179
Now the number of repeat countries should be the number of countries minus the number of unique countries. So use the `len` function on both `unique_countries` and `countries` to calculate this and assign the result to the variable `num_of_repeats`.
252180

253181

@@ -256,14 +184,6 @@ num_of_repeats = None
256184
num_of_repeats # 3
257185
```
258186

259-
260-
```python
261-
%%unittest_testcase
262-
263-
def test_num_of_repeats(self):
264-
self.assertEqual(num_of_repeats, 3)
265-
```
266-
267187
### Summary
268188

269189
In this lesson, we had some practice with working with lists in Python. We saw how to add and remove elements from a list, as well as select specific elements. Finally, we saw how to use a different data structure to calculate the number unique elements in the list.

‎index.ipynb‎

Lines changed: 19 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@
7171
"> Remember to press shift+enter to run each gray block of code (including the one above). Otherwise, the variables will not be defined."
7272
]
7373
},
74+
{
75+
"cell_type": "markdown",
76+
"metadata": {},
77+
"source": [
78+
"In this lesson we will work with a list of associated countries corresponding to each of the top travel cities."
79+
]
80+
},
7481
{
7582
"cell_type": "code",
7683
"execution_count": 1,
@@ -114,44 +121,6 @@
114121
"### Accessing elements from lists"
115122
]
116123
},
117-
{
118-
"cell_type": "markdown",
119-
"metadata": {},
120-
"source": [
121-
"For the tests in this lab to work, please run the following two cells."
122-
]
123-
},
124-
{
125-
"cell_type": "code",
126-
"execution_count": 2,
127-
"metadata": {},
128-
"outputs": [
129-
{
130-
"name": "stdout",
131-
"output_type": "stream",
132-
"text": [
133-
"Collecting ipython_unittest\n",
134-
" Downloading ipython_unittest-0.3.1-py2.py3-none-any.whl\n",
135-
"Installing collected packages: ipython-unittest\n",
136-
"Successfully installed ipython-unittest-0.3.1\n"
137-
]
138-
}
139-
],
140-
"source": [
141-
"!pip install ipython_unittest"
142-
]
143-
},
144-
{
145-
"cell_type": "code",
146-
"execution_count": 3,
147-
"metadata": {
148-
"collapsed": true
149-
},
150-
"outputs": [],
151-
"source": [
152-
"%load_ext ipython_unittest"
153-
]
154-
},
155124
{
156125
"cell_type": "markdown",
157126
"metadata": {},
@@ -163,7 +132,9 @@
163132
{
164133
"cell_type": "code",
165134
"execution_count": 10,
166-
"metadata": {},
135+
"metadata": {
136+
"collapsed": true
137+
},
167138
"outputs": [],
168139
"source": [
169140
"italy = None # 'Italy'\n",
@@ -180,24 +151,14 @@
180151
{
181152
"cell_type": "code",
182153
"execution_count": 11,
183-
"metadata": {},
154+
"metadata": {
155+
"collapsed": true
156+
},
184157
"outputs": [],
185158
"source": [
186159
"italy # 'Italy'"
187160
]
188161
},
189-
{
190-
"cell_type": "code",
191-
"execution_count": null,
192-
"metadata": {},
193-
"outputs": [],
194-
"source": [
195-
"%%unittest_testcase\n",
196-
"\n",
197-
"def test_italy(self):\n",
198-
" self.assertEqual(italy, 'Italy')"
199-
]
200-
},
201162
{
202163
"cell_type": "markdown",
203164
"metadata": {},
@@ -217,20 +178,6 @@
217178
"mexico"
218179
]
219180
},
220-
{
221-
"cell_type": "code",
222-
"execution_count": null,
223-
"metadata": {
224-
"collapsed": true
225-
},
226-
"outputs": [],
227-
"source": [
228-
"%%unittest_testcase\n",
229-
"\n",
230-
"def test_mexico(self):\n",
231-
" self.assertEqual(mexico, 'Mexico')"
232-
]
233-
},
234181
{
235182
"cell_type": "markdown",
236183
"metadata": {},
@@ -250,20 +197,6 @@
250197
"kindof_neighbors"
251198
]
252199
},
253-
{
254-
"cell_type": "code",
255-
"execution_count": null,
256-
"metadata": {
257-
"collapsed": true
258-
},
259-
"outputs": [],
260-
"source": [
261-
"%%unittest_testcase\n",
262-
"\n",
263-
"def test_kindof_neighbors(self):\n",
264-
" self.assertEqual(kindof_neighbors, ['USA', 'Argentina', 'Mexico', 'USA'])"
265-
]
266-
},
267200
{
268201
"cell_type": "markdown",
269202
"metadata": {},
@@ -327,18 +260,6 @@
327260
"# 'Argentina', 'Italy', 'Canada', 'South Korea', 'Malta', 'Thailand']"
328261
]
329262
},
330-
{
331-
"cell_type": "code",
332-
"execution_count": null,
333-
"metadata": {},
334-
"outputs": [],
335-
"source": [
336-
"%%unittest_testcase\n",
337-
"\n",
338-
"def test_countries(self):\n",
339-
" self.assertItemsEqual(countries, ['Croatia', 'USA', 'Argentina', 'Mexico', 'USA', 'Morocco', 'New Mexico', 'Finland', 'Argentina', 'Italy', 'Canada', 'South Korea', 'Malta', 'Thailand'])"
340-
]
341-
},
342263
{
343264
"cell_type": "markdown",
344265
"metadata": {},
@@ -370,18 +291,6 @@
370291
"# 'Argentina', 'Italy', 'Canada', 'South Korea', 'Malta', 'Thailand']"
371292
]
372293
},
373-
{
374-
"cell_type": "code",
375-
"execution_count": null,
376-
"metadata": {},
377-
"outputs": [],
378-
"source": [
379-
"%%unittest_testcase\n",
380-
"\n",
381-
"def test_countries_with_usa(self):\n",
382-
" self.assertNotIn('New Mexico', countries)"
383-
]
384-
},
385294
{
386295
"cell_type": "markdown",
387296
"metadata": {},
@@ -437,20 +346,6 @@
437346
"# ['Croatia', 'USA', 'Argentina', 'Mexico', 'USA', 'Morocco', 'USA', 'Finland', 'Argentina', 'Italy', 'Canada', 'South Korea', 'Malta']"
438347
]
439348
},
440-
{
441-
"cell_type": "code",
442-
"execution_count": null,
443-
"metadata": {
444-
"collapsed": true
445-
},
446-
"outputs": [],
447-
"source": [
448-
"%%unittest_testcase\n",
449-
"\n",
450-
"def test_countries_with_usa(self):\n",
451-
" self.assertNotIn('Thailand', countries)"
452-
]
453-
},
454349
{
455350
"cell_type": "markdown",
456351
"metadata": {},
@@ -486,25 +381,15 @@
486381
{
487382
"cell_type": "code",
488383
"execution_count": null,
489-
"metadata": {},
384+
"metadata": {
385+
"collapsed": true
386+
},
490387
"outputs": [],
491388
"source": [
492389
"unique_countries # ['Canada', 'Italy', 'USA', 'Mexico', 'Finland', \n",
493390
"#'Malta', 'Morocco', 'Croatia', 'Argentina', 'South Korea']"
494391
]
495392
},
496-
{
497-
"cell_type": "code",
498-
"execution_count": null,
499-
"metadata": {},
500-
"outputs": [],
501-
"source": [
502-
"%%unittest_testcase\n",
503-
"\n",
504-
"def test_unique_countries(self):\n",
505-
" self.assertItemsEqual(unique_countries, ['USA', 'South Korea', 'Morocco', 'Finland', 'Italy', 'Mexico', 'Argentina', 'Malta', 'Croatia', 'Canada'])"
506-
]
507-
},
508393
{
509394
"cell_type": "markdown",
510395
"metadata": {},
@@ -515,25 +400,15 @@
515400
{
516401
"cell_type": "code",
517402
"execution_count": null,
518-
"metadata": {},
403+
"metadata": {
404+
"collapsed": true
405+
},
519406
"outputs": [],
520407
"source": [
521408
"num_of_repeats = None\n",
522409
"num_of_repeats # 3"
523410
]
524411
},
525-
{
526-
"cell_type": "code",
527-
"execution_count": null,
528-
"metadata": {},
529-
"outputs": [],
530-
"source": [
531-
"%%unittest_testcase\n",
532-
"\n",
533-
"def test_num_of_repeats(self):\n",
534-
" self.assertEqual(num_of_repeats, 3)"
535-
]
536-
},
537412
{
538413
"cell_type": "markdown",
539414
"metadata": {},

0 commit comments

Comments
 (0)
Please sign in to comment.