def test_all_na(self): s = "(na,na,na,na,na)" self.assertEqual(fpm(s), (1, 1, 1, 1, 1, 1))
def test_with_spaces(self): s = "( 1 , 2, 3 ,4 , 5 , 5 )" self.assertEqual(fpm(s), (1, 2, 3, 4, 5, 5))
def test_na(self): s = "(1,2,3,na,na,4)" self.assertEqual(fpm(s), (1, 2, 3, 1, 1, 4))
def test_na_periods(self): s = "(1,2,3,n.a.,n.a,na.)" self.assertEqual(fpm(s), (1, 2, 3, 1, 1, 1))
def test_with_dashes(self): s = "(1,-,-,3,4,5)" self.assertEqual(fpm(s), (1, 1, 1, 3, 4, 5)) s = "(-,-,-,-,-,-)" self.assertEqual(fpm(s), (1, 1, 1, 1, 1, 1))
def test_no_data(self): s = "(,,,,)" self.assertEqual(fpm(s), (1, 1, 1, 1, 1, 1)) s = "(,,,,,)" self.assertEqual(fpm(s), (1, 1, 1, 1, 1, 1))
def test_not_found_in_middle(self): s = "lorem ipsum foo bar (1,2,3,4,5,5)" self.assertFalse(fpm(s))
def test_beginning_of_long_string(self): s = "(1,2,3,4,5,5); lorem ipsum foo bar" self.assertEqual(fpm(s), (1, 2, 3, 4, 5, 5))
def test_element_padding(self): s = "(1,2,3,4,5)" self.assertEqual(fpm(s), (1, 2, 3, 4, 5, 1))
def test_plain_string(self): s = "(1,2,3,4,5,5)" self.assertEqual(fpm(s), (1, 2, 3, 4, 5, 5))
def test_multiple_matrices(self): return # Only use if remove constraint that occurs at very beginning s = "(1,2,3,4,5,5); lorem ipsum foo bar (1,2,3,4,5,5)" with self.assertRaises(ValueError): fpm(s)