fixed intendations
This commit is contained in:
@ -23,21 +23,19 @@
|
||||
- später lernen wir noch bessere Tests kennen
|
||||
- lasst eure `assert` nicht einfach in der Logik stehen!
|
||||
|
||||
#### Wrong
|
||||
|
||||
```py
|
||||
def some_function(arg):
|
||||
assert arg <= 360
|
||||
assert arg <= 360 # WRONG!
|
||||
return calculate(arg)
|
||||
```
|
||||
|
||||
#### Right (*kind of*)
|
||||
|
||||
```py
|
||||
def some_function(arg) -> float:
|
||||
return calculate(arg)
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Right! Nur testen ob alles tut, mehr nicht
|
||||
# und in __main__ packen, damit nicht jeder import die asserts aufruft
|
||||
assert some_function(0.69) <= 42
|
||||
assert some_function(0.420) <= 1337
|
||||
```
|
||||
|
Reference in New Issue
Block a user