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