Exemple #1
0
 def test_adding_same_files_to_two_records_make_them_equal(self):
     a = WheelRecord()
     b = WheelRecord()
     buf = BytesIO(bytes(1000))
     a.update('file', buf)
     buf.seek(0)
     b.update('file', buf)
Exemple #2
0
 def test_from_str_throws_on_directory_entry(self):
     with pytest.raises(RecordContainsDirectoryError):
         record_str = "./,sha256=whatever,0"
         WheelRecord.from_str(record_str)
Exemple #3
0
 def test_update_throws_on_directory_entry(self):
     with pytest.raises(RecordContainsDirectoryError):
         wr = WheelRecord()
         wr.update('path/to/a/directory/', BytesIO(bytes(1)))
Exemple #4
0
 def test_throw_with_bad_hash(self, hash_algo):
     with pytest.raises(UnsupportedHashTypeError):
         WheelRecord(hash_algo=hash_algo)
Exemple #5
0
 def test_throws_with_unknown_hash(self):
     with pytest.raises(UnsupportedHashTypeError):
         WheelRecord(hash_algo='frobnots')
Exemple #6
0
 def test_has_membership_operator_for_paths_in_the_record(self):
     wr = WheelRecord()
     wr.update('some/particular/path', BytesIO(bytes(1)))
     assert 'some/particular/path' in wr
Exemple #7
0
 def test_stringification_is_stable(self):
     wr = WheelRecord()
     buf = BytesIO(bytes(1000))
     wr.update('file', buf)
     assert str(WheelRecord.from_str(str(wr))) == str(wr)
Exemple #8
0
 def test_from_empty_str_produces_empty_record(self):
     assert str(WheelRecord.from_str('')) == ''
Exemple #9
0
 def test_two_empty_records_are_equal(self):
     assert WheelRecord() == WheelRecord()
Exemple #10
0
 def record(self):
     return WheelRecord()