Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Muna-S committed Jan 12, 2025
1 parent d8950ab commit acc430e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion solutions/binary_decimal_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ def decimal_to_binary(decimal: int) -> str:
Example: DecimalToBinary('binary', 392)
>>> 110001000
"""

if not isinstance(decimal, int):
raise ValueError
"""
Expand Down
5 changes: 2 additions & 3 deletions solutions/tests/test_binary_decimal_conversion.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""
Module: test_binary_decimal_conversion
contains test cases for the solution code.
Created by Muna Sattouf on January 2, 2024
Completed on January 2, 2024
"""
Expand All @@ -16,7 +15,7 @@ def test_decimal_to_binary(self):

def test_binary_to_decimal(self):
"""Should convert positive binary to decimal"""
self.assertEqual(binary_to_decimal(10011101), 157)
self.assertEqual(binary_to_decimal('10011101'), 157)

def test_zero_decimal_to_binary(self):
"""should return 0"""
Expand All @@ -40,7 +39,7 @@ def test_binarydecimalconversion_decimal(self):

def test_binarydecimalconversion_binary(self):
"""Should convert decimal to binary when conversion type is binary"""
self.assertEqual(binary_decimal_conversion('binary', '392'), 110001000)
self.assertEqual(binary_decimal_conversion('binary', '392'), '110001000')

def test_invalid_decimal_input(self):
"""Should raise ValueError for non-integer decimal input"""
Expand Down

0 comments on commit acc430e

Please sign in to comment.