Skip to content

Fix deepcopy of Dict, Set, and others that are supported by DeepDiffs.jl - #17

Open
Teo-ShaoWei wants to merge 1 commit into
ssfrr:masterfrom
Teo-ShaoWei:revert-deepdiff-impl
Open

Fix deepcopy of Dict, Set, and others that are supported by DeepDiffs.jl#17
Teo-ShaoWei wants to merge 1 commit into
ssfrr:masterfrom
Teo-ShaoWei:revert-deepdiff-impl

Conversation

@Teo-ShaoWei

Copy link
Copy Markdown

The current implementation breaks for Dict, Set, etc due to the specific implementation of #10, e.g.

julia> @testset ExtendedTestSet "begin" begin
           @test Dict(1 => 2) == Dict(2 => 2)
       end

=====================================================
begin: Test Failed at REPL[5]:2
  Expression: Dict(1 => 2) == Dict(2 => 2)
   Evaluated: Dict(1 => 2) == Dict(2 => 2)

<redacted>...

This PR will attempt to fix comparing of Dict, Set, etc while keeping the rest of the vectors and so on working.

julia> @testset ExtendedTestSet "begin" begin
           @test Dict(1 => 2) == Dict(2 => 2)
       end

=====================================================
begin: Test Failed
  Expression: Dict(1 => 2) == Dict(2 => 2)

Diff:
Dict(
-    1 => 2,
+    2 => 2,
)

<redacted>...

We achieved this by reverting to the implementation before the change. That is, to just evaluate regardless of what the LHS and RHS are in a @test LHS == RHS statement. There is one con, which is that deepdiff currently doesn't compare everything sufficiently well yet, especially if the objects are not part of the Julia base. This however should be an improvement that we will want to delegate to DeepDiffs.jl, which is good as that gives us a new good reason to help make improvement to that project 💪

…pecific implementation of ssfrr#10, e.g.

```
julia> @testset ExtendedTestSet "begin" begin
           @test Dict(1 => 2) == Dict(2 => 2)
       end

=====================================================
begin: Test Failed at REPL[5]:2
  Expression: Dict(1 => 2) == Dict(2 => 2)
   Evaluated: Dict(1 => 2) == Dict(2 => 2)

<redacted>...
```

This PR will attempt to fix comparing of `Dict`, `Set`, etc while keeping the rest of the vectors and so on working.
```
julia> @testset ExtendedTestSet "begin" begin
           @test Dict(1 => 2) == Dict(2 => 2)
       end

=====================================================
begin: Test Failed
  Expression: Dict(1 => 2) == Dict(2 => 2)

Diff:
Dict(
-    1 => 2,
+    2 => 2,
)

<redacted>...
```

We achieved this by reverting to the implementation before the change. That is, to just evaluate regardless of what the LHS and RHS are in a `@test LHS == RHS` statement. There is one con, which is that `deepdiff` currently doesn't compare everything sufficiently well yet, especially if the objects are not part of the Julia base. This however should be an improvement that we will want to delegate to [DeepDiffs.jl](https://github.com/ssfrr/DeepDiffs.jl), which is good as that gives us a new good reason to help make improvement to that project 💪
@Teo-ShaoWei Teo-ShaoWei changed the title The current implementation breaks for Dict, Set, etc due to the s… Fix deepcopy of Dict, Set, and others that are supported by DeepDiffs.jl Jun 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant