mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 19:17:13 -05:00 
			
		
		
		
	Merge pull request #307 from BastianPoe/bugfix/add_more_unit_test_for_date_detection
Bugfix/add more unit test for date detection
This commit is contained in:
		
						commit
						72750b9243
					
				@ -115,6 +115,42 @@ class TestDate(TestCase):
 | 
				
			|||||||
            datetime.datetime(2019, 3, 1, 0, 0, tzinfo=tz.tzutc())
 | 
					            datetime.datetime(2019, 3, 1, 0, 0, tzinfo=tz.tzutc())
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @mock.patch(
 | 
				
			||||||
 | 
					        "paperless_tesseract.parsers.RasterisedDocumentParser.SCRATCH",
 | 
				
			||||||
 | 
					        SAMPLE_FILES
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					    def test_date_format_8(self):
 | 
				
			||||||
 | 
					        input_file = os.path.join(self.SAMPLE_FILES, "")
 | 
				
			||||||
 | 
					        document = RasterisedDocumentParser(input_file)
 | 
				
			||||||
 | 
					        document._text = ("lorem ipsum\n"
 | 
				
			||||||
 | 
					                          "Wohnort\n"
 | 
				
			||||||
 | 
					                          "3100\n"
 | 
				
			||||||
 | 
					                          "IBAN\n"
 | 
				
			||||||
 | 
					                          "AT87 4534\n"
 | 
				
			||||||
 | 
					                          "1234\n"
 | 
				
			||||||
 | 
					                          "1234 5678\n"
 | 
				
			||||||
 | 
					                          "BIC\n"
 | 
				
			||||||
 | 
					                          "lorem ipsum\n"
 | 
				
			||||||
 | 
					                          "März 2020")
 | 
				
			||||||
 | 
					        self.assertEqual(document.get_date(),
 | 
				
			||||||
 | 
					                         datetime.datetime(2020, 3, 1, 0, 0,
 | 
				
			||||||
 | 
					                                           tzinfo=tz.tzutc()))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @mock.patch(
 | 
				
			||||||
 | 
					        "paperless_tesseract.parsers.RasterisedDocumentParser.SCRATCH",
 | 
				
			||||||
 | 
					        SAMPLE_FILES
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					    def test_date_format_9(self):
 | 
				
			||||||
 | 
					        input_file = os.path.join(self.SAMPLE_FILES, "")
 | 
				
			||||||
 | 
					        document = RasterisedDocumentParser(input_file)
 | 
				
			||||||
 | 
					        document._text = ("lorem ipsum\n"
 | 
				
			||||||
 | 
					                          "27. Nullmonth 2020\n"
 | 
				
			||||||
 | 
					                          "März 2020\n"
 | 
				
			||||||
 | 
					                          "lorem ipsum")
 | 
				
			||||||
 | 
					        self.assertEqual(document.get_date(),
 | 
				
			||||||
 | 
					                         datetime.datetime(2020, 3, 1, 0, 0,
 | 
				
			||||||
 | 
					                                           tzinfo=tz.tzutc()))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @mock.patch(
 | 
					    @mock.patch(
 | 
				
			||||||
        "paperless_tesseract.parsers.RasterisedDocumentParser.SCRATCH",
 | 
					        "paperless_tesseract.parsers.RasterisedDocumentParser.SCRATCH",
 | 
				
			||||||
        SAMPLE_FILES
 | 
					        SAMPLE_FILES
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user