示例#1
0
 def test_assert_all_ints_false(self):
     """Test that the data cleansing routine detects errors"""
     expected = False
     data = self.bad_val
     _sut = sut2
     actual = _sut(data)
     result = self.assertEqual(expected, actual)
     print_result("test_assert_all_ints_false", expected, result)
示例#2
0
 def test_handles_odd_lists(self):
     """Code handles iteration over odd numbers of items in list"""
     expected = None
     data = self.odd_num_vals
     _sut = sut
     actual = _sut(data)
     result = self.assertEqual(expected, actual)
     print_result("test_handles_odd_lists", expected, result)
示例#3
0
 def test_assert_all_ints_true(self):
     """Test that the data cleansing routine approves all ints"""
     expected = True
     data = self.no_val
     _sut = sut2
     actual = _sut(data)
     result = self.assertEqual(expected, actual)
     print_result("test_assert_all_ints_true", expected, result)
示例#4
0
 def test_handles_no_dupe(self):
     """ensure we can handle arrays with no dupes"""
     expected = None
     data = self.no_val
     _sut = sut
     actual = _sut(data)
     result = self.assertEqual(expected, actual)
     print_result("test_handles_no_dupe", expected, result)
示例#5
0
 def test_repeater_finds_first_dup(self):
     """Find the first dupe in the list with several dupes - non-recurse"""
     expected = self.two_dup_vals[0]
     data = self.two_dup_vals
     _sut = sut3
     actual = _sut(data)
     result = self.assertEqual(expected, actual)
     print_result("test_finds_first_dup returns", expected, result)
示例#6
0
    def test_repeater_does_not_throw_on_long_list(self):
        """Test to show non-recursion exceeds list length of recursion"""

        expected = None
        data = self.many_vals
        _sut = sut2
        actual = _sut(data)
        result = self.assertTrue(expected == actual)
        print_result("test_throws_on_deep_recurse", expected, result)
示例#7
0
 def test_catches_bad_vals(self):
     """test we are handling bad value checking correctly.
     Since this tests exceptions we wrap it in wiht"""
     expected = self.exception_text
     data = self.bad_val
     _sut = sut
     with self.assertRaises(Exception) as actual:
         _sut(data)
     result = self.assertTrue(expected in str(actual.exception))
     print_result("test_catches_bad_vals", expected, result)
示例#8
0
    def test_recursive_throws_on_deep_recurse(self):
        """Test to validate how deep we can recurse before throwing. Test for
        RecursionError: maximum recursion depth exceeded while getting the str of an object
        So far no pattern to increase depth beyond 19"""

        expected = self.recurse_error
        data = self.many_vals
        _sut = sut
        with self.assertRaises(Exception) as actual:
            _sut(data)
        result = self.assertTrue(expected in str(actual.exception))
        print_result("test_throws_on_deep_recurse", expected, result)