-
Notifications
You must be signed in to change notification settings - Fork 14
Fractional date bug 1361 #148
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: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
| <resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xmlns="http://datacite.org/schema/kernel-4" xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4.4/metadata.xsd"> | ||
| <identifier identifierType="DOI">10.5072/example-fractional-date</identifier> | ||
| <creators> | ||
| <creator> | ||
| <creatorName>Claire L O?Brien</creatorName> | ||
| </creator> | ||
| </creators> | ||
| <titles> | ||
| <title>Impact of Colonoscopy Bowel Preparation on Intestinal Microbiota</title> | ||
| </titles> | ||
| <dates> | ||
| <date dateType="Updated">2020-11-06T21:37:33.12Z</date> | ||
| </dates> | ||
| <publisher>The Australian National University Data Commons</publisher> | ||
| <publicationYear>2013</publicationYear> | ||
| <rightsList> | ||
| <rights xml:lang="en-US" schemeURI="https://spdx.org/licenses/" rightsIdentifierScheme="SPDX" rightsIdentifier="CC0 1.0" rightsURI="http://creativecommons.org/publicdomain/zero/1.0/"/> | ||
| </rightsList> | ||
| <language>en</language> | ||
| <resourceType resourceTypeGeneral="Dissertation"></resourceType> | ||
| </resource> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1653,4 +1653,12 @@ | |
| ) | ||
| end | ||
|
|
||
| it "Parses dates with fractional seconds" do | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add a new test as well, that also handles the ranges we talked about. |
||
| input = fixture_path + "datacite-example-fractional-date.xml" | ||
| subject = Bolognese::Metadata.new(input: input) | ||
| expect(subject.valid?).to be true | ||
| expect(subject.dates).to eq([{"date"=>"2020-11-06T21:37:33.12Z", "dateType"=>"Updated"}, {"date"=>"2013", "dateType"=>"Issued"}]) | ||
| end | ||
|
|
||
|
|
||
| end | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
This is my first time seeing
rescue nil?Does this catch all exceptions? That might be too broad. If there are specific types of exceptions we need to guard against, it could be good to specify the type.
If this was more about providing a default value,
nillshould be returned if theifstatement fails.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.
Yes rescue nil is very broad, a quick google also suggests some articles it's quite slow.
What's the actual exception being thrown and from what bit? The time.iso8601?
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.
Yes, the rescue is for the Time.iso8601 method. It throws errors if the date format is wrong, whereas the Date.edtf method doesn't. I can narrow down the rescue to more specific exceptions though