You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lectures/software_engineering/testing.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -137,7 +137,7 @@ This specifies metadata like the license we'll be using (MIT by default), the lo
137
137
We will create this with a number of useful options, but see [the documentation](https://juliaci.github.io/PkgTemplates.jl/stable/user/#A-More-Complicated-Example-1) for more.
138
138
139
139
```{code-block} julia
140
-
t = Template(;dir = ".", julia = v"1.8",
140
+
t = Template(;dir = ".", julia = v"1.9",
141
141
plugins = [
142
142
Git(; manifest=true, branch = "main"),
143
143
Codecov(),
@@ -225,7 +225,7 @@ Given this, other julia code can use `using MyProject` and, because the global e
225
225
You can see the change reflected in our default package list by running `] st`
226
226
227
227
```{code-block} bash
228
-
Status `C:\Users\jesse\.julia\environments\v1.8\Project.toml`
228
+
Status `C:\Users\jesse\.julia\environments\v1.9\Project.toml`
@@ -351,7 +351,7 @@ See the [Pkg docs](https://docs.julialang.org/en/v1/stdlib/Pkg/) for more inform
351
351
352
352
For now, let's just try adding a dependency. Recall the package operations described in the {doc}`tools and editors <../software_engineering/tools_editors>` lecture.
353
353
354
-
* Within VS Code, start a REPL (e.g. `> Julia: Start REPL`), type `]` to enter the Pkg mode. Verify that the cursor says `(My Project) pkg>` to ensure that it has activated your particular project. Otherwise, if it says `(@1.8) pkg>`, then you have launched Julia outside of VSCode or through a different mechanism, and you might need to ensure you are in the correct directory and then `] activate .` to activate the project file in it.
354
+
* Within VS Code, start a REPL (e.g. `> Julia: Start REPL`), type `]` to enter the Pkg mode. Verify that the cursor says `(My Project) pkg>` to ensure that it has activated your particular project. Otherwise, if it says `(@1.9) pkg>`, then you have launched Julia outside of VSCode or through a different mechanism, and you might need to ensure you are in the correct directory and then `] activate .` to activate the project file in it.
@@ -465,9 +465,9 @@ Then calling `foo()` with the default arguments in the REPL. This should lead t
465
465
Next, we will change the function in the package and call it again in the REPL:
466
466
* Modify the `foo` function definition to add `println("Modified foo definition")` inside the function
467
467
```{code-block} julia
468
-
function foo(μ = 1., σ = 2.)
468
+
function foo(mu = 1., sigma = 2.)
469
469
println("Modified foo definition")
470
-
d = Normal(μ, σ)
470
+
d = Normal(mu, sigma)
471
471
E = expectation(d)
472
472
return E(x -> sin(x))
473
473
end
@@ -729,9 +729,9 @@ For example,
729
729
For cases where you want to change the relative tolerance or add in an absolute tolerance (i.e. $\|x - y\| \leq atol$) use the appropriate keywords
730
730
```{code-cell} julia
731
731
x = 100.0 + 1E-6 # within the tolerance
732
-
@test x ≈ 100.0 rtol=1E-7 # note < the 1E-6 difference passes due to relative scaling
732
+
@test x≈100.0 rtol=1E-7 # note < the 1E-6 difference passes due to relative scaling
733
733
y = 1E-7
734
-
@test 0.0 ≈ y atol=1E-6 # absolute tolerance!
734
+
@test 0.0≈y atol=1E-6 # absolute tolerance!
735
735
```
736
736
737
737
```{note}
@@ -777,9 +777,9 @@ This is useful for organizing different batches of tests, and executing them all
777
777
778
778
```{code-cell} julia
779
779
@testset "my tests" begin
780
-
@test 1 == 1
781
-
@test 2 == 2
782
-
@test_broken 1 == 2
780
+
@test 1 == 1
781
+
@test 2 == 2
782
+
@test_broken 1 == 2
783
783
end;
784
784
```
785
785
By using `<Shift+Enter>` in VS Code or Jupyter on the testset, you will execute them all. You may want to execute only parts of them during development by commenting out the `@testset` and `end` and execute sequentially until the suite passes.
0 commit comments