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)
def test_from_str_throws_on_directory_entry(self): with pytest.raises(RecordContainsDirectoryError): record_str = "./,sha256=whatever,0" WheelRecord.from_str(record_str)
def test_update_throws_on_directory_entry(self): with pytest.raises(RecordContainsDirectoryError): wr = WheelRecord() wr.update('path/to/a/directory/', BytesIO(bytes(1)))
def test_throw_with_bad_hash(self, hash_algo): with pytest.raises(UnsupportedHashTypeError): WheelRecord(hash_algo=hash_algo)
def test_throws_with_unknown_hash(self): with pytest.raises(UnsupportedHashTypeError): WheelRecord(hash_algo='frobnots')
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
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)
def test_from_empty_str_produces_empty_record(self): assert str(WheelRecord.from_str('')) == ''
def test_two_empty_records_are_equal(self): assert WheelRecord() == WheelRecord()
def record(self): return WheelRecord()