mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Fix tests to use _text instead of TEXT_CACHE
This commit is contained in:
parent
7e99e42924
commit
6f1ed89e26
@ -28,9 +28,9 @@ class TestDate(TestCase):
|
|||||||
def test_date_format_1(self):
|
def test_date_format_1(self):
|
||||||
input_file = os.path.join(self.SAMPLE_FILES, "")
|
input_file = os.path.join(self.SAMPLE_FILES, "")
|
||||||
document = RasterisedDocumentParser(input_file)
|
document = RasterisedDocumentParser(input_file)
|
||||||
document.TEXT_CACHE = "lorem ipsum 130218 lorem ipsum"
|
|
||||||
self.assertEqual(document.get_date(),
|
self.assertEqual(document.get_date(),
|
||||||
None)
|
None)
|
||||||
|
document._text = "lorem ipsum 130218 lorem ipsum"
|
||||||
|
|
||||||
@mock.patch(
|
@mock.patch(
|
||||||
"paperless_tesseract.parsers.RasterisedDocumentParser.SCRATCH",
|
"paperless_tesseract.parsers.RasterisedDocumentParser.SCRATCH",
|
||||||
@ -39,9 +39,9 @@ class TestDate(TestCase):
|
|||||||
def test_date_format_2(self):
|
def test_date_format_2(self):
|
||||||
input_file = os.path.join(self.SAMPLE_FILES, "")
|
input_file = os.path.join(self.SAMPLE_FILES, "")
|
||||||
document = RasterisedDocumentParser(input_file)
|
document = RasterisedDocumentParser(input_file)
|
||||||
document.TEXT_CACHE = "lorem ipsum 2018 lorem ipsum"
|
|
||||||
self.assertEqual(document.get_date(),
|
self.assertEqual(document.get_date(),
|
||||||
None)
|
None)
|
||||||
|
document._text = "lorem ipsum 2018 lorem ipsum"
|
||||||
|
|
||||||
@mock.patch(
|
@mock.patch(
|
||||||
"paperless_tesseract.parsers.RasterisedDocumentParser.SCRATCH",
|
"paperless_tesseract.parsers.RasterisedDocumentParser.SCRATCH",
|
||||||
@ -50,9 +50,9 @@ class TestDate(TestCase):
|
|||||||
def test_date_format_3(self):
|
def test_date_format_3(self):
|
||||||
input_file = os.path.join(self.SAMPLE_FILES, "")
|
input_file = os.path.join(self.SAMPLE_FILES, "")
|
||||||
document = RasterisedDocumentParser(input_file)
|
document = RasterisedDocumentParser(input_file)
|
||||||
document.TEXT_CACHE = "lorem ipsum 20180213 lorem ipsum"
|
|
||||||
self.assertEqual(document.get_date(),
|
self.assertEqual(document.get_date(),
|
||||||
None)
|
None)
|
||||||
|
document._text = "lorem ipsum 20180213 lorem ipsum"
|
||||||
|
|
||||||
@mock.patch(
|
@mock.patch(
|
||||||
"paperless_tesseract.parsers.RasterisedDocumentParser.SCRATCH",
|
"paperless_tesseract.parsers.RasterisedDocumentParser.SCRATCH",
|
||||||
@ -61,10 +61,10 @@ class TestDate(TestCase):
|
|||||||
def test_date_format_4(self):
|
def test_date_format_4(self):
|
||||||
input_file = os.path.join(self.SAMPLE_FILES, "")
|
input_file = os.path.join(self.SAMPLE_FILES, "")
|
||||||
document = RasterisedDocumentParser(input_file)
|
document = RasterisedDocumentParser(input_file)
|
||||||
document.TEXT_CACHE = "lorem ipsum 13.02.2018 lorem ipsum"
|
|
||||||
self.assertEqual(document.get_date(),
|
self.assertEqual(document.get_date(),
|
||||||
datetime.datetime(2018, 2, 13, 0, 0,
|
datetime.datetime(2018, 2, 13, 0, 0,
|
||||||
tzinfo=tz.tzutc()))
|
tzinfo=tz.tzutc()))
|
||||||
|
document._text = "lorem ipsum 13.02.2018 lorem ipsum"
|
||||||
|
|
||||||
@mock.patch(
|
@mock.patch(
|
||||||
"paperless_tesseract.parsers.RasterisedDocumentParser.SCRATCH",
|
"paperless_tesseract.parsers.RasterisedDocumentParser.SCRATCH",
|
||||||
@ -73,11 +73,11 @@ class TestDate(TestCase):
|
|||||||
def test_date_format_5(self):
|
def test_date_format_5(self):
|
||||||
input_file = os.path.join(self.SAMPLE_FILES, "")
|
input_file = os.path.join(self.SAMPLE_FILES, "")
|
||||||
document = RasterisedDocumentParser(input_file)
|
document = RasterisedDocumentParser(input_file)
|
||||||
document.TEXT_CACHE = ("lorem ipsum 130218, 2018, 20180213 and "
|
|
||||||
"13.02.2018 lorem ipsum")
|
|
||||||
self.assertEqual(document.get_date(),
|
self.assertEqual(document.get_date(),
|
||||||
datetime.datetime(2018, 2, 13, 0, 0,
|
datetime.datetime(2018, 2, 13, 0, 0,
|
||||||
tzinfo=tz.tzutc()))
|
tzinfo=tz.tzutc()))
|
||||||
|
document._text = (
|
||||||
|
"lorem ipsum 130218, 2018, 20180213 and 13.02.2018 lorem ipsum")
|
||||||
|
|
||||||
@mock.patch(
|
@mock.patch(
|
||||||
"paperless_tesseract.parsers.RasterisedDocumentParser.SCRATCH",
|
"paperless_tesseract.parsers.RasterisedDocumentParser.SCRATCH",
|
||||||
@ -86,7 +86,10 @@ class TestDate(TestCase):
|
|||||||
def test_date_format_6(self):
|
def test_date_format_6(self):
|
||||||
input_file = os.path.join(self.SAMPLE_FILES, "")
|
input_file = os.path.join(self.SAMPLE_FILES, "")
|
||||||
document = RasterisedDocumentParser(input_file)
|
document = RasterisedDocumentParser(input_file)
|
||||||
document.TEXT_CACHE = ("lorem ipsum\n"
|
self.assertEqual(document.get_date(),
|
||||||
|
None)
|
||||||
|
document._text = (
|
||||||
|
"lorem ipsum\n"
|
||||||
"Wohnort\n"
|
"Wohnort\n"
|
||||||
"3100\n"
|
"3100\n"
|
||||||
"IBAN\n"
|
"IBAN\n"
|
||||||
@ -94,9 +97,8 @@ class TestDate(TestCase):
|
|||||||
"1234\n"
|
"1234\n"
|
||||||
"1234 5678\n"
|
"1234 5678\n"
|
||||||
"BIC\n"
|
"BIC\n"
|
||||||
"lorem ipsum")
|
"lorem ipsum"
|
||||||
self.assertEqual(document.get_date(),
|
)
|
||||||
None)
|
|
||||||
|
|
||||||
@mock.patch(
|
@mock.patch(
|
||||||
"paperless_tesseract.parsers.RasterisedDocumentParser.SCRATCH",
|
"paperless_tesseract.parsers.RasterisedDocumentParser.SCRATCH",
|
||||||
@ -105,12 +107,14 @@ class TestDate(TestCase):
|
|||||||
def test_date_format_7(self):
|
def test_date_format_7(self):
|
||||||
input_file = os.path.join(self.SAMPLE_FILES, "")
|
input_file = os.path.join(self.SAMPLE_FILES, "")
|
||||||
document = RasterisedDocumentParser(input_file)
|
document = RasterisedDocumentParser(input_file)
|
||||||
document.TEXT_CACHE = ("lorem ipsum\n"
|
|
||||||
"März 2019\n"
|
|
||||||
"lorem ipsum")
|
|
||||||
self.assertEqual(document.get_date(),
|
self.assertEqual(document.get_date(),
|
||||||
datetime.datetime(2019, 3, 1, 0, 0,
|
datetime.datetime(2019, 3, 1, 0, 0,
|
||||||
tzinfo=tz.tzutc()))
|
tzinfo=tz.tzutc()))
|
||||||
|
document._text = (
|
||||||
|
"lorem ipsum\n"
|
||||||
|
"März 2019\n"
|
||||||
|
"lorem ipsum"
|
||||||
|
)
|
||||||
|
|
||||||
@mock.patch(
|
@mock.patch(
|
||||||
"paperless_tesseract.parsers.RasterisedDocumentParser.SCRATCH",
|
"paperless_tesseract.parsers.RasterisedDocumentParser.SCRATCH",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user