Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for some untested methods #9674

Merged
merged 1 commit into from
Feb 17, 2015
Merged

Add tests for some untested methods #9674

merged 1 commit into from
Feb 17, 2015

Conversation

hayd
Copy link
Member

@hayd hayd commented Jan 8, 2015

Some easy tests for a few functions which are not tested at all currently. cc #9493

The last commit includes a very minor fix in the behaviour of histrange (to DomainError if n <= 0, rather than DomainError if n < 0 and InexactError if n == 0), I can remove this and make separate PR if this is controversial.

@JeffBezanson
Copy link
Member

This is great, many thanks. We certainly need every function tested. Could you move the tests in int.jl to the existing intfuncs.jl, and floatfuncs.jl to numbers.jl?

@tkelman
Copy link
Contributor

tkelman commented Jan 8, 2015

I was using strftime today which doesn't appear anywhere in test/*. I'll try to remember to add tests for it myself at some point if no one beats me to it.

@hayd
Copy link
Member Author

hayd commented Jan 8, 2015

@JeffBezanson will do, I wasn't sure what the convention was... I created those files as that was where those methods were defined (i.e. base/int.jl rather than base/intfuncs.jl) :s

Edit: yup, stupid to have 2 or 3 line test files... I must've been feeling ambitious when I opened them!

Will fix up the test failure(s), thought I had tested those locally, whoops.

@hayd hayd force-pushed the test2 branch 2 times, most recently from 04c20fc to 5fa17ab Compare January 9, 2015 21:57
@@ -0,0 +1,5 @@
@test @unix_only expanduser("~")[1] != ENV["HOME"]
Copy link
Member Author

Choose a reason for hiding this comment

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

this should be @unix_only @test (though not sure whether the @unix_only is needed)?

Copy link
Member

Choose a reason for hiding this comment

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

On Windows, expanduser does nothing.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah didn't realise that, so I guess

isabspath(expanduser("~")) == true

fails too.

Is there a reason this doesn't work on Windows? (Python's os.path.expanduser does.)

@tkelman tkelman added the test This change adds or pertains to unit tests label Jan 11, 2015
@hayd
Copy link
Member Author

hayd commented Jan 14, 2015

@tkelman
Copy link
Contributor

tkelman commented Jan 14, 2015

unfortunate, annoying, unrelated

@@ -545,6 +545,9 @@ function histrange{T<:Integer,N}(v::AbstractArray{T,N}, n::Integer)
if length(v) == 0
return 0:1:0
end
if n <= 0
throw(DomainError())
Copy link
Member

Choose a reason for hiding this comment

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

I would tend to throw an ArgumentError("number of bins n=$n must be positive") with a descriptive message. We tend to use DomainError for more "mathy" functions.

@hayd
Copy link
Member Author

hayd commented Feb 11, 2015

I rebased and have a 32 bit failure: https://ci.appveyor.com/project/StefanKarpinski/julia/build/1.0.2463/job/vfttxv7ydlir0ruq. Will squash if that's unrelated.

@quinnj
Copy link
Member

quinnj commented Feb 11, 2015

See #10045

@hayd
Copy link
Member Author

hayd commented Feb 11, 2015

thanks, will squash and remove/add a rogue ; (to remove the warning).

@timholy
Copy link
Member

timholy commented Feb 17, 2015

While this already had conflicts, I made it worse by merging #10214. @hayd, if you need any help, just ask.

@hayd
Copy link
Member Author

hayd commented Feb 17, 2015

@timholy rebased again - let me know if anything else needs doing!

@timholy
Copy link
Member

timholy commented Feb 17, 2015

This is great, many thanks!

timholy added a commit that referenced this pull request Feb 17, 2015
Add tests for some untested methods
@timholy timholy merged commit 4eed44c into JuliaLang:master Feb 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test This change adds or pertains to unit tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants