import random import unit_converter def python_unit_converter(celsius): return celsius * 1.8 + 32.0 def test_using_unit_converter(): assert unit_converter.convert_to_fahrenheit(25.0) == 77.0 assert python_unit_converter(25.0) == 77.0 def test_windchill(): temperature = unit_converter.Temperature(-20.0) assert round(temperature.windchill(32.0), 1) == -32.9 def test_using_python_constant(benchmark): result = benchmark(python_unit_converter, 25.0) assert round(result, 3) == round(77.0, 3) def test_using_rust_constant(benchmark): result = benchmark(unit_converter.convert_to_fahrenheit, 25.0) assert round(result, 3) == round(77.0, 3) def test_using_python(benchmark): temperature = random.random() * 100 result = benchmark(python_unit_converter, temperature) assert round(result, 3) == round(python_unit_converter(temperature), 3) def test_using_rust(benchmark): temperature = random.random() * 100 result = benchmark(unit_converter.convert_to_fahrenheit, temperature) assert round(result, 3) == round(python_unit_converter(temperature), 3)