Пример #1
0
 def setUp(self):
     self.reference = gbd_hash(io.BytesIO(b"1 2 0 3 0"))
Пример #2
0
 def test_normalize_spaces(self):
     variant = gbd_hash(
         io.BytesIO(b" c test\np cnf 2 2 \n1 2 0     \r\n 3 0 \n "))
     self.assertEqual(self.reference, variant)
Пример #3
0
 def test_normalize_missing_trailing_zero(self):
     variant = gbd_hash(io.BytesIO(b"p cnf 2 2\n1 2 0\n3"))
     self.assertEqual(self.reference, variant)
Пример #4
0
 def test_normalize_linebreaks(self):
     variant1 = gbd_hash(io.BytesIO(b"p cnf 2 2\n1 2 0\r\n 3 0"))
     variant2 = gbd_hash(io.BytesIO(b"\np cnf 2 2\n1 2 0\r\n 3 0\n"))
     self.assertEqual(self.reference, variant1)
     self.assertEqual(self.reference, variant2)
Пример #5
0
 def test_normalize_header(self):
     variant = gbd_hash(io.BytesIO(b"p cnf 2 2\n1 2 0 3 0"))
     self.assertEqual(self.reference, variant)
Пример #6
0
 def hash_file(path):
     return gbd_hash(path)
Пример #7
0
Файл: init.py Проект: Udopia/gbd
def compute_hash(nohashvalue, path, args):
    eprint('Hashing {}'.format(path))
    hashvalue = gbd_hash(path)
    return [('local', hashvalue, path)]
Пример #8
0
def compute_hash(path):
    eprint('Hashing {}'.format(path))
    hashvalue = gbd_hash(path)
    attributes = [('INSERT', 'local', path)]
    return {'hashvalue': hashvalue, 'attributes': attributes}