def test_validate_2D_array_of_strings(self):
     sample_strs = """'guest1','guest2','another'\n
     'right','left', 'middle' """
     sample_inv_strs = """ 'guest1','guest2','another'\n
     'right','left', '' """
     self.assertTrue(strict_validate(sample_strs, 'string'))
     self.assertFalse(strict_validate(sample_inv_strs, 'string'))
 def test_validate_1D_array_of_ints(self):
     test_str_ints = '1,2,3,4,5,6'
     test_inv_ints = '1,2,,3,45'
     test_floats = '1.0,2,3,4'
     self.assertTrue(strict_validate(test_str_ints, 'integer'))
     self.assertFalse(strict_validate(test_inv_ints, 'integer'))
     self.assertFalse(strict_validate(test_floats, 'integer'))
 def test_validate_1D_array_of_floats(self):
     test_str_floats = '1.0,2,3,4,5'
     test_inv_floats = '1.0,,5.0,6.0'
     test_bad_floats = '1.0,er4,5.0,6.0'
     self.assertTrue(strict_validate(test_str_floats,'float'))
     self.assertFalse(strict_validate(test_inv_floats,'float'))
     self.assertFalse(strict_validate(test_bad_floats,'float'))
Beispiel #4
0
 def test_validate_2D_array_of_strings(self):
     sample_strs = """'guest1','guest2','another'\n
     'right','left', 'middle' """
     sample_inv_strs = """ 'guest1','guest2','another'\n
     'right','left', '' """
     self.assertTrue(strict_validate(sample_strs, 'string'))
     self.assertFalse(strict_validate(sample_inv_strs, 'string'))
Beispiel #5
0
 def test_validate_1D_array_of_floats(self):
     test_str_floats = '1.0,2,3,4,5'
     test_inv_floats = '1.0,,5.0,6.0'
     test_bad_floats = '1.0,er4,5.0,6.0'
     self.assertTrue(strict_validate(test_str_floats, 'float'))
     self.assertFalse(strict_validate(test_inv_floats, 'float'))
     self.assertFalse(strict_validate(test_bad_floats, 'float'))
Beispiel #6
0
 def test_validate_1D_array_of_ints(self):
     test_str_ints = '1,2,3,4,5,6'
     test_inv_ints = '1,2,,3,45'
     test_floats = '1.0,2,3,4'
     self.assertTrue(strict_validate(test_str_ints, 'integer'))
     self.assertFalse(strict_validate(test_inv_ints, 'integer'))
     self.assertFalse(strict_validate(test_floats, 'integer'))
 def test_validate_2D_array_of_floats(self):
     sample_2d_floats = '''1.0, 2.0, 3.0 \n
     1.23,5.4,3.3
     ''' 
     sample_2d_invalid = '''1.0,2.0\n
     ,2.3
     '''
     tiny_sample_floats = '''1.,2.\n
     3.,4.'''
     self.assertTrue(strict_validate(sample_2d_floats, 'float'))   
     self.assertFalse(strict_validate(sample_2d_invalid, 'float'))
     self.assertTrue(strict_validate(tiny_sample_floats, 'float'))
Beispiel #8
0
 def test_validate_2D_array_of_floats(self):
     sample_2d_floats = '''1.0, 2.0, 3.0 \n
     1.23,5.4,3.3
     '''
     sample_2d_invalid = '''1.0,2.0\n
     ,2.3
     '''
     tiny_sample_floats = '''1.,2.\n
     3.,4.'''
     self.assertTrue(strict_validate(sample_2d_floats, 'float'))
     self.assertFalse(strict_validate(sample_2d_invalid, 'float'))
     self.assertTrue(strict_validate(tiny_sample_floats, 'float'))
 def test_validate_2D_array_of_ints(self):
     sample_2d_ints = ''' 1,2,3,4\n
     2,3,4,5
     1,2,3,4'''
     sample_2d_invalid = '''1,2,3,4\n
     1,2,3
     '''
     sample_2d_with_empty = '''1,2,,3\n
     1,2,3'''
     sample_2d_some_floats = '''1.0,2,3\n
     1,2,34
     '''
     self.assertTrue(strict_validate(sample_2d_ints, 'integer')) 
     self.assertFalse(strict_validate(sample_2d_invalid, 'integer'))
     self.assertFalse(strict_validate(sample_2d_with_empty, 'integer'))
     self.assertFalse(strict_validate(sample_2d_some_floats, 'integer'))
Beispiel #10
0
 def test_validate_2D_array_of_ints(self):
     sample_2d_ints = ''' 1,2,3,4\n
     2,3,4,5
     1,2,3,4'''
     sample_2d_invalid = '''1,2,3,4\n
     1,2,3
     '''
     sample_2d_with_empty = '''1,2,,3\n
     1,2,3'''
     sample_2d_some_floats = '''1.0,2,3\n
     1,2,34
     '''
     self.assertTrue(strict_validate(sample_2d_ints, 'integer'))
     self.assertFalse(strict_validate(sample_2d_invalid, 'integer'))
     self.assertFalse(strict_validate(sample_2d_with_empty, 'integer'))
     self.assertFalse(strict_validate(sample_2d_some_floats, 'integer'))
 def test_validate_single_value(self):
     test_str_int = '3'
     test_str_float = '3.0' 
     test_inv_float = '3.Osjk.9'
     test_inv_int = 'O'
     test_tiny_float = '1.'
     self.assertTrue(strict_validate(test_str_float,'float'))
     self.assertFalse(strict_validate(test_inv_float,'float'))
     self.assertFalse(strict_validate(test_str_float,'integer'))
     self.assertTrue(strict_validate(test_str_int,'integer'))
     self.assertFalse(strict_validate(test_inv_int,'integer'))
     self.assertTrue(strict_validate(test_tiny_float,'float'))
Beispiel #12
0
 def test_validate_single_value(self):
     test_str_int = '3'
     test_str_float = '3.0'
     test_inv_float = '3.Osjk.9'
     test_inv_int = 'O'
     test_tiny_float = '1.'
     self.assertTrue(strict_validate(test_str_float, 'float'))
     self.assertFalse(strict_validate(test_inv_float, 'float'))
     self.assertFalse(strict_validate(test_str_float, 'integer'))
     self.assertTrue(strict_validate(test_str_int, 'integer'))
     self.assertFalse(strict_validate(test_inv_int, 'integer'))
     self.assertTrue(strict_validate(test_tiny_float, 'float'))
 def test_validate_1D_array_of_strings(self):
     sample_array = "'one', 'two', 'three'"
     sample_inv_array = "'one', 'two', ''"
     self.assertTrue(strict_validate(sample_array, 'string'))
     self.assertFalse(strict_validate(sample_inv_array, 'string'))
 def test_validate_string(self):
     sample_str = '1234asdf'
     empty_str = ''
     self.assertTrue(strict_validate(sample_str, 'string'))
     self.assertFalse(strict_validate(sample_str, 'string'))
Beispiel #15
0
 def test_validate_1D_array_of_strings(self):
     sample_array = "'one', 'two', 'three'"
     sample_inv_array = "'one', 'two', ''"
     self.assertTrue(strict_validate(sample_array, 'string'))
     self.assertFalse(strict_validate(sample_inv_array, 'string'))
Beispiel #16
0
 def test_validate_string(self):
     sample_str = '1234asdf'
     empty_str = ''
     self.assertTrue(strict_validate(sample_str, 'string'))
     self.assertFalse(strict_validate(sample_str, 'string'))