From aa5756dbbbfcba74f3ab44d226d35611906039bc Mon Sep 17 00:00:00 2001 From: labrocadabro Date: Thu, 10 Apr 2025 19:02:43 -0300 Subject: [PATCH 01/15] Implement string reversal function --- src/string_reversal.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/string_reversal.py diff --git a/src/string_reversal.py b/src/string_reversal.py new file mode 100644 index 00000000..6c5177aa --- /dev/null +++ b/src/string_reversal.py @@ -0,0 +1,19 @@ +def reverse_string(s: str) -> str: + """ + Reverse the given string. + + Args: + s (str): The input string to be reversed. + + Returns: + str: The reversed string. + + Raises: + TypeError: If the input is not a string. + """ + # Check if input is a string + if not isinstance(s, str): + raise TypeError("Input must be a string") + + # Return the reversed string + return s[::-1] \ No newline at end of file From 987f1cf227452bac716448bfc872b88eedaf1f8b Mon Sep 17 00:00:00 2001 From: labrocadabro Date: Thu, 10 Apr 2025 19:02:54 -0300 Subject: [PATCH 02/15] Add comprehensive tests for string reversal function --- tests/test_string_reversal.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/test_string_reversal.py diff --git a/tests/test_string_reversal.py b/tests/test_string_reversal.py new file mode 100644 index 00000000..f17cd622 --- /dev/null +++ b/tests/test_string_reversal.py @@ -0,0 +1,35 @@ +import pytest +from src.string_reversal import reverse_string + +def test_reverse_string_basic(): + """Test basic string reversal.""" + assert reverse_string("hello") == "olleh" + assert reverse_string("python") == "nohtyp" + +def test_reverse_string_empty(): + """Test reversal of an empty string.""" + assert reverse_string("") == "" + +def test_reverse_string_single_char(): + """Test reversal of a single character.""" + assert reverse_string("a") == "a" + +def test_reverse_string_with_spaces(): + """Test string reversal with spaces.""" + assert reverse_string("hello world") == "dlrow olleh" + +def test_reverse_string_with_special_chars(): + """Test string reversal with special characters.""" + assert reverse_string("a!b@c#") == "#c@b!a" + +def test_reverse_string_invalid_input(): + """Test that TypeError is raised for non-string input.""" + with pytest.raises(TypeError, match="Input must be a string"): + reverse_string(123) + + with pytest.raises(TypeError, match="Input must be a string"): + reverse_string(None) + +def test_reverse_string_unicode(): + """Test reversal of Unicode strings.""" + assert reverse_string("こんにちは") == "はちにんこ" \ No newline at end of file From 53ee5e72301df2b10f19e0d15a853486f084d9d4 Mon Sep 17 00:00:00 2001 From: labrocadabro Date: Thu, 10 Apr 2025 19:03:58 -0300 Subject: [PATCH 03/15] Implement manual string reversal without slice or reverse() --- src/string_reversal.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/string_reversal.py b/src/string_reversal.py index 6c5177aa..7d91c690 100644 --- a/src/string_reversal.py +++ b/src/string_reversal.py @@ -1,6 +1,6 @@ def reverse_string(s: str) -> str: """ - Reverse the given string. + Reverse the given string manually, preserving all characters. Args: s (str): The input string to be reversed. @@ -11,9 +11,14 @@ def reverse_string(s: str) -> str: Raises: TypeError: If the input is not a string. """ - # Check if input is a string + # Type checking if not isinstance(s, str): raise TypeError("Input must be a string") - # Return the reversed string - return s[::-1] \ No newline at end of file + # Manual string reversal using a list-based approach + # This preserves all characters including spaces and special characters + reversed_chars = [] + for i in range(len(s) - 1, -1, -1): + reversed_chars.append(s[i]) + + return ''.join(reversed_chars) \ No newline at end of file From 29307e23efb42cfeb87c9381340e51610141ac8b Mon Sep 17 00:00:00 2001 From: labrocadabro Date: Thu, 10 Apr 2025 19:04:10 -0300 Subject: [PATCH 04/15] Update tests to verify manual string reversal implementation --- tests/test_string_reversal.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/test_string_reversal.py b/tests/test_string_reversal.py index f17cd622..98f56ed7 100644 --- a/tests/test_string_reversal.py +++ b/tests/test_string_reversal.py @@ -15,7 +15,7 @@ def test_reverse_string_single_char(): assert reverse_string("a") == "a" def test_reverse_string_with_spaces(): - """Test string reversal with spaces.""" + """Test string reversal preserves spaces.""" assert reverse_string("hello world") == "dlrow olleh" def test_reverse_string_with_special_chars(): @@ -32,4 +32,17 @@ def test_reverse_string_invalid_input(): def test_reverse_string_unicode(): """Test reversal of Unicode strings.""" - assert reverse_string("こんにちは") == "はちにんこ" \ No newline at end of file + assert reverse_string("こんにちは") == "はちにんこ" + +def test_implementation_method(): + """Ensure the implementation does not use slice notation or reverse().""" + import inspect + import src.string_reversal + + # Get the source code of the function + source_lines = inspect.getsource(src.string_reversal.reverse_string) + source_code = ''.join(source_lines) + + # Check that forbidden methods are not used + assert '[::-1]' not in source_code, "Do not use slice notation for reversal" + assert '.reverse()' not in source_code, "Do not use built-in reverse() method" \ No newline at end of file From 456e32f0b810dd059445ce0b05dd631baa8c0c22 Mon Sep 17 00:00:00 2001 From: laura-abro Date: Thu, 10 Apr 2025 19:05:26 -0300 Subject: [PATCH 05/15] Implement array flattening function with recursive approach --- src/array_flatten.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/array_flatten.py diff --git a/src/array_flatten.py b/src/array_flatten.py new file mode 100644 index 00000000..acdf2061 --- /dev/null +++ b/src/array_flatten.py @@ -0,0 +1,38 @@ +from typing import List, Union, Any + +def flatten_array(arr: List[Union[Any, List]]) -> List[Any]: + """ + Recursively flatten a nested list into a single-level list. + + Args: + arr (List[Union[Any, List]]): A potentially nested list to be flattened. + + Returns: + List[Any]: A flattened list containing all non-list elements. + + Raises: + TypeError: If the input is not a list. + + Examples: + >>> flatten_array([1, [2, 3], [4, [5, 6]]]) + [1, 2, 3, 4, 5, 6] + >>> flatten_array([1, 2, 3]) + [1, 2, 3] + >>> flatten_array([]) + [] + """ + # Check if input is a list + if not isinstance(arr, list): + raise TypeError("Input must be a list") + + # Use a single-pass flattening approach + flattened = [] + for item in arr: + # If the item is a list, recursively flatten it + if isinstance(item, list): + flattened.extend(flatten_array(item)) + else: + # If not a list, append directly + flattened.append(item) + + return flattened \ No newline at end of file From 79c34dcd0f62bb599392d59c574bdbe6c3987784 Mon Sep 17 00:00:00 2001 From: laura-abro Date: Thu, 10 Apr 2025 19:05:38 -0300 Subject: [PATCH 06/15] Add comprehensive tests for array flattening function --- tests/test_array_flatten.py | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/test_array_flatten.py diff --git a/tests/test_array_flatten.py b/tests/test_array_flatten.py new file mode 100644 index 00000000..90032cfa --- /dev/null +++ b/tests/test_array_flatten.py @@ -0,0 +1,38 @@ +import pytest +from src.array_flatten import flatten_array + +def test_flatten_simple_list(): + """Test flattening a simple list.""" + assert flatten_array([1, 2, 3]) == [1, 2, 3] + +def test_flatten_nested_list(): + """Test flattening a nested list.""" + assert flatten_array([1, [2, 3], [4, [5, 6]]]) == [1, 2, 3, 4, 5, 6] + +def test_flatten_empty_list(): + """Test flattening an empty list.""" + assert flatten_array([]) == [] + +def test_flatten_deeply_nested_list(): + """Test flattening a deeply nested list.""" + assert flatten_array([1, [2, [3, [4]]], 5]) == [1, 2, 3, 4, 5] + +def test_flatten_mixed_types_list(): + """Test flattening a list with mixed types.""" + assert flatten_array([1, 'a', [2, 'b'], [3, [4, 'c']]]) == [1, 'a', 2, 'b', 3, 4, 'c'] + +def test_invalid_input_type(): + """Test that a TypeError is raised for non-list inputs.""" + with pytest.raises(TypeError, match="Input must be a list"): + flatten_array("not a list") + + with pytest.raises(TypeError, match="Input must be a list"): + flatten_array(123) + +def test_nested_empty_lists(): + """Test flattening a list with nested empty lists.""" + assert flatten_array([1, [], [2, []], 3]) == [1, 2, 3] + +def test_single_element_nested_list(): + """Test flattening a list with single-element nested lists.""" + assert flatten_array([[1], [2], [3]]) == [1, 2, 3] \ No newline at end of file From ad2b031cf1e9566d11b7ff7b8e9d844516d22557 Mon Sep 17 00:00:00 2001 From: labrocadabro Date: Thu, 10 Apr 2025 19:08:01 -0300 Subject: [PATCH 07/15] Implement binary search function with comprehensive error handling --- src/binary_search.py | 48 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/binary_search.py diff --git a/src/binary_search.py b/src/binary_search.py new file mode 100644 index 00000000..4023b2fa --- /dev/null +++ b/src/binary_search.py @@ -0,0 +1,48 @@ +def binary_search(arr, target): + """ + Perform binary search on a sorted array to find the target element. + + Args: + arr (list): A sorted list of comparable elements + target: The element to search for + + Returns: + int: Index of the target element if found, otherwise -1 + + Raises: + TypeError: If input is not a list + ValueError: If the input list is not sorted + """ + # Check if input is a list + if not isinstance(arr, list): + raise TypeError("Input must be a list") + + # Check if list is sorted + if arr != sorted(arr): + raise ValueError("Input list must be sorted in ascending order") + + # Handle empty list case + if not arr: + return -1 + + # Standard binary search implementation + left, right = 0, len(arr) - 1 + + while left <= right: + # Calculate midpoint to avoid potential integer overflow + mid = left + (right - left) // 2 + + # Check if target is found + if arr[mid] == target: + return mid + + # If target is less than mid, search left half + elif arr[mid] > target: + right = mid - 1 + + # If target is greater than mid, search right half + else: + left = mid + 1 + + # Target not found + return -1 \ No newline at end of file From 99239a94c5f2724e4b29ef57eed22369503cb970 Mon Sep 17 00:00:00 2001 From: labrocadabro Date: Thu, 10 Apr 2025 19:08:15 -0300 Subject: [PATCH 08/15] Add comprehensive tests for binary search function --- tests/test_binary_search.py | 49 +++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 tests/test_binary_search.py diff --git a/tests/test_binary_search.py b/tests/test_binary_search.py new file mode 100644 index 00000000..9203e336 --- /dev/null +++ b/tests/test_binary_search.py @@ -0,0 +1,49 @@ +import pytest +from src.binary_search import binary_search + +def test_binary_search_basic(): + """Test basic functionality of binary search""" + arr = [1, 3, 5, 7, 9, 11, 13] + assert binary_search(arr, 7) == 3 + assert binary_search(arr, 13) == 6 + assert binary_search(arr, 1) == 0 + +def test_binary_search_not_found(): + """Test when target is not in the list""" + arr = [1, 3, 5, 7, 9, 11, 13] + assert binary_search(arr, 4) == -1 + assert binary_search(arr, 0) == -1 + assert binary_search(arr, 14) == -1 + +def test_binary_search_empty_list(): + """Test binary search on an empty list""" + assert binary_search([], 5) == -1 + +def test_binary_search_single_element(): + """Test binary search on single-element list""" + assert binary_search([5], 5) == 0 + assert binary_search([5], 6) == -1 + +def test_binary_search_invalid_input(): + """Test error handling for invalid inputs""" + with pytest.raises(TypeError, match="Input must be a list"): + binary_search("not a list", 5) + + with pytest.raises(ValueError, match="Input list must be sorted in ascending order"): + binary_search([5, 3, 1], 3) + +def test_binary_search_large_list(): + """Test binary search on a larger sorted list""" + arr = list(range(1000)) + assert binary_search(arr, 500) == 500 + assert binary_search(arr, 999) == 999 + assert binary_search(arr, 1000) == -1 + +def test_binary_search_duplicates(): + """Test binary search with a list containing duplicates""" + arr = [1, 2, 2, 3, 3, 3, 4, 4, 5] + # Note: This will return the index of one of the duplicate elements + assert binary_search(arr, 3) in [4, 5, 6] + assert binary_search(arr, 2) in [1, 2] + assert binary_search(arr, 1) == 0 + assert binary_search(arr, 5) == 8 \ No newline at end of file From b925ffd849ee0394204f96c470865422c84a7d91 Mon Sep 17 00:00:00 2001 From: labrocadabro Date: Thu, 10 Apr 2025 19:08:22 -0300 Subject: [PATCH 09/15] Add pytest to requirements --- requirements.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..55b033e9 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +pytest \ No newline at end of file From 0110474350ba3da637b0c8dea91ee8b7a2fc6806 Mon Sep 17 00:00:00 2001 From: laura-abro Date: Thu, 10 Apr 2025 19:09:50 -0300 Subject: [PATCH 10/15] Implement URL parser function with comprehensive parsing --- src/url_parser.py | 57 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/url_parser.py diff --git a/src/url_parser.py b/src/url_parser.py new file mode 100644 index 00000000..7fc8ed21 --- /dev/null +++ b/src/url_parser.py @@ -0,0 +1,57 @@ +from urllib.parse import urlparse, parse_qs +from typing import Dict, Any, Optional + +def parse_url(url: str) -> Dict[str, Any]: + """ + Parse a given URL into its component parts. + + Args: + url (str): The URL to parse + + Returns: + Dict[str, Any]: A dictionary containing parsed URL components + + Raises: + ValueError: If the URL is invalid or empty + """ + # Check for empty or None input + if not url or not isinstance(url, str): + raise ValueError("Invalid URL: URL must be a non-empty string") + + try: + # Use urlparse to break down the URL + parsed_url = urlparse(url) + + # Prepare the result dictionary + result = { + 'scheme': parsed_url.scheme, + 'netloc': parsed_url.netloc, + 'path': parsed_url.path, + 'params': parsed_url.params, + 'query': parse_qs(parsed_url.query), + 'fragment': parsed_url.fragment + } + + # Extract additional useful information + # Split netloc into username, password, hostname, and port + if '@' in parsed_url.netloc: + # Handle credentials + credentials, host = parsed_url.netloc.split('@', 1) + if ':' in credentials: + result['username'], result['password'] = credentials.split(':', 1) + else: + result['username'] = credentials + + # Split host and port + if ':' in parsed_url.netloc: + hostname_port = parsed_url.netloc.split(':') + result['hostname'] = hostname_port[0] + if len(hostname_port) > 1: + result['port'] = hostname_port[1] + else: + result['hostname'] = parsed_url.netloc + + return result + + except Exception as e: + raise ValueError(f"Error parsing URL: {str(e)}") \ No newline at end of file From 5d17aa0991552ae39aacf9c171782f16155135d5 Mon Sep 17 00:00:00 2001 From: laura-abro Date: Thu, 10 Apr 2025 19:10:06 -0300 Subject: [PATCH 11/15] Add comprehensive tests for URL parser function --- tests/test_url_parser.py | 64 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 tests/test_url_parser.py diff --git a/tests/test_url_parser.py b/tests/test_url_parser.py new file mode 100644 index 00000000..8fba9efc --- /dev/null +++ b/tests/test_url_parser.py @@ -0,0 +1,64 @@ +import pytest +from src.url_parser import parse_url + +def test_basic_url_parsing(): + """Test parsing a basic URL""" + url = "https://www.example.com/path/to/page" + result = parse_url(url) + assert result['scheme'] == 'https' + assert result['hostname'] == 'www.example.com' + assert result['path'] == '/path/to/page' + +def test_url_with_query_params(): + """Test parsing URL with query parameters""" + url = "https://example.com/search?q=python&category=programming" + result = parse_url(url) + assert result['scheme'] == 'https' + assert result['query'] == {'q': ['python'], 'category': ['programming']} + +def test_url_with_port(): + """Test parsing URL with port number""" + url = "http://localhost:8080/api" + result = parse_url(url) + assert result['scheme'] == 'http' + assert result['hostname'] == 'localhost' + assert result['port'] == '8080' + assert result['path'] == '/api' + +def test_url_with_credentials(): + """Test parsing URL with username and password""" + url = "https://username:password@example.com/private" + result = parse_url(url) + assert result['username'] == 'username' + assert result['password'] == 'password' + assert result['hostname'] == 'example.com' + assert result['path'] == '/private' + +def test_url_with_fragment(): + """Test parsing URL with fragment""" + url = "https://docs.example.com/page#section1" + result = parse_url(url) + assert result['fragment'] == 'section1' + +def test_invalid_url_empty(): + """Test handling of empty URL""" + with pytest.raises(ValueError, match="Invalid URL"): + parse_url("") + +def test_invalid_url_none(): + """Test handling of None input""" + with pytest.raises(ValueError, match="Invalid URL"): + parse_url(None) + +def test_complex_url(): + """Test parsing a complex URL with multiple components""" + url = "https://user:pass@example.com:8443/path/to/resource?key1=value1&key2=value2#fragment" + result = parse_url(url) + assert result['scheme'] == 'https' + assert result['username'] == 'user' + assert result['password'] == 'pass' + assert result['hostname'] == 'example.com' + assert result['port'] == '8443' + assert result['path'] == '/path/to/resource' + assert result['query'] == {'key1': ['value1'], 'key2': ['value2']} + assert result['fragment'] == 'fragment' \ No newline at end of file From 53411132a6418cf6be7b7d348bc48c1f92195470 Mon Sep 17 00:00:00 2001 From: laura-abro Date: Thu, 10 Apr 2025 19:10:15 -0300 Subject: [PATCH 12/15] Add pytest to requirements --- requirements.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..55b033e9 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +pytest \ No newline at end of file From 4c02b2aa7c3fef9fa02bab2033b20c8e4677ec5f Mon Sep 17 00:00:00 2001 From: laura-abro Date: Thu, 10 Apr 2025 19:10:34 -0300 Subject: [PATCH 13/15] Fix URL parsing to correctly extract hostname --- src/url_parser.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/url_parser.py b/src/url_parser.py index 7fc8ed21..0440071c 100644 --- a/src/url_parser.py +++ b/src/url_parser.py @@ -33,14 +33,16 @@ def parse_url(url: str) -> Dict[str, Any]: } # Extract additional useful information - # Split netloc into username, password, hostname, and port + # Handle credentials first if '@' in parsed_url.netloc: - # Handle credentials credentials, host = parsed_url.netloc.split('@', 1) if ':' in credentials: result['username'], result['password'] = credentials.split(':', 1) else: result['username'] = credentials + + # Update netloc to only include host + parsed_url = parsed_url._replace(netloc=host) # Split host and port if ':' in parsed_url.netloc: From cc14337c0be3e3788978bdc74e3f5af91d171719 Mon Sep 17 00:00:00 2001 From: labrocadabro Date: Thu, 10 Apr 2025 19:12:51 -0300 Subject: [PATCH 14/15] Add RGB to Hex converter function --- src/rgb_to_hex.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/rgb_to_hex.py diff --git a/src/rgb_to_hex.py b/src/rgb_to_hex.py new file mode 100644 index 00000000..1980275b --- /dev/null +++ b/src/rgb_to_hex.py @@ -0,0 +1,24 @@ +def rgb_to_hex(r: int, g: int, b: int) -> str: + """ + Convert RGB color values to a hexadecimal color code. + + Args: + r (int): Red color value (0-255) + g (int): Green color value (0-255) + b (int): Blue color value (0-255) + + Returns: + str: Hexadecimal color code (e.g., '#FF0000') + + Raises: + ValueError: If any color value is not in the range 0-255 + """ + # Validate input values + for color, name in [(r, 'Red'), (g, 'Green'), (b, 'Blue')]: + if not isinstance(color, int): + raise TypeError(f"{name} value must be an integer") + if color < 0 or color > 255: + raise ValueError(f"{name} value must be between 0 and 255") + + # Convert RGB to hex, ensuring two-digit representation + return f'#{r:02X}{g:02X}{b:02X}' \ No newline at end of file From df16e25874b398a04c62de80a36f7c12bbba4b12 Mon Sep 17 00:00:00 2001 From: labrocadabro Date: Thu, 10 Apr 2025 19:13:05 -0300 Subject: [PATCH 15/15] Add comprehensive tests for RGB to Hex converter --- tests/test_rgb_to_hex.py | 51 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 tests/test_rgb_to_hex.py diff --git a/tests/test_rgb_to_hex.py b/tests/test_rgb_to_hex.py new file mode 100644 index 00000000..08fbd30c --- /dev/null +++ b/tests/test_rgb_to_hex.py @@ -0,0 +1,51 @@ +import pytest +from src.rgb_to_hex import rgb_to_hex + +def test_basic_conversion(): + """Test basic RGB to hex conversion""" + assert rgb_to_hex(255, 0, 0) == '#FF0000' # Red + assert rgb_to_hex(0, 255, 0) == '#00FF00' # Green + assert rgb_to_hex(0, 0, 255) == '#0000FF' # Blue + assert rgb_to_hex(255, 255, 255) == '#FFFFFF' # White + assert rgb_to_hex(0, 0, 0) == '#000000' # Black + +def test_mixed_colors(): + """Test mixed color conversions""" + assert rgb_to_hex(128, 128, 128) == '#808080' # Gray + assert rgb_to_hex(255, 165, 0) == '#FFA500' # Orange + +def test_zero_values(): + """Test conversion with zero values""" + assert rgb_to_hex(0, 0, 0) == '#000000' + +def test_boundary_values(): + """Test boundary values""" + assert rgb_to_hex(0, 0, 0) == '#000000' + assert rgb_to_hex(255, 255, 255) == '#FFFFFF' + +def test_invalid_low_values(): + """Test error handling for values below 0""" + with pytest.raises(ValueError, match="Red value must be between 0 and 255"): + rgb_to_hex(-1, 0, 0) + with pytest.raises(ValueError, match="Green value must be between 0 and 255"): + rgb_to_hex(0, -1, 0) + with pytest.raises(ValueError, match="Blue value must be between 0 and 255"): + rgb_to_hex(0, 0, -1) + +def test_invalid_high_values(): + """Test error handling for values above 255""" + with pytest.raises(ValueError, match="Red value must be between 0 and 255"): + rgb_to_hex(256, 0, 0) + with pytest.raises(ValueError, match="Green value must be between 0 and 255"): + rgb_to_hex(0, 256, 0) + with pytest.raises(ValueError, match="Blue value must be between 0 and 255"): + rgb_to_hex(0, 0, 256) + +def test_invalid_type(): + """Test error handling for non-integer inputs""" + with pytest.raises(TypeError, match="Red value must be an integer"): + rgb_to_hex('255', 0, 0) + with pytest.raises(TypeError, match="Green value must be an integer"): + rgb_to_hex(0, '255', 0) + with pytest.raises(TypeError, match="Blue value must be an integer"): + rgb_to_hex(0, 0, '255') \ No newline at end of file