コード例 #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
コード例 #2
0
 def test_remove_uneccessary_spaces(self):
     self.assertEqual(remove_uneccessary_spaces(" test"), "test")
     self.assertEqual(remove_uneccessary_spaces("blah   blah "),
                      "blah blah")
コード例 #3
0
def test_remove_uneccessary_spaces(input_data, expected):
    assert remove_uneccessary_spaces(input_data) == expected
コード例 #4
0
 def test_remove_uneccessary_spaces(self):
     self.assertEqual(remove_uneccessary_spaces(' test'), 'test')
     self.assertEqual(remove_uneccessary_spaces('blah   blah '),
                      'blah blah')