def setup_method(self): self.file = File({ "index": "1", "path": "/some/file/path.txt", "length": "2097152", "completedLength": "2048", "selected": "true", "uris": [{ "uri": "some uri", "status": "used" }, { "uri": "some other uri", "status": "waiting" }], })
def test_init_method(self): assert File({})
def test_eq_method(self): assert self.file == File({"path": "/some/file/path.txt"})
class TestFileClass: def setup_method(self): self.file = File({ "index": "1", "path": "/some/file/path.txt", "length": "2097152", "completedLength": "2048", "selected": "true", "uris": [{ "uri": "some uri", "status": "used" }, { "uri": "some other uri", "status": "waiting" }], }) def test_eq_method(self): assert self.file == File({"path": "/some/file/path.txt"}) def test_init_method(self): assert File({}) def test_str_method(self): assert str(self.file) == str(self.file.path) def test_completed_length(self): assert self.file.completed_length == 2048 def test_completed_length_string(self): assert self.file.completed_length_string() == "2.00 KiB" assert self.file.completed_length_string( human_readable=False) == "2048 B" def test_index(self): assert self.file.index == 1 def test_length(self): assert self.file.length == 2_097_152 def test_length_string(self): assert self.file.length_string() == "2.00 MiB" assert self.file.length_string(human_readable=False) == "2097152 B" def test_path(self): assert self.file.path == Path("/some/file/path.txt") def test_selected(self): assert self.file.selected is True def test_uris(self): assert self.file.uris == [{ "uri": "some uri", "status": "used" }, { "uri": "some other uri", "status": "waiting" }]