Exemple #1
0
def _get_meta_data(raw):
    meta = {}
    for item in META_FIELDS:
        tmp = re.search(b'%%%? ?(' + make_bytes(item) + b'):([\\w=., -]+)', raw)
        if tmp:
            meta[make_unicode_string(tmp.group(1))] = remove_uneccessary_spaces(make_unicode_string(tmp.group(2)))
    return meta
Exemple #2
0
 def test_remove_uneccessary_spaces(self):
     self.assertEqual(remove_uneccessary_spaces(" test"), "test")
     self.assertEqual(remove_uneccessary_spaces("blah   blah "),
                      "blah blah")
def test_remove_uneccessary_spaces(input_data, expected):
    assert remove_uneccessary_spaces(input_data) == expected
Exemple #4
0
 def test_remove_uneccessary_spaces(self):
     self.assertEqual(remove_uneccessary_spaces(' test'), 'test')
     self.assertEqual(remove_uneccessary_spaces('blah   blah '),
                      'blah blah')