Example #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)
Example #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)
Example #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)))
Example #4
0
 def test_throw_with_bad_hash(self, hash_algo):
     with pytest.raises(UnsupportedHashTypeError):
         WheelRecord(hash_algo=hash_algo)
Example #5
0
 def test_throws_with_unknown_hash(self):
     with pytest.raises(UnsupportedHashTypeError):
         WheelRecord(hash_algo='frobnots')
Example #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
Example #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)
Example #8
0
 def test_from_empty_str_produces_empty_record(self):
     assert str(WheelRecord.from_str('')) == ''
Example #9
0
 def test_two_empty_records_are_equal(self):
     assert WheelRecord() == WheelRecord()
Example #10
0
 def record(self):
     return WheelRecord()