You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Attributes are stored internally in a set of values. I think this is why the values do not follow a deterministic order when listed. I can see why it is an issue for your testing, but I wonder if you could have the same test done in a different way. The two documents that you provided above are equivalent.
Could that be wrapped by sorted()? Having a deterministic output would greatly improve doctests. Currently, I write
'''Example:>>> import prov.model as prov>>> d = prov.ProvDocument()>>> d.set_default_namespace('https://example.com')>>> d.entity('id', [(prov.PROV_TYPE, 'foo'), (prov.PROV_TYPE, 'bar')])>>> print(d.get_provn())document default <https://example.com> entity(id, [prov:type="foo", prov:type="bar"])endDocument'''
which is nicely readable as tutorial for the user, and would be a good doctest. Putting the expected output into a string, parsing it, and comparing with the input doc would probably work (right?), but is then not usable as documentation anymore.
If two documents are equivalent (and created in the same manner), shouldn't they have the same serialization?
With Python 3 (3.6, 3.7), the output with PROV-N (at least) is not deterministic:
Gives sometimes
and sometimes
This makes it difficult to create doctests here.
The text was updated successfully, but these errors were encountered: