# Path: openmmtools/utils.py
# _RESERVED_WORDS_PATTERNS = {
#     'lambda': re.compile(r'(?<![a-zA-Z0-9_])lambda(?![a-zA-Z0-9_])')
# }


import nose
        import openmm
from openmmtools.utils import _RESERVED_WORDS_PATTERNS
from openmmtools.utils import *
        from simtk import openmm

    for platform_index in range(openmm.Platform.getNumPlatforms()):
        platform = openmm.Platform.getPlatform(platform_index)
        platform_name = platform.getName()
        supported_precisions = { precision for precision in ['single', 'mixed', 'double'] if platform_supports_precision(platform, precision) }
        if platform_name == 'Reference':
            if supported_precisions != set(['double']):
                raise Exception(f"'Reference' platform should only support 'double' precision, but platform_supports_precision reports {supported_precisions}")
        if platform_name == 'CUDA':
            if supported_precisions != set(['single', 'mixed', 'double']):
                raise Exception(f"'CUDA' platform should support 'mixed' precision, but platform_supports_precision reports {supported_precisions}")
        if platform_name == 'CPU':
            if supported_precisions != set(['mixed']):
                raise Exception(f"'CPU' platform should support 'mixed' precision, but platform_supports_precision reports {supported_precisions}")


def test_string_platform_supports_precision():
    """Test that if we use a string for the platform name, it works"""
    assert platform_supports_precision("CPU", "mixed")

# =============================================================================
# TEST STRING MATHEMATICAL EXPRESSION PARSING UTILITIES
# =============================================================================

def test_sanitize_expression():
    """Test that reserved keywords are substituted correctly."""
    prefix = '_sanitized__'

    # Generate a bunch of test cases for each supported reserved keyword.
    test_cases = {}

# Path: openmmtools/utils.py
# _RESERVED_WORDS_PATTERNS = {
#     'lambda': re.compile(r'(?<![a-zA-Z0-9_])lambda(?![a-zA-Z0-9_])')
# }


# Path: openmmtools/tests/test_utils.py
import nose
        import openmm
from openmmtools.utils import _RESERVED_WORDS_PATTERNS
from openmmtools.utils import *
        from simtk import openmm


    for platform_index in range(openmm.Platform.getNumPlatforms()):
        platform = openmm.Platform.getPlatform(platform_index)
        platform_name = platform.getName()
        supported_precisions = { precision for precision in ['single', 'mixed', 'double'] if platform_supports_precision(platform, precision) }
        if platform_name == 'Reference':
            if supported_precisions != set(['double']):
                raise Exception(f"'Reference' platform should only support 'double' precision, but platform_supports_precision reports {supported_precisions}")
        if platform_name == 'CUDA':
            if supported_precisions != set(['single', 'mixed', 'double']):
                raise Exception(f"'CUDA' platform should support 'mixed' precision, but platform_supports_precision reports {supported_precisions}")
        if platform_name == 'CPU':
            if supported_precisions != set(['mixed']):
                raise Exception(f"'CPU' platform should support 'mixed' precision, but platform_supports_precision reports {supported_precisions}")


def test_string_platform_supports_precision():
    """Test that if we use a string for the platform name, it works"""
    assert platform_supports_precision("CPU", "mixed")

# =============================================================================
# TEST STRING MATHEMATICAL EXPRESSION PARSING UTILITIES
# =============================================================================

def test_sanitize_expression():
    """Test that reserved keywords are substituted correctly."""
    prefix = '_sanitized__'

    # Generate a bunch of test cases for each supported reserved keyword.
    test_cases = {}

    for word in _RESERVED_WORDS_PATTERNS: