use regex in member variable, non-capture some regex groups

This commit is contained in:
Stephan Gabler 2012-07-23 10:36:38 +02:00
parent 01131ce5c8
commit a78c08a60b
3 changed files with 10 additions and 10 deletions

View file

@ -6,6 +6,8 @@ import os
from jrnl.Journal import Journal
import shutil
# TODO: move test data to a data folder
class TestClasses(unittest.TestCase):
"""Test the behavior of the classes.
@ -40,13 +42,14 @@ class TestClasses(unittest.TestCase):
def test_rendering_md(self):
pass
def test_rendering_htm(self):
def test_rendering_html(self):
pass
def test_open_in_browser(self):
pass
def test_pathsearch_regex(self):
# TODO: test for windows path
true_positive = ['/Volumes/dedan/bla.png',
'/Users/dedan/projects/jrnl/tests/golden.jpg',
'/Volumes/dedan/test.png']
@ -55,7 +58,7 @@ class TestClasses(unittest.TestCase):
self.config['journal'] = os.path.join(self.test_data_path, 'empty.txt')
journal = Journal(config=self.config)
with open(os.path.join(self.test_data_path, 'url_test.txt')) as f:
results = [res[0] for res in journal.path_search.findall(f.read())]
results = [res for res in journal.path_search.findall(f.read())]
for tp in true_positive:
self.assertIn(tp, results)
for fp in false_positive:

View file

@ -1,6 +1,5 @@
ein normalser satz.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, (/Volumes/dedan/bla.png
) sed do eiusmod tempor incididunt ut (http://en.wikipedia.org/wiki/Generative_model) labore et dolore magna aliqua. Ut enim ad minim veniam, (/Users/dedan/projects/jrnl/tests/golden.jpg)
Lorem ipsum dolor sit amet, consectetur adipisicing elit, (/Volumes/dedan/bla.png) sed do eiusmod tempor incididunt ut (http://en.wikipedia.org/wiki/Generative_model) labore et dolore magna aliqua. Ut enim ad minim veniam, (/Users/dedan/projects/jrnl/tests/golden.jpg)
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor http://www.dict.cc/?s=descendant in reprehenderit in voluptate velit esse /Volumes/dedan/test.png cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non (/Volumes/dedan/bla.blub) proident, sunt in culpa qui officia deserunt mollit anim id est laborum.