Skip to content

Commit

Permalink
test dgp reducing over O values
Browse files Browse the repository at this point in the history
  • Loading branch information
salbalkus committed Jan 27, 2025
1 parent 2febd5a commit 215c902
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/data_generating_process.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ nothing # hide
"""


macro dgp(args...)
names = [_parse_name(arg) for arg in args]
# parse each line of the input into a vector of vectors
Expand Down
11 changes: 10 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,16 @@ end

@test typeof(ct) == CausalTables.CausalTable
@test Tables.columnnames(ct) == Tuple(Symbol("X$(i)") for i in 1:10)
@test_throws ArgumentError Base.merge(DataGeneratingProcess([O -> Normal(0,1)]; varsymb = "Y"), DataGeneratingProcess([O -> Normal(0,1)]; varsymb = "Y"))
@test_throws ArgumentError merge(DataGeneratingProcess([O -> Normal(0,1)]; varsymb = "Y"),
DataGeneratingProcess([O -> Normal(0,1)]; varsymb = "Y"))

dgp3 = @dgp(
Y ~ Normal.(reduce(+, values(O)), 1)
)
scm = CausalTables.StructuralCausalModel(merge(dgp, dgp3), :X1, :Y)
rand(scm, 10)
@test typeof(ct) == CausalTables.CausalTable
@test Tables.columnnames(ct) == Tuple(Symbol("X$(i)") for i in 1:10)
end

@testset "DataGeneratingProcess using dgp macro, no graphs" begin
Expand Down

0 comments on commit 215c902

Please sign in to comment.