forked from beacon-biosignals/PyMNE.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtests.jl
25 lines (24 loc) · 1.1 KB
/
runtests.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using PyMNE
using Random
using Test
@testset "create_info and get_info" begin
dat = rand(1, 100)
info = PyMNE.create_info(pylist(["a"]), 100)
@test info isa Py
@test pyconvert(String, only(info.ch_names)) == "a"
# XXX why all the pyconvert? well comparisons of python objects give you
# a python boolean, so we need to explicitly convert for `@test`
# this is fine because it shows usage and tests out a bit more code
@test pyconvert(Bool, info.ch_names == info["ch_names"])
# if this ever works after a compat bump then we know we need to change things
@test_broken info.ch_names == info["ch_names"]
@test pyconvert(Bool, info["sfreq"] == 100)
@test pyconvert(Number, info["sfreq"]) == 100
raw = PyMNE.io.RawArray(dat, info)
@test pyconvert(Number, raw.n_times) == 100
# XXX Python + Windows means that this may or may not be Int32 even on x64
@test pyconvert(Number, raw.n_times) isa Integer
@test pyconvert(Number, raw.info["sfreq"]) == 100
# we want elementwise precise equality
@test all(pyconvert(AbstractArray, raw.get_data()) .== dat)
end