-
Notifications
You must be signed in to change notification settings - Fork 36
Improve test fromRdf#t0027. #669
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
base: main
Are you sure you want to change the base?
Conversation
- Improving the test coverage for use useNativeTypes algorithm in 8.5.2 2.4. - Remove the "True" and "False" boolean tests that can cause confusion that those words are special values. - Add tests using a value of "notnative" typed to boolean, integer, and double. These test that the type will be preserved when a native conversion does not happen.
|
I see it now, the original test suite only considered I would keep the
which could incorrectly coerce capitalized |
Restoring True and False tests to check only strict lexical values are converted to native values.
Ok. More tests are always good. Hopefully others don't get confused like I did and try to special case those values. |
niklasl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Note though, that in RDF 1.2, the requirement in RDF 1.1 (3.3, bullet point 2 b) to produce graphs containing ill-typed values is relaxed from a MUST to a SHOULD in the upcoming RDF 1.2 (3.4.2, bullet point 3.2). So an RDF 1.2 processor might drop those True|False|notnative tokens since they aren't in their respective value spaces. (But they shouldn't...)
pchampin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NB: my proposed change is just a suggestion, to respond to @davidlehn 's concern.
But I'm happy with the PR as it is.
|
|
||
| <http://example.com/boolean-object> <http://example.com/example> "True"^^<http://www.w3.org/2001/XMLSchema#boolean> . | ||
| <http://example.com/boolean-object> <http://example.com/example> "False"^^<http://www.w3.org/2001/XMLSchema#boolean> . | ||
| <http://example.com/boolean-object> <http://example.com/example> "notnative"^^<http://www.w3.org/2001/XMLSchema#boolean> . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose to add a comment to explain the rationale of testing "True" and "False",
and defusing the misunderstanding that they should be treated specifically.
| <http://example.com/boolean-object> <http://example.com/example> "notnative"^^<http://www.w3.org/2001/XMLSchema#boolean> . | |
| # NB: the two values above ("True" and "False") are *not* in the lexical space of xsd:bool, so they should be treated as any other invalid lexical form (like "notnative" below) | |
| <http://example.com/boolean-object> <http://example.com/example> "notnative"^^<http://www.w3.org/2001/XMLSchema#boolean> . |
I was fixing jsonld.js for fromRdf#t0027 and thought the tests could use some work to increase covearge.
https://github.com/w3c/json-ld-api/blob/main/tests/fromRdf/0027-in.nq
https://github.com/w3c/json-ld-api/blob/main/tests/fromRdf/0027-out.jsonld
I initially mistakenly tried to add specific support for the "True"/"False" tests:
But those are, I think, just testing that any not-native value is passed through even though it may not match semantics of the type. I think some other value text should be used to avoid confusion. For consistency, it probably makes sense to have similar tests for integers and doubles. jsonld.js was dropping the type for non-integers typed as integers.
There might be other edge cases that should be tested here too. This does seem like an incremental improvement.
Possible relevant references:
https://w3c.github.io/json-ld-api/#algorithm-16
#555
#656
#619
#625
#662