Fix Broken Links
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
# 8. Overview
|
||||
|
||||
This section introduces a few basic topics related to testing,
|
||||
logging, and debugging.
|
||||
logging, and debugging.
|
||||
|
||||
* [8.1 Testing](01_Testing)
|
||||
* [8.2 Logging, error handling and diagnostics](02_Logging)
|
||||
* [8.3 Debugging](03_Debugging)
|
||||
* [8.1 Testing](01_Testing.md)
|
||||
* [8.2 Logging, error handling and diagnostics](02_Logging.md)
|
||||
* [8.3 Debugging](03_Debugging.md)
|
||||
|
||||
[Contents](../Contents)
|
||||
[Contents](../Contents.md)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[Contents](../Contents) \| [Previous (7.5 Decorated Methods)](../07_Advanced_Topics/05_Decorated_methods) \| [Next (8.2 Logging)](02_Logging)
|
||||
[Contents](../Contents.md) \| [Previous (7.5 Decorated Methods)](../07_Advanced_Topics/05_Decorated_methods) \| [Next (8.2 Logging)](02_Logging)
|
||||
|
||||
# 8.1 Testing
|
||||
|
||||
@@ -28,7 +28,7 @@ assert isinstance(10, int), 'Expected int'
|
||||
|
||||
It shouldn't be used to check the user-input (i.e., data entered
|
||||
on a web form or something). It's purpose is more for internal
|
||||
checks and invariants (conditions that should always be true).
|
||||
checks and invariants (conditions that should always be true).
|
||||
|
||||
### Contract Programming
|
||||
|
||||
@@ -274,7 +274,7 @@ Once you're satisifed that it works, write additional unit tests that
|
||||
check for the following:
|
||||
|
||||
- Make sure the `s.cost` property returns the correct value (49010.0)
|
||||
- Make sure the `s.sell()` method works correctly. It should
|
||||
- Make sure the `s.sell()` method works correctly. It should
|
||||
decrement the value of `s.shares` accordingly.
|
||||
- Make sure that the `s.shares` attribute can't be set to a non-integer value.
|
||||
|
||||
@@ -290,4 +290,4 @@ class TestStock(unittest.TestCase):
|
||||
s.shares = '100'
|
||||
```
|
||||
|
||||
[Contents](../Contents) \| [Previous (7.5 Decorated Methods)](../07_Advanced_Topics/05_Decorated_methods) \| [Next (8.2 Logging)](02_Logging)
|
||||
[Contents](../Contents.md) \| [Previous (7.5 Decorated Methods)](../07_Advanced_Topics/05_Decorated_methods) \| [Next (8.2 Logging)](02_Logging)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[Contents](../Contents) \| [Previous (8.1 Testing)](01_Testing) \| [Next (8.3 Debugging)](03_Debugging)
|
||||
[Contents](../Contents.md) \| [Previous (8.1 Testing)](01_Testing) \| [Next (8.3 Debugging)](03_Debugging)
|
||||
|
||||
# 8.2 Logging
|
||||
|
||||
@@ -131,7 +131,7 @@ uses logging doesn't have to worry about that.
|
||||
|
||||
### Exercise 8.2: Adding logging to a module
|
||||
|
||||
In `fileparse.py`, there is some error handling related to
|
||||
In `fileparse.py`, there is some error handling related to
|
||||
exceptions caused by bad input. It looks like this:
|
||||
|
||||
```python
|
||||
@@ -262,7 +262,7 @@ steps to see that:
|
||||
>>> a = report.read_portfolio('Data/missing.csv')
|
||||
WARNING:fileparse:Row 4: Bad row: ['MSFT', '', '51.23']
|
||||
WARNING:fileparse:Row 7: Bad row: ['IBM', '', '70.44']
|
||||
>>>
|
||||
>>>
|
||||
```
|
||||
|
||||
You will notice that you don't see the output from the `log.debug()`
|
||||
@@ -275,7 +275,7 @@ WARNING:fileparse:Row 4: Bad row: ['MSFT', '', '51.23']
|
||||
DEBUG:fileparse:Row 4: Reason: invalid literal for int() with base 10: ''
|
||||
WARNING:fileparse:Row 7: Bad row: ['IBM', '', '70.44']
|
||||
DEBUG:fileparse:Row 7: Reason: invalid literal for int() with base 10: ''
|
||||
>>>
|
||||
>>>
|
||||
```
|
||||
|
||||
Turn off all, but the most critical logging messages:
|
||||
@@ -294,7 +294,7 @@ do this is to include some setup code that looks like this:
|
||||
|
||||
```
|
||||
# This file sets up basic configuration of the logging module.
|
||||
# Change settings here to adjust logging output as needed.
|
||||
# Change settings here to adjust logging output as needed.
|
||||
import logging
|
||||
logging.basicConfig(
|
||||
filename = 'app.log', # Name of the log file (omit to use stderr)
|
||||
@@ -306,4 +306,4 @@ logging.basicConfig(
|
||||
Again, you'd need to put this someplace in the startup steps of your
|
||||
program. For example, where would you put this in your `report.py` program?
|
||||
|
||||
[Contents](../Contents) \| [Previous (8.1 Testing)](01_Testing) \| [Next (8.3 Debugging)](03_Debugging)
|
||||
[Contents](../Contents.md) \| [Previous (8.1 Testing)](01_Testing) \| [Next (8.3 Debugging)](03_Debugging)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[Contents](../Contents) \| [Previous (8.2 Logging)](02_Logging) \| [Next (9 Packages)](../09_Packages/00_Overview)
|
||||
[Contents](../Contents.md) \| [Previous (8.2 Logging)](02_Logging) \| [Next (9 Packages)](../09_Packages/00_Overview)
|
||||
|
||||
# 8.3 Debugging
|
||||
|
||||
@@ -158,4 +158,4 @@ For breakpoints location is one of the following.
|
||||
|
||||
It runs. Ship it!
|
||||
|
||||
[Contents](../Contents) \| [Previous (8.2 Logging)](02_Logging) \| [Next (9 Packages)](../09_Packages/00_Overview)
|
||||
[Contents](../Contents.md) \| [Previous (8.2 Logging)](02_Logging) \| [Next (9 Packages)](../09_Packages/00_Overview)
|
||||
|
||||
Reference in New Issue
Block a user