mirror of
https://github.com/huggingface/lerobot.git
synced 2026-05-17 01:30:14 +00:00
Merge branch 'main' into user/michel-aractingi/2025_06_30_dataset_v3
Signed-off-by: Michel Aractingi <michel.aractingi@huggingface.co>
This commit is contained in:
@@ -1,3 +1,19 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright 2025 The HuggingFace Inc. team. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import pytest
|
||||
|
||||
from lerobot.utils.encoding_utils import (
|
||||
|
||||
@@ -18,6 +18,8 @@ import threading
|
||||
import time
|
||||
from queue import Queue
|
||||
|
||||
from torch.multiprocessing import Queue as TorchMPQueue
|
||||
|
||||
from lerobot.utils.queue import get_last_item_from_queue
|
||||
|
||||
|
||||
@@ -46,6 +48,20 @@ def test_get_last_item_multiple_items():
|
||||
assert queue.empty()
|
||||
|
||||
|
||||
def test_get_last_item_multiple_items_with_torch_queue():
|
||||
"""Test getting the last item when queue has multiple items."""
|
||||
queue = TorchMPQueue()
|
||||
items = ["first", "second", "third", "fourth", "last"]
|
||||
|
||||
for item in items:
|
||||
queue.put(item)
|
||||
|
||||
result = get_last_item_from_queue(queue)
|
||||
|
||||
assert result == "last"
|
||||
assert queue.empty()
|
||||
|
||||
|
||||
def test_get_last_item_different_types():
|
||||
"""Test with different data types in the queue."""
|
||||
queue = Queue()
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
import sys
|
||||
from typing import Callable
|
||||
from collections.abc import Callable
|
||||
|
||||
import pytest
|
||||
import torch
|
||||
|
||||
Reference in New Issue
Block a user