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
Our Descriptor class' from_str function converts strings to descriptors. When used from a subclass we should (and are documented as) providing a descriptor of that type. However, this fails with...
from stem.descriptor.networkstatus import NetworkStatusDocumentV3
with open('/home/atagar/Desktop/stem/test/unit/descriptor/data/cached-consensus') as consensus_file:
consensus = NetworkStatusDocumentV3.from_str(consensus_file.read())
Traceback (most recent call last):
File "broken_demo.py", line 4, in <module>
consensus = NetworkStatusDocumentV3.from_str(consensus_file.read())
File "/home/atagar/Desktop/stem/stem/descriptor/__init__.py", line 870, in from_str
results = list(parse_file(io.BytesIO(stem.util.str_tools._to_bytes(content)), **kwargs))
File "/home/atagar/Desktop/stem/stem/descriptor/__init__.py", line 448, in parse_file
for desc in parse(descriptor_file): # type: ignore
File "/home/atagar/Desktop/stem/stem/descriptor/__init__.py", line 446, in parse
raise TypeError("Unable to determine the descriptor's type. filename: '%s', first line: '%s'" % (filename, stem.util.str_tools._to_unicode(first_line)))
TypeError: Unable to determine the descriptor's type. filename: '<undefined>', first line: 'network-status-version 3'
We only have from_str unit tests for server and extrainfo descriptors, which coincidentally work because our parse method can infer their type from the content. This ticket is for two things...
Every descriptor type should have a from_str unit test.
Using from_str with a subclass should populate the descriptor type.
The text was updated successfully, but these errors were encountered:
Our Descriptor class'
from_str
function converts strings to descriptors. When used from a subclass we should (and are documented as) providing a descriptor of that type. However, this fails with...We only have from_str unit tests for server and extrainfo descriptors, which coincidentally work because our parse method can infer their type from the content. This ticket is for two things...
The text was updated successfully, but these errors were encountered: