Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openstructure
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
schwede
openstructure
Commits
10373c01
Commit
10373c01
authored
7 years ago
by
Gerardo Tauriello
Browse files
Options
Downloads
Patches
Plain Diff
SCHWED-2589: clean exception handling for MMCifInfoRevisions.
parent
64324e9a
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
modules/io/doc/mmcif.rst
+4
-1
4 additions, 1 deletion
modules/io/doc/mmcif.rst
modules/io/src/mol/mmcif_info.hh
+7
-4
7 additions, 4 deletions
modules/io/src/mol/mmcif_info.hh
modules/io/tests/test_mmcif_info.cc
+9
-0
9 additions, 0 deletions
modules/io/tests/test_mmcif_info.cc
with
20 additions
and
5 deletions
modules/io/doc/mmcif.rst
+
4
−
1
View file @
10373c01
...
...
@@ -993,6 +993,7 @@ of the annotation available.
:type i: :class:`int`
:return: Date the PDB revision took place. Expected format 'yyyy-mm-dd'.
:rtype: :class:`str`
:raises: Exception if *i* out of bounds.
.. method:: GetNum(i)
...
...
@@ -1000,6 +1001,7 @@ of the annotation available.
:type i: :class:`int`
:return: Unique identifier of revision (assigned in increasing order)
:rtype: :class:`int`
:raises: Exception if *i* out of bounds.
.. method:: GetStatus(i)
...
...
@@ -1007,10 +1009,11 @@ of the annotation available.
:type i: :class:`int`
:return: The status of this revision.
:rtype: :class:`str`
:raises: Exception if *i* out of bounds.
.. method:: GetLastDate()
:return: Date of the latest revision.
:return: Date of the latest revision
('?' if no revision set)
.
:rtype: :class:`str`
.. method:: SetDateOriginal(date)
...
...
This diff is collapsed.
Click to expand it.
modules/io/src/mol/mmcif_info.hh
+
7
−
4
View file @
10373c01
...
...
@@ -728,24 +728,27 @@ public:
///
/// \param i position in list
/// \return date
String
GetDate
(
size_t
i
)
const
{
return
date_
[
i
]
;
}
String
GetDate
(
size_t
i
)
const
{
return
date_
.
at
(
i
)
;
}
/// \brief Get revision num by index in list.
///
/// \param i position in list
/// \return num
int
GetNum
(
size_t
i
)
const
{
return
num_
[
i
]
;
}
int
GetNum
(
size_t
i
)
const
{
return
num_
.
at
(
i
)
;
}
/// \brief Get revision status by index in list.
///
/// \param i position in list
/// \return status
String
GetStatus
(
size_t
i
)
const
{
return
status_
[
i
]
;
}
String
GetStatus
(
size_t
i
)
const
{
return
status_
.
at
(
i
)
;
}
/// \brief Get date of last revision.
///
/// \return date
String
GetLastDate
()
const
{
return
date_
.
back
();
}
String
GetLastDate
()
const
{
if
(
date_
.
empty
())
return
"?"
;
else
return
date_
.
back
();
}
/// \brief Get the index of the full release revision.
///
...
...
This diff is collapsed.
Click to expand it.
modules/io/tests/test_mmcif_info.cc
+
9
−
0
View file @
10373c01
...
...
@@ -225,6 +225,12 @@ BOOST_AUTO_TEST_CASE(mmcif_info_revisions)
MMCifInfoRevisions
rev
=
MMCifInfoRevisions
();
BOOST_CHECK
(
rev
.
GetDateOriginal
()
==
"?"
);
BOOST_CHECK
(
rev
.
GetFirstRelease
()
==
0
);
BOOST_CHECK
(
rev
.
GetSize
()
==
0
);
BOOST_CHECK
(
rev
.
GetLastDate
()
==
"?"
);
BOOST_CHECK_THROW
(
rev
.
GetDate
(
0
),
std
::
out_of_range
);
BOOST_CHECK_THROW
(
rev
.
GetNum
(
0
),
std
::
out_of_range
);
BOOST_CHECK_THROW
(
rev
.
GetStatus
(
0
),
std
::
out_of_range
);
rev
.
SetDateOriginal
(
"2012-05-04"
);
rev
.
AddRevision
(
1
,
"2012-05-04"
,
"in preparation"
);
...
...
@@ -239,6 +245,9 @@ BOOST_AUTO_TEST_CASE(mmcif_info_revisions)
BOOST_CHECK
(
rev
.
GetFirstRelease
()
==
2
);
BOOST_CHECK
(
rev
.
GetNum
(
1
)
==
2
);
BOOST_CHECK
(
rev
.
GetStatus
(
1
)
==
"full release"
);
BOOST_CHECK_THROW
(
rev
.
GetDate
(
2
),
std
::
out_of_range
);
BOOST_CHECK_THROW
(
rev
.
GetNum
(
2
),
std
::
out_of_range
);
BOOST_CHECK_THROW
(
rev
.
GetStatus
(
2
),
std
::
out_of_range
);
BOOST_TEST_MESSAGE
(
" done."
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment