Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

TestOsOpsCommon is added [generic os_ops tests]#231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
11 commits
Select commitHold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
TestOsOpsCommon is updated
New tests:- test_read_binary__spec__negative_offset- test_get_file_size
  • Loading branch information
@dmitry-lipetsk
dmitry-lipetsk committedApr 2, 2025
commitc2c2d4cb6c139724936d3b38809681ae71a52eb8
23 changes: 0 additions & 23 deletionstests/test_local.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -114,29 +114,6 @@ def test_read_binary__spec__unk_file(self):
match=re.escape("[Errno 2] No such file or directory: '/dummy'")):
self.operations.read_binary("/dummy", 0)

def test_read_binary__spec__negative_offset(self):
"""
Test LocalOperations::read_binary with negative offset.
"""

with pytest.raises(
ValueError,
match=re.escape("Negative 'offset' is not supported.")):
self.operations.read_binary(__file__, -1)

def test_get_file_size(self):
"""
Test LocalOperations::get_file_size.
"""
filename = __file__ # current file

sz0 = os.path.getsize(filename)
assert type(sz0) == int # noqa: E721

sz1 = self.operations.get_file_size(filename)
assert type(sz1) == int # noqa: E721
assert sz1 == sz0

def test_get_file_size__unk_file(self):
"""
Test LocalOperations::get_file_size.
Expand Down
26 changes: 26 additions & 0 deletionstests/test_os_ops_common.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -120,6 +120,32 @@ def test_read_binary__spec(self, os_ops: OsOperations):
assert type(response5) == bytes # noqa: E721
assert len(response5) == 0

def test_read_binary__spec__negative_offset(self, os_ops: OsOperations):
"""
Test RemoteOperations::read_binary with negative offset.
"""
assert isinstance(os_ops, OsOperations)

with pytest.raises(
ValueError,
match=re.escape("Negative 'offset' is not supported.")):
os_ops.read_binary(__file__, -1)

def test_get_file_size(self, os_ops: OsOperations):
"""
Test RemoteOperations::get_file_size.
"""
assert isinstance(os_ops, OsOperations)

filename = __file__ # current file

sz0 = os.path.getsize(filename)
assert type(sz0) == int # noqa: E721

sz1 = os_ops.get_file_size(filename)
assert type(sz1) == int # noqa: E721
assert sz1 == sz0

def test_isfile_true(self, os_ops: OsOperations):
"""
Test isfile for an existing file.
Expand Down
23 changes: 0 additions & 23 deletionstests/test_remote.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -320,29 +320,6 @@ def test_read_binary__spec__unk_file(self):
assert "No such file or directory" in str(x.value)
assert "/dummy" in str(x.value)

def test_read_binary__spec__negative_offset(self):
"""
Test RemoteOperations::read_binary with negative offset.
"""

with pytest.raises(
ValueError,
match=re.escape("Negative 'offset' is not supported.")):
self.operations.read_binary(__file__, -1)

def test_get_file_size(self):
"""
Test RemoteOperations::get_file_size.
"""
filename = __file__ # current file

sz0 = os.path.getsize(filename)
assert type(sz0) == int # noqa: E721

sz1 = self.operations.get_file_size(filename)
assert type(sz1) == int # noqa: E721
assert sz1 == sz0

def test_get_file_size__unk_file(self):
"""
Test RemoteOperations::get_file_size.
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp