def test_torchcript_invalid_method():
    """Test that an error is thrown with invalid torchscript method."""
    model = BoringModel()
    model.train(True)

    with pytest.raises(ValueError, match="only supports 'script' or 'trace'"):
        model.to_torchscript(method="temp")
Test that an error is thrown with invalid torchscript method.
tests/tests_pytorch/models/test_torchscript.py