How can I make my python binary converter pass these tests
<p>My python code is supposed to take decimal numbers from 0 to 255 as arguments and convert them to binary, return invalid when the parameter is less than 0 or greater than 255</p>

<pre><code>def binary_converter(x):

  if (x &lt; 0) or (x &gt; 255):

      return "invalid input"

  try:
      return int(bin(x)[2:]

  except ValueError:
      pass
</code></pre>

<p>The Test</p>

<pre><code>import unittest

class BinaryConverterTestCases(unittest.TestCase):

    def test_conversion_one(self):
    result = binary_converter(0)
    self.assertEqual(result, '0', msg='Invalid conversion')

    def test_conversion_two(self):
    result = binary_converter(62)
    self.assertEqual(result, '111110', msg='Invalid conversion')

    def test_no_negative_numbers(self):
    result = binary_converter(-1)
    self.assertEqual(result, 'Invalid input', msg='Input below 0 not allowed')

    def test_no_numbers_above_255(self):
    result = binary_converter(300)
    self.assertEqual(result, 'Invalid input', msg='Input above 255 not allowed')
</code></pre>

<p>So this is the final working code</p>

<pre><code>def binary_converter(x):

  if (x &lt; 0) or (x &gt; 255):

      return "Invalid input"

  try:
      return (bin(x)[2:])

  except ValueError:
      pass
</code></pre>

python