Skip to content
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

failing test: acme thread parsing #35

Open
erooke opened this issue Oct 11, 2024 · 0 comments
Open

failing test: acme thread parsing #35

erooke opened this issue Oct 11, 2024 · 0 comments

Comments

@erooke
Copy link

erooke commented Oct 11, 2024

The following test case for acme thread parsing:

with self.assertRaises(ValueError):
AcmeThread(size="1.25", length=1 * IN)

fails as it throws a key error instead of a value error.

Pytest output
============================= test session starts ==============================
platform linux -- Python 3.12.5, pytest-8.3.2, pluggy-1.5.0
rootdir: /home/ethan/code/ocp.nix/bd_warehouse
configfile: pyproject.toml
collected 19 items

tests/test_thread.py .........F.........                                 [100%]

=================================== FAILURES ===================================
_________________________ TestAcmeThread.test_parsing __________________________

self = <test_thread.TestAcmeThread testMethod=test_parsing>

    def test_parsing(self):
        with self.assertRaises(ValueError):
            AcmeThread(size="1 1/4", length=1 * IN, external=False, hand="righty")
        with self.assertRaises(ValueError):
>           AcmeThread(size="1.25", length=1 * IN)

tests/test_thread.py:137: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def __init__(
        self,
        size: str,
        length: float,
        external: bool = True,
        hand: Literal["right", "left"] = "right",
        end_finishes: tuple[
            Literal["raw", "square", "fade", "chamfer"],
            Literal["raw", "square", "fade", "chamfer"],
        ] = ("fade", "fade"),
        interference: float = 0.2,
        rotation: RotationLike = (0, 0, 0),
        align: Union[None, Align, tuple[Align, Align, Align]] = None,
        mode: Mode = Mode.ADD,
    ):
        diameter = imperial_str_to_float(size)
>       pitch = AcmeThread.acme_pitch[size]
E       KeyError: '1.25'

src/bd_warehouse/thread.py:742: KeyError
=============================== warnings summary ===============================
tests/test_thread.py: 32 warnings
  /home/ethan/code/ocp.nix/bd_warehouse/src/bd_warehouse/thread.py:517: DeprecationWarning: make_compound() will be deprecated - use the Compound constructor instead
    part=Compound.make_compound(bd_object.solids()),

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/test_thread.py::TestAcmeThread::test_parsing - KeyError: '1.25'
================== 1 failed, 18 passed, 32 warnings in 12.90s ==================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant