Skip to content

Commit f49d85d

Browse files
committed
Import documents - store unquoted path for later matching with metadata
1 parent 231ea7b commit f49d85d

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

orangecontrib/text/import_documents.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ class UrlReader(Reader, CoreUrlReader):
185185

186186
def __init__(self, path, *args):
187187
CoreUrlReader.__init__(self, path)
188-
Reader.__init__(self, self.filename, *args)
188+
Reader.__init__(self, path, *args)
189189

190190
def read_file(self):
191191
# unquote prevent double quoting when filename is already quoted

orangecontrib/text/tests/test_import_documents.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import unittest
2-
from unittest.mock import patch
32

43
import numpy as np
54
import pandas as pd
65

76
from orangecontrib.text.import_documents import ImportDocuments, UrlReader, \
87
TxtReader, TextData
8+
from pkg_resources import get_distribution
99

1010

1111
class TestUrlReader(unittest.TestCase):
@@ -51,6 +51,18 @@ def test_name_text_data(self):
5151
self.assertEqual(text_data.category, "data")
5252
self.assertEqual(text_data.content, "text")
5353

54+
def test_remove_quoting(self):
55+
"""
56+
Since URL quoting is implemented in Orange it can be removed from text
57+
addon when minimal version of Orange is increased to 3.29.1. When this
58+
test start to fail remove the test itself and lines 191 - 194 in
59+
import_documents.py
60+
"""
61+
distribution = get_distribution('orange3-text')
62+
orange_spec = next(x for x in distribution.requires() if x.name == "Orange3")
63+
orange_min_version = tuple(map(int, orange_spec.specs[0][1].split(".")))
64+
self.assertLess(orange_min_version, (3, 29, 1))
65+
5466

5567
class TestImportDocuments(unittest.TestCase):
5668
def test_scan_url(self):

0 commit comments

Comments
 (0)