Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ac2b4db

Browse filesBrowse files
edoardob90despadam
andauthored
Fix broken test module names (empa-scientific-it#294)
* Rename test modules and notebooks * Enforce string return value * fix links in notebooks * fix functional_programming --------- Co-authored-by: Despina Adamopoulou <despoina.adamopoulou@empa.ch>
1 parent 96532e6 commit ac2b4db
Copy full SHA for ac2b4db
Expand file treeCollapse file tree

38 files changed

+26
-26
lines changed
File renamed without changes.

‎00-intro.ipynb renamed to ‎00_intro.ipynb

Copy file name to clipboardExpand all lines: 00_intro.ipynb
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@
553553
"name": "python",
554554
"nbconvert_exporter": "python",
555555
"pygments_lexer": "ipython3",
556-
"version": "3.10.15"
556+
"version": "3.10.17"
557557
},
558558
"vscode": {
559559
"interpreter": {

‎01-basic_datatypes.ipynb renamed to ‎01_basic_datatypes.ipynb

Copy file name to clipboardExpand all lines: 01_basic_datatypes.ipynb
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1531,7 +1531,7 @@
15311531
"source": [
15321532
"Unlike lists, sets and dictionaries, tuples do not require parentheses.\n",
15331533
"Parenthesis are required only when there's some ambiguity.\n",
1534-
"We will discuss it in more details in the [`Functions`](03-functions.ipynb) chapter.\n",
1534+
"We will discuss it in more details in the [`Functions`](03_functions.ipynb) chapter.\n",
15351535
"\n",
15361536
"For now, let's just see how to define tuples without parentheses:"
15371537
]

‎02-control_flow.ipynb renamed to ‎02_control_flow.ipynb

Copy file name to clipboardExpand all lines: 02_control_flow.ipynb
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
"id": "5",
9292
"metadata": {},
9393
"source": [
94-
"Python [supports](./01-basic_datatypes.ipynb#Comparison-operators) different comparison expressions.\n",
94+
"Python [supports](./01_basic_datatypes.ipynb#Comparison-operators) different comparison expressions.\n",
9595
"They are called **logical expressions** as they evaluate to either `True` or `False`.\n",
9696
"\n",
9797
"We can use these results in **conditional statements**, and have our program behave differently based on the result."

‎03-functions.ipynb renamed to ‎03_functions.ipynb

Copy file name to clipboardExpand all lines: 03_functions.ipynb
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@
889889
"id": "54",
890890
"metadata": {},
891891
"source": [
892-
"In the [Basic datatypes](./01-basic_datatypes.ipynb#Unpacking) section we saw that iterables (e.g., tuples, lists, strings) support **unpacking**. You can exploit unpacking to make a **parallel assignment**.\n",
892+
"In the [Basic datatypes](./01_basic_datatypes.ipynb#Unpacking) section we saw that iterables (e.g., tuples, lists, strings) support **unpacking**. You can exploit unpacking to make a **parallel assignment**.\n",
893893
"\n",
894894
"A reminder:\n",
895895
"\n",
@@ -1320,7 +1320,7 @@
13201320
"\n",
13211321
"<div class=\"alert alert-block alert-info\">\n",
13221322
" <h4><b>Hint</b></h4>\n",
1323-
" You need to store your <code>nums</code> in a data structure that doesn&#39;t care about ordering and discard duplicates. We have seen it on <a href=\"./01-basic_datatypes.ipynb#Set\">the first day of the tutorial</a>.\n",
1323+
" You need to store your <code>nums</code> in a data structure that doesn&#39;t care about ordering and discard duplicates. We have seen it on <a href=\"./01_basic_datatypes.ipynb#Set\">the first day of the tutorial</a>.\n",
13241324
"</div>"
13251325
]
13261326
},
File renamed without changes.
File renamed without changes.
File renamed without changes.

‎11-functional_programming.ipynb renamed to ‎11_functional_programming.ipynb

Copy file name to clipboardExpand all lines: 11_functional_programming.ipynb
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,7 @@
13691369
"metadata": {},
13701370
"outputs": [],
13711371
"source": [
1372-
"%load_ext tutorial.tests.testsuite"
1372+
"%reload_ext tutorial.tests.testsuite"
13731373
]
13741374
},
13751375
{
@@ -1450,7 +1450,7 @@
14501450
},
14511451
"outputs": [],
14521452
"source": [
1453-
"%%ipytest functional_programming\n",
1453+
"%%ipytest\n",
14541454
"\n",
14551455
"def solution_exercise2(l: \"list[int]\", k: int):\n",
14561456
" \"\"\"\n",
@@ -1502,7 +1502,7 @@
15021502
},
15031503
"outputs": [],
15041504
"source": [
1505-
"%%ipytest functional_programming\n",
1505+
"%%ipytest\n",
15061506
"\n",
15071507
"def solution_exercise3(m: \"list[list[int]]\") -> \"list[list[int]]\":\n",
15081508
" \"\"\"\n",
@@ -1549,7 +1549,7 @@
15491549
},
15501550
"outputs": [],
15511551
"source": [
1552-
"%%ipytest functional_programming\n",
1552+
"%%ipytest\n",
15531553
"\n",
15541554
"def solution_exercise4(l: \"list[list[any]]\") -> \"list[any]\":\n",
15551555
" \"\"\"\n",
@@ -1599,7 +1599,7 @@
15991599
},
16001600
"outputs": [],
16011601
"source": [
1602-
"%%ipytest functional_programming\n",
1602+
"%%ipytest\n",
16031603
"\n",
16041604
"def solution_exercise5(w: list[str]) -> list[(str, int)]:\n",
16051605
" \"\"\"\n",
@@ -1649,7 +1649,7 @@
16491649
},
16501650
"outputs": [],
16511651
"source": [
1652-
"%%ipytest functional_programming\n",
1652+
"%%ipytest\n",
16531653
"\n",
16541654
"def solution_exercise6(l: \"list[(str, int)]\") -> \"list[(str, float)]\":\n",
16551655
" pass"
@@ -1698,7 +1698,7 @@
16981698
},
16991699
"outputs": [],
17001700
"source": [
1701-
"%%ipytest functional_programming\n",
1701+
"%%ipytest\n",
17021702
"\n",
17031703
"def solution_exercise7(words: \"list[str]\") -> \"list[str]\":\n",
17041704
" pass"

‎12-functions_advanced.ipynb renamed to ‎12_functions_advanced.ipynb

Copy file name to clipboardExpand all lines: 12_functions_advanced.ipynb
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"id": "4",
7474
"metadata": {},
7575
"source": [
76-
"Before starting our deep dive on functions, we must revise quickly two important concepts. Have a look at the [Functions](./03-functions.ipynb#The-scope-of-a-function) notebook for more detail.\n",
76+
"Before starting our deep dive on functions, we must revise quickly two important concepts. Have a look at the [Functions](./03_functions.ipynb#The-scope-of-a-function) notebook for more detail.\n",
7777
"\n",
7878
"1. Scopes and namespaces\n",
7979
"2. Functions are objects"
@@ -113,7 +113,7 @@
113113
"id": "7",
114114
"metadata": {},
115115
"source": [
116-
"We can instead define a so-called **higher-order function** (see [Functional programming](./11-functional_programming.ipynb#Higher-Order-Functions-/-Functions-as-Values)): a function that returns another function.\n",
116+
"We can instead define a so-called **higher-order function** (see [Functional programming](./11_functional_programming.ipynb#Higher-Order-Functions-/-Functions-as-Values)): a function that returns another function.\n",
117117
"It does **not** call that function, just returns it."
118118
]
119119
},

‎13-object_oriented_programming_advanced.ipynb renamed to ‎13_object_oriented_programming_advanced.ipynb

Copy file name to clipboardExpand all lines: 13_object_oriented_programming_advanced.ipynb
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@
581581
"## Decorators\n",
582582
"\n",
583583
"Decorators in Python are a powerful and flexible way to modify or extend the behavior of methods and attributes without changing their source code.\n",
584-
"Check out the [Advanced functions](./12-functions_advanced.ipynb#Decorators) notebook to learn more about decorators.\n",
584+
"Check out the [Advanced functions](./12_functions_advanced.ipynb#Decorators) notebook to learn more about decorators.\n",
585585
"\n",
586586
"Here are the most common decorators used when creating custom classes."
587587
]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

‎README.md

Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# python-tutorial
22

33
[![Renku](https://renkulab.io/renku-badge.svg)](https://renkulab.io/v2/projects/empa-scientific-it/empa-it-python-tutorial/sessions/01JRT57GABCS15JB5NGNTQVTRB/start)
4-
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/empa-scientific-it/python-tutorial.git/main?labpath=00-index.ipynb)
4+
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/empa-scientific-it/python-tutorial.git/main?labpath=00_index.ipynb)
55

66
[![Build Docker container](https://github.com/empa-scientific-it/python-tutorial/actions/workflows/build-docker-image.yml/badge.svg)](https://github.com/empa-scientific-it/python-tutorial/actions/workflows/build-docker-image.yml)
77

‎slides/control_flow_slides.ipynb

Copy file name to clipboardExpand all lines: slides/control_flow_slides.ipynb
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"id": "5",
7474
"metadata": {},
7575
"source": [
76-
"Python [supports](../01-basic_datatypes.ipynb#Comparison-operators) different comparison expressions. They return either `True` or `False`.\n",
76+
"Python [supports](../01_basic_datatypes.ipynb#Comparison-operators) different comparison expressions. They return either `True` or `False`.\n",
7777
"\n",
7878
"We use these results to evaluate **conditional statements**, and branch have our program behave differently."
7979
]

‎slides/functions_slides.ipynb

Copy file name to clipboardExpand all lines: slides/functions_slides.ipynb
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@
694694
"id": "38",
695695
"metadata": {},
696696
"source": [
697-
"In the [Basic datatypes](../01-basic_datatypes.ipynb#Unpacking) section we saw that iterables (tuples and lists) support **unpacking**. You can exploit unpacking to make a **parallel assignment**.\n",
697+
"In the [Basic datatypes](../01_basic_datatypes.ipynb#Unpacking) section we saw that iterables (tuples and lists) support **unpacking**. You can exploit unpacking to make a **parallel assignment**.\n",
698698
"\n",
699699
"Now that we know about unpacking and the `*`/`**` operators, we can create more flexible functions that can accept any number of **positional** or **keyword** arguments.\n",
700700
"\n",

‎slides/intro_slides.ipynb

Copy file name to clipboardExpand all lines: slides/intro_slides.ipynb
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
"\n",
123123
"\n",
124124
"1. The link to open Binder is on Slack in `#announcements` and in Zoom's chat\n",
125-
"2. Open the `00-index.ipynb` file and click on the current topic link\n",
125+
"2. Open the `00_index.ipynb` file and click on the current topic link\n",
126126
"3. Run the code, modify, experiment\n",
127127
"\n"
128128
]

‎tutorial/library_pandas_solutions.ipynb

Copy file name to clipboardExpand all lines: tutorial/library_pandas_solutions.ipynb
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"metadata": {},
1515
"source": [
1616
"This notebook contains the solutions to some exercises about Pandas that didn't (or couldn't) have a test.\n",
17-
"Exercises are grouped by the same main sections of the [Pandas notebook](../24-library_pandas.ipynb)."
17+
"Exercises are grouped by the same main sections of the [Pandas notebook](../24_library_pandas.ipynb)."
1818
]
1919
},
2020
{
File renamed without changes.

‎tutorial/tests/test_object_oriented_programming.py renamed to ‎tutorial/tests/test_05_object_oriented_programming.py

Copy file name to clipboardExpand all lines: tutorial/tests/test_05_object_oriented_programming.py
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def validate_oop_person(solution_result):
5050
try:
5151
attrs = list(vars(solution_result))
5252
except TypeError:
53-
raise SubAssertionError
53+
raise SubAssertionError from None
5454
assert len(attrs) == 2, "The class should have 2 attributes."
5555
assert "first_name" in attrs and "last_name" in attrs, (
5656
"The class attributes should be 'first_name' and 'last_name'."
@@ -229,7 +229,7 @@ def validate_oop_compare_persons(solution_result):
229229
try:
230230
attrs = list(vars(solution_result))
231231
except TypeError:
232-
raise SubAssertionError
232+
raise SubAssertionError from None
233233
assert len(attrs) == 3, "The class should have 3 attributes."
234234
assert "first_name" in attrs and "last_name" in attrs and "age" in attrs, (
235235
"The class attributes should be 'first_name', 'last_name' and 'age'."
@@ -292,7 +292,7 @@ def validate_ice_cream_scoop(solution_result):
292292
try:
293293
attrs = list(vars(solution_result))
294294
except TypeError:
295-
raise SubAssertionError
295+
raise SubAssertionError from None
296296
assert len(attrs) == 1, "The class should have 1 attribute."
297297
assert "flavor" in attrs, "The class attribute should be 'flavor'."
298298
assert hasattr(solution_result.__str__, "__closure__"), (
@@ -393,7 +393,7 @@ def validate_ice_cream_bowl(solution_result):
393393
try:
394394
attrs = list(vars(solution_result))
395395
except TypeError:
396-
raise SubAssertionError
396+
raise SubAssertionError from None
397397
assert len(attrs) == 1, "The class should have 1 attribute."
398398
assert "scoops" in attrs, "The class attribute should be 'scoops'."
399399
assert isinstance(solution_result.scoops, (list, set, tuple)), (
@@ -487,7 +487,7 @@ def validate_ice_cream_shop(solution_result):
487487
try:
488488
attrs = list(vars(solution_result))
489489
except TypeError:
490-
raise SubAssertionError
490+
raise SubAssertionError from None
491491
assert len(attrs) == 1, "The class should have 1 attribute."
492492
assert "flavors" in attrs, "The class attribute should be 'flavors'."
493493
assert isinstance(solution_result.flavors, (list, set, tuple)), (
File renamed without changes.

‎tutorial/tests/testsuite/testsuite.py

Copy file name to clipboardExpand all lines: tutorial/tests/testsuite/testsuite.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def _name_from_line(line: str = ""):
119119

120120
def _name_from_ipynbname() -> str | None:
121121
try:
122-
return ipynbname.name()
122+
return str(ipynbname.name())
123123
except FileNotFoundError:
124124
return None
125125

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.