-
Notifications
You must be signed in to change notification settings - Fork 4
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
doctest @logical
versus doctest logical
#196
Comments
Hmm. We would expect that I think this should possibly be changed to: elseif (exist(what, 'file') && ~exist(what, 'dir')) || exist(what, 'builtin')
type = 'function';
elseif (strcmp(what(1), '@')) || (exist(['@' what], 'dir'))
% comes after 'file' above for "doctest @class/method"
type = 'class'; In fact, why don't we remove the |
A second, unrelated issue is that it seems confusing to me that we are testing both the class and the builtin when the user invokes |
I will try you suggestion...
That is do-able. Cross referencing this with a discussion at apjanke/octave-testify#12 where @mtmiller asked about |
Yeah to me the |
In Colin's case there is both a builtin and a class with the same name. Which of the two do you feel should take precedence when the users types I feel the current behavior (testing both the builtin and the class) is a bug in |
I think I really don't have enough experience and data with Matlab's naming conventions. I just played with the help system a little on Malab's web site. Some observations:
So far I don't see a lot of consistency, but it seems that the I think it does make sense to have some way to distinguish a class from a constructor, so this seems to be the way. |
Well, they are not really distinct. By implementing |
See also the older discussion #87 |
I think common practice (e.g., Chebfun, biggest user of Matlab OO that I know of) is to still use |
Sure, but is there a reason for |
TL;DR I agree with the original issue here, |
Oh, I see, so
(When I am in octsympy's How very confusing 😄 |
To summarize, is this what we want to go for?
2-4 seems to agree with how |
|
I don't understand this exception. Are they different because of a bug in Octave? Are they different because of some weird Matlab logic I don't understand yet? |
I would hope that this can also be made to work with a classdef class defined in a single |
Classdef can have a block of docs at the beginning. In Matlab, this is returned by
|
I don't think the Matlab logic is weird in this case, although its true we don't support it yet. |
Back to @catch22's proposal: I'm not sure I agree yet. Maybe I prefer Rational:
Downside: This also reserves the idea that |
I think I agree. |
Current summary of my thinking based on the above:
All of this should be tested with BIST to ensure we grab the correct number of tests in each case: I've started doing this in #198. |
I mostly agree with your thinking here as to how the test specifiers should work. Especially WRT item 0 and how the main usage should mean "everything it can find about class
I think I prefer We might want a
Is it normal for doctest to pull in all the superclass's tests, too? That seems a little unusual. If you run a test that tests a bunch of classes in a class hierarchy, you might end up redundantly calling the tests on superclasses. Especially if you have some real basic abstract base classes or mixins that get used in a lot of places. |
Do you mean "in theory you disagree with Item 0, but in practice you agree"? I think that summarizes how I feel :)
It does whatever |
I agree with the semantics; I just have reservations about the syntax. ;)
Could we change it to do |
👍 With regards to testing the docstrings of inherited methods that are not explicitly overridden: What do you feel is the most intuitive default? We can also do what's most easiest to implement for now and specify that the behavior in this situation is undefined (for future fixing).
👍 Should we already today use the syntax
I think I like (Another option would be to invent a special target corresponding to the top level class docs, such as |
I think ignoring inherited stuff is the most intuitive. But I've been working with OOP testing frameworks for a long time and that may color my view.
I would say yes. The difference between old and new style classes is an implementation detail of how the source files are laid out on disk; I don't think the user cares about that. So I think the same syntax should be used at the doctest interface level for both old and new classes, and it should smooth over the differences behind the scenes. And the |
Filed #203.
Discussion for #87? I think the rough consensus is we'd like to test overridden methods only (but not only methods defined in |
Use a try-catch block with the methods call. If it has methods it must be a class. This allows refactoring the object identification code a bit. Fixes a few bugs. Related to Issue #196.
I agree that this sounds most intuitive. |
I read through this thread, lots here. I think we do most of this now.
This is what we do now (at least on Octave). I think I'll close the thread: its all still here if we need to reference this in the future! |
The symbolic package which defines
@logical/isAlways
.There is some distinction between
doctest logical
anddoctest @logical
So far so good.
But if you're a developer, this distinction doesn't work if your pwd is
octsympy.git/inst/
: in that case both will do the same asdoctest @logical
...Not sure how important this is, but developers are exactly the people using doctest...
The text was updated successfully, but these errors were encountered: