Project

General

Profile

dataoneTypes_2_0

Added by Dave Vieglais about 9 years ago

from Mark:

I'm working on the unit tests for d1_common and with Skye's help, I've gotten most of the tests updated for v2. However, I'm having a problem with test_checksum. It seems that dataoneTypes_2_0 doesn't have a checksum property. It looks like there are lots of differences between dataoneTypes and dataoneTypes_2_0. I was wondering if you could help me understand the reasons behind the differences? That would help me ensure that there is adequate test coverage.


Replies (4)

RE: dataoneTypes_2_0 - Added by Dave Vieglais about 9 years ago

dataoneTypes_2_0 should have the all the v1 properties since v2 just extends. Can you paste in an example of code that works in v1 and doesn't in v2?

RE: dataoneTypes_2_0 - Added by Mark Flynn about 9 years ago

Dave Vieglais wrote:

dataoneTypes_2_0 should have the all the v1 properties since v2 just extends. Can you paste in an example of code that works in v1 and doesn't in v2?

Here's the test that's failing in v2:

def test_130(self):
'''Serialization: Checksum -> XML -> Checksum.
'''
checksum_obj_in = dataoneTypes.checksum('1' * 32)

Here's the error I see when I run the test:

ERROR: test_130 (d1_common.tests.test_checksum_2_0.TestChecksum)

Serialization: Checksum -> XML -> Checksum.

Traceback (most recent call last):
File "/home/mark/workspace/d1-api-common-python/src/d1_common/tests/test_checksum_2_0.py", line 108, in test_130
checksum_obj_in = dataoneTypes.checksum('1' * 32)
AttributeError: 'module' object has no attribute 'checksum'

After I sent you the question, I noticed that v1 dataoneTypes is imported:
import dataoneTypes as _ImportedBinding_dataoneTypes

I'll try to figure out why the checksum property isn't being imported

RE: dataoneTypes_2_0 - Added by Dave Vieglais about 9 years ago

Looks like the element is correctly imported as part of the SystemMetadata class, but is not explicitly imported as a class within the V2 namespace.

https://redmine.dataone.org/projects/d1-python/repository/revisions/14419/entry/trunk/d1_common_python/src/d1_common/types/generated/dataoneTypes_2_0.py

It is probably necessary to import the V1 types into V2?

RE: dataoneTypes_2_0 - Added by Mark Flynn about 9 years ago

I figured it out. the v1 datatypes are a property of ._ImportedBinding_dataoneTypes, so I just needed to reference checksum using dataoneTypes._ImportedBinding_dataoneTypes.checksum()

    (1-4/4)
    Add picture from clipboard (Maximum size: 14.8 MB)