コード例 #1
0
 def test_get_numbers(self):
     """Function should receive a list and return only the numbers."""
     self.assertEqual([1, 2, 3], get_numbers(["1", "2", "3"]))
コード例 #2
0
 def test_get_numbers_floats(self):
     """Checks function with floats."""
     self.assertEqual([1.0, 2.0, 3],
                      get_numbers(["abc", "1.0", "abc2", 2.0, 3]))
コード例 #3
0
 def test_get_numbers_none(self):
     """Checks function with only strings."""
     self.assertEqual([], get_numbers(["abc", "abc2"]))
コード例 #4
0
 def test_get_numbers_ints(self):
     """Checks function with numbers, non_numbers and strings."""
     self.assertEqual([1, 2, 3], get_numbers(["abc", "abc2", 1, 2, 3]))
コード例 #5
0
 def test_get_numbers_intercalated(self):
     """Checks functions for numbers and non_numbers."""
     self.assertEqual([1, 2, 3], get_numbers(["1", "abc", "2", "abc2",
                                              "3"]))