Skip to content

catchup with pygfx, remove checks for pending uploads from tests #562

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 0 additions & 10 deletions tests/test_colors_buffer_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from fastplotlib.graphics._features import VertexColors, FeatureEvent
from .utils import (
generate_slice_indices,
assert_pending_uploads,
generate_color_inputs,
generate_positions_spiral_data,
)
Expand Down Expand Up @@ -61,11 +60,8 @@ def test_int(test_graphic):
colors = make_colors_buffer()

# TODO: placeholder until I make a testing figure where we draw frames only on call
colors.buffer._gfx_pending_uploads.clear()

colors[3] = "r"
npt.assert_almost_equal(colors[3], [1.0, 0.0, 0.0, 1.0])
assert colors.buffer._gfx_pending_uploads[-1] == (3, 1)

if test_graphic:
# test event
Expand Down Expand Up @@ -206,9 +202,6 @@ def test_slice(color_input, slice_method: dict, test_graphic: bool):
else:
colors = make_colors_buffer()

# TODO: placeholder until I make a testing figure where we draw frames only on call
colors.buffer._gfx_pending_uploads.clear()

s = slice_method["slice"]
indices = slice_method["indices"]
offset = slice_method["offset"]
Expand Down Expand Up @@ -238,9 +231,6 @@ def test_slice(color_input, slice_method: dict, test_graphic: bool):
else:
npt.assert_almost_equal(EVENT_RETURN_VALUE.info["user_value"], color_input)

# make sure correct offset and size marked for pending upload
assert_pending_uploads(colors.buffer, offset, size)

# check that others are not touched
others_truth = np.repeat([[1.0, 1.0, 1.0, 1.0]], repeats=len(others), axis=0)
npt.assert_almost_equal(colors[others], others_truth)
Expand Down
7 changes: 0 additions & 7 deletions tests/test_positions_data_buffer_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from fastplotlib.graphics._features import VertexPositions, FeatureEvent
from .utils import (
generate_slice_indices,
assert_pending_uploads,
generate_positions_spiral_data,
)

Expand Down Expand Up @@ -134,9 +133,6 @@ def test_slice(test_graphic, slice_method: dict, test_axis: str):
size = slice_method["size"]
others = slice_method["others"]

# TODO: placeholder until I make a testing figure where we draw frames only on call
points.buffer._gfx_pending_uploads.clear()

match test_axis:
case "y":
points[s, 1] = -data[s, 1]
Expand Down Expand Up @@ -203,6 +199,3 @@ def test_slice(test_graphic, slice_method: dict, test_axis: str):
else:
npt.assert_almost_equal(EVENT_RETURN_VALUE.info["key"], s)
npt.assert_almost_equal(EVENT_RETURN_VALUE.info["value"], -data[s])

# make sure correct offset and size marked for pending upload
assert_pending_uploads(points.buffer, offset, size)
1 change: 0 additions & 1 deletion tests/test_positions_graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
generate_color_inputs,
MULTI_COLORS_TRUTH,
generate_slice_indices,
assert_pending_uploads,
)


Expand Down
8 changes: 1 addition & 7 deletions tests/test_sizes_buffer_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest

from fastplotlib.graphics._features import PointsSizesFeature
from .utils import generate_slice_indices, assert_pending_uploads
from .utils import generate_slice_indices


def generate_data(input_type: str) -> np.ndarray | float:
Expand Down Expand Up @@ -52,9 +52,6 @@ def test_slice(slice_method: dict, user_input: str):

sizes = PointsSizesFeature(data, n_datapoints=10)

# TODO: placeholder until I make a testing figure where we draw frames only on call
sizes.buffer._gfx_pending_uploads.clear()

match user_input:
case "float":
sizes[s] = 20.0
Expand All @@ -71,6 +68,3 @@ def test_slice(slice_method: dict, user_input: str):
npt.assert_almost_equal(sizes[indices], cosine[s])
# make sure other sizes not modified
npt.assert_almost_equal(sizes[others], data[others])

# make sure correct offset and size marked for pending upload
assert_pending_uploads(sizes.buffer, offset, size)
11 changes: 0 additions & 11 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,6 @@ def generate_slice_indices(kind: int):
}


def assert_pending_uploads(buffer: pygfx.Buffer, offset: int, size: int):
upload_offset, upload_size = buffer._gfx_pending_uploads[-1]
# sometimes when slicing with step, it will over-estimate offset
# but it overestimates to upload 1 extra point so it's fine
assert (upload_offset == offset) or (upload_offset == offset - 1)

# sometimes when slicing with step, it will over-estimate size
# but it overestimates to upload 1 extra point so it's fine
assert (upload_size == size) or (upload_size == size + 1)


def generate_positions_spiral_data(inputs: str) -> np.ndarray:
"""
Generates a spiral/spring
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy