Skip to content
This repository has been archived by the owner on Aug 11, 2023. It is now read-only.

Commit

Permalink
Fix nothing not in EmptySpace. (#27)
Browse files Browse the repository at this point in the history
* Add EmptySpace.

* Fix nothing not in EmptySpace.

* Fix nothing value instead of Nothing type.
  • Loading branch information
aterenin authored Feb 26, 2020
1 parent 3fa05d6 commit 3d7855f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/implementations/spaces/empty_space.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export EmptySpace

struct EmptySpace <: AbstractSpace end

Base.eltype(s::EmptySpace) = nothing
Base.eltype(s::EmptySpace) = Nothing
Base.length(s::EmptySpace) = 0
Base.in(x, s::EmptySpace) = false
Base.in(x, s::EmptySpace) = x isa Nothing
Random.rand(rng::AbstractRNG, s::EmptySpace) = nothing
6 changes: 6 additions & 0 deletions test/spaces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
@test s3 isa DiscreteSpace
end

@testset "EmptySpace" begin
e = EmptySpace()
@test e isa EmptySpace
@test nothing in e
end

@testset "MultiDiscreteSpace" begin
@test_throws ArgumentError MultiDiscreteSpace([2, -1, 3])
@test_throws ArgumentError MultiDiscreteSpace([2, -1, 3])
Expand Down

2 comments on commit 3d7855f

@findmyway
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request updated: JuliaRegistries/General/10101

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.3 -m "<description of version>" 3d7855fe6a54f9de21584abf8540a6ad5d89d6ff
git push origin v0.6.3

Please sign in to comment.