Hacker News new | ask | show | jobs
by Jtsummers 1290 days ago
> Edit: trying to cleanup hn formatting for readability

HN code formatting is simple, prefix each line with 2 spaces and then you don't need any extra blank lines like with normal paragraphs.

  class TestSumOfDigits(unittest.TestCase):
      def test_sum_of_digits_positive(self):
          self.assertEqual(sum_of_digits(123), 6)

      def test_sum_of_digits_negative(self):
          self.assertEqual(sum_of_digits(-123), None)

      def test_sum_of_digits_type(self):
          with self.assertRaises(TypeError):
              sum_of_digits('abc')

  if __name__ == '__main__':
      unittest.main()
``` does nothing, it's just noise here.