DataFrameMacros.jl icon indicating copy to clipboard operation
DataFrameMacros.jl copied to clipboard

@reexport DataFrames so `using DataFrames` is not required.

Open nathanrboyer opened this issue 10 months ago • 4 comments

Closes #31.

I just deleted the now failing HygieneModule tests. Not sure if there is something different you would want to test there?

nathanrboyer avatar Apr 19 '24 14:04 nathanrboyer

that test should stay, but you can explicitly import the used macros from DataFrameMacros. It tests whether the macro-generated symbols resolve correctly even if DataFrames symbols are not imported.

jkrumbiegel avatar Apr 19 '24 15:04 jkrumbiegel

I'm having trouble getting it to work.

module HygieneModule
    using DataFrameMacros: @passmissing, @transform
    using DataFrames: DataFrames
    using Test

    @testset "macro hygiene" begin
        df = DataFrames.DataFrame(x = [1, 2, 3])
        @test !(@isdefined ByRow)
        @test !(@isdefined passmissing)
        @test !(@isdefined transform)
        @test @transform(df, :y = @passmissing :x + 1) ==
            DataFrames.transform(df, :x => DataFrames.ByRow(DataFrames.passmissing(x -> x + 1)) => :y)
    end
end
Test Summary:           | Pass  Total  Time
table shortcut @astable |    3      3  0.5s
ERROR: LoadError: UndefVarError: `@passmissing` not defined
Stacktrace:
 [1] include(fname::String)
   @ Base.MainInclude .\client.jl:489
 [2] top-level scope
   @ none:6
in expression starting at C:\Users\nboyer.AIP\Documents\Julia\Forks\DataFrameMacros\test\runtests.jl:221
ERROR: Package DataFrameMacros errored during testing

nathanrboyer avatar Apr 19 '24 15:04 nathanrboyer

I think @passmissing exists only inside the other macros, it's not an exported macro

jkrumbiegel avatar Apr 19 '24 16:04 jkrumbiegel

I see. It works now.

nathanrboyer avatar Apr 19 '24 16:04 nathanrboyer