示例#1
0
 def test_all_na(self):
     s = "(na,na,na,na,na)"
     self.assertEqual(fpm(s), (1, 1, 1, 1, 1, 1))
示例#2
0
 def test_with_spaces(self):
     s = "( 1 , 2, 3 ,4 , 5 , 5 )"
     self.assertEqual(fpm(s), (1, 2, 3, 4, 5, 5))
示例#3
0
 def test_na(self):
     s = "(1,2,3,na,na,4)"
     self.assertEqual(fpm(s), (1, 2, 3, 1, 1, 4))
示例#4
0
 def test_na_periods(self):
     s = "(1,2,3,n.a.,n.a,na.)"
     self.assertEqual(fpm(s), (1, 2, 3, 1, 1, 1))
示例#5
0
 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))
示例#6
0
 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))
示例#7
0
 def test_not_found_in_middle(self):
     s = "lorem ipsum foo bar (1,2,3,4,5,5)"
     self.assertFalse(fpm(s))
示例#8
0
 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))
示例#9
0
 def test_element_padding(self):
     s = "(1,2,3,4,5)"
     self.assertEqual(fpm(s), (1, 2, 3, 4, 5, 1))
示例#10
0
 def test_plain_string(self):
     s = "(1,2,3,4,5,5)"
     self.assertEqual(fpm(s), (1, 2, 3, 4, 5, 5))
示例#11
0
 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)