Download tasks/format-code-task-000020/tests/test.patch from FineEnvs/MiMo-V2.6-RL-harbor-code: direct link, hf CLI and curl.
- Browser
- Download file 5.21 kB
-
https://huggingface.co/datasets/FineEnvs/MiMo-V2.6-RL-harbor-code/resolve/main/tasks/format-code-task-000020/tests/test.patch
- Command line
-
hf download hf://datasets/FineEnvs/MiMo-V2.6-RL-harbor-code/tasks/format-code-task-000020/tests/test.patch
-
curl -L -o test.patch https://huggingface.co/datasets/FineEnvs/MiMo-V2.6-RL-harbor-code/resolve/main/tasks/format-code-task-000020/tests/test.patch
5.21 kB
| diff --git a/test/categorical_algebra/CatElements.jl b/test/categorical_algebra/CatElements.jl | |
| index 21b9ef184..2363f4efb 100644 | |
| --- a/test/categorical_algebra/CatElements.jl | |
| +++ b/test/categorical_algebra/CatElements.jl | |
| module TestCatElements | |
| using Test | |
| using Catlab.GATs, Catlab.Theories, Catlab.Graphs, Catlab.CategoricalAlgebra | |
| +import Catlab.CategoricalAlgebra.CSets: ACSetTransformation | |
| +import ACSets | |
| +import ACSets: ACSet, acset_schema, add_parts!, codom_parts, dom_parts, | |
| + has_part, has_subpart, incident, IntParts, nparts, parts, set_subpart!, | |
| + subpart | |
| + | |
| +struct WrappedGraph <: ACSet{IntParts} | |
| + data::Graph | |
| +end | |
| +WrappedGraph() = WrappedGraph(Graph()) | |
| + | |
| +acset_schema(::WrappedGraph) = acset_schema(Graph()) | |
| +nparts(g::WrappedGraph, p::Symbol) = nparts(g.data, p) | |
| +parts(g::WrappedGraph, p::Symbol) = parts(g.data, p) | |
| +add_parts!(g::WrappedGraph, p::Symbol, n::Int) = add_parts!(g.data, p, n) | |
| +set_subpart!(g::WrappedGraph, part::Int, f::Symbol, val) = | |
| + set_subpart!(g.data, part, f, val) | |
| +subpart(g::WrappedGraph, f::Symbol) = subpart(g.data, f) | |
| +subpart(g::WrappedGraph, part, f::Symbol) = subpart(g.data, part, f) | |
| +subpart(g::WrappedGraph, names::Tuple{Vararg{Symbol}}) = subpart(g.data, names) | |
| +subpart(g::WrappedGraph, part, names::Tuple{Vararg{Symbol}}) = | |
| + subpart(g.data, part, names) | |
| +dom_parts(g::WrappedGraph, f::Symbol) = dom_parts(g.data, f) | |
| +codom_parts(g::WrappedGraph, f::Symbol) = codom_parts(g.data, f) | |
| +has_part(g::WrappedGraph, p::Symbol) = has_part(g.data, p) | |
| +has_subpart(g::WrappedGraph, f::Symbol) = has_subpart(g.data, f) | |
| +incident(g::WrappedGraph, part, f::Symbol) = incident(g.data, part, f) | |
| +incident(g::WrappedGraph, part, names::Tuple{Vararg{Symbol}}) = | |
| + incident(g.data, part, names) | |
| +ACSetTransformation(components, X::WrappedGraph, Y::WrappedGraph) = | |
| + ACSetTransformation(components, X.data, Y.data) | |
| + | |
| +@testset "Custom ACSet category-of-elements APIs" begin | |
| + arr = path_graph(Graph, 2) | |
| + wrapped_arr = WrappedGraph(arr) | |
| + @test elements(wrapped_arr) == elements(arr) | |
| + | |
| + wrapped_two_edge = WrappedGraph(path_graph(Graph, 3)) | |
| + el_wrapped_two_edge = elements(wrapped_two_edge) | |
| + @test nparts(el_wrapped_two_edge, :El) == 5 | |
| + @test nparts(el_wrapped_two_edge, :Arr) == 4 | |
| + | |
| + round_trip_wrapped = inverse_elements(el_wrapped_two_edge, WrappedGraph()) | |
| + @test nparts(round_trip_wrapped, :V) == 3 | |
| + @test nparts(round_trip_wrapped, :E) == 2 | |
| + @test subpart(round_trip_wrapped, :src) == [1, 2] | |
| + @test subpart(round_trip_wrapped, :tgt) == [2, 3] | |
| + | |
| + graph_two_edge = path_graph(Graph, 3) | |
| + graph_hom = homomorphism(arr, graph_two_edge; initial=(V=[1, 2], E=[1])) | |
| + el_hom = elements(graph_hom) | |
| + inv_wrapped_hom = inverse_elements(el_hom, WrappedGraph()) | |
| + @test nparts(dom(inv_wrapped_hom), :E) == 1 | |
| + @test nparts(codom(inv_wrapped_hom), :E) == 2 | |
| + @test collect(force(inv_wrapped_hom)[:V]) == [1, 2] | |
| + @test collect(force(inv_wrapped_hom)[:E]) == [1] | |
| +end | |
| arr = @acset Graph begin | |
| V = 2 | |
| diff --git a/mimo_test_command.sh b/mimo_test_command.sh | |
| new file mode 100755 | |
| --- /dev/null | |
| +++ b/mimo_test_command.sh | |
| +#!/bin/bash | |
| +set -uo pipefail | |
| +cd /testbed | |
| + | |
| + | |
| +set -e | |
| +pkg_instantiate() { | |
| + if ! julia --project=. -e 'using Pkg; Pkg.instantiate()' > /tmp/fixture_pkg_instantiate.log 2>&1; then | |
| + cat /tmp/fixture_pkg_instantiate.log | |
| + return 1 | |
| + fi | |
| +} | |
| + | |
| +pkg_instantiate | |
| +ACSETS_DIR=$(julia --project=. -e 'using ACSets; println(dirname(dirname(pathof(ACSets))))') | |
| +sed -i 's/abstract type SimpleACSet{PT} <: ACSet{PT} end/abstract type SimpleACSet{PT<:PartsType} <: ACSet{PT} end/' "$ACSETS_DIR/src/DenseACSets.jl" | |
| +sed -i 's/struct DynamicACSet{PT} <: SimpleACSet{PT}/struct DynamicACSet{PT<:PartsType} <: SimpleACSet{PT}/' "$ACSETS_DIR/src/DenseACSets.jl" | |
| +rm -rf /root/.julia/compiled/v1.10/ACSets /root/.julia/compiled/v1.10/Catlab | |
| + | |
| + | |
| +instantiate() { | |
| + pkg_instantiate | |
| +} | |
| + | |
| +case "${1:-}" in | |
| + base) | |
| + instantiate | |
| + awk ' | |
| + /^@testset "Custom ACSet category-of-elements APIs" begin$/ { skip=1; next } | |
| + skip && /^end$/ { skip=0; next } | |
| + !skip { print } | |
| + ' test/categorical_algebra/CatElements.jl > /tmp/cat_elements_base.jl | |
| + julia --project=. /tmp/cat_elements_base.jl | |
| + ;; | |
| + new) | |
| + instantiate | |
| + printf '%s\n' 'module FixtureDynamicCatElements' > /tmp/cat_elements_dynamic.jl | |
| + printf '%s\n' 'using Test' >> /tmp/cat_elements_dynamic.jl | |
| + printf '%s\n' 'using Catlab.GATs, Catlab.Theories, Catlab.Graphs, Catlab.CategoricalAlgebra' >> /tmp/cat_elements_dynamic.jl | |
| + set +e | |
| + awk ' | |
| + /^import Catlab.CategoricalAlgebra.CSets: ACSetTransformation$/ { capture=1 } | |
| + capture && /^arr = @acset Graph begin$/ { found=1; exit } | |
| + capture { print } | |
| + END { if (!found) exit 3 } | |
| + ' test/categorical_algebra/CatElements.jl >> /tmp/cat_elements_dynamic.jl | |
| + awk_status=$? | |
| + set -e | |
| + printf '%s\n' 'end # module' >> /tmp/cat_elements_dynamic.jl | |
| + if [ "$awk_status" -ne 0 ]; then | |
| + echo "Custom ACSet testset not found in CatElements test file" | |
| + exit "$awk_status" | |
| + fi | |
| + julia --project=. /tmp/cat_elements_dynamic.jl | |
| + ;; | |
| + *) | |
| + echo "usage: $0 base|new" | |
| + exit 2 | |
| + ;; | |
| +esac | |