Esempio n. 1
0
 def setUp(self):
     self.reference = gbd_hash(io.BytesIO(b"1 2 0 3 0"))
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 6
0
 def hash_file(path):
     return gbd_hash(path)
Esempio n. 7
0
File: init.py Progetto: Udopia/gbd
def compute_hash(nohashvalue, path, args):
    eprint('Hashing {}'.format(path))
    hashvalue = gbd_hash(path)
    return [('local', hashvalue, path)]
Esempio n. 8
0
def compute_hash(path):
    eprint('Hashing {}'.format(path))
    hashvalue = gbd_hash(path)
    attributes = [('INSERT', 'local', path)]
    return {'hashvalue': hashvalue, 'attributes': attributes}