Exemple #1
0
 def test_parse_select(self):
     html = '''
         <select name="instrument">
             <option value="vocals">vocals</option>
             <option value="guitar">guitar</option>
             <option value="drums">drums</option>
             <option value="bass">bass</option>
         </select>
     '''
     _fields = _parse_fields(BeautifulSoup(html))
     assert_equal(len(_fields), 1)
     assert_true(isinstance(_fields['instrument'], fields.Select))
Exemple #2
0
 def test_parse_select(self):
     html = '''
         <select name="instrument">
             <option value="vocals">vocals</option>
             <option value="guitar">guitar</option>
             <option value="drums">drums</option>
             <option value="bass">bass</option>
         </select>
     '''
     _fields = _parse_fields(BeautifulSoup(html))
     assert_equal(len(_fields), 1)
     assert_true(isinstance(_fields['instrument'], fields.Select))
Exemple #3
0
 def test_parse_checkbox(self):
     html = '''
         <input type="checkbox" name="favorite_member" />freddie<br />
         <input type="checkbox" name="favorite_member" />brian<br />
         <input type="checkbox" name="favorite_member" />roger<br />
         <input type="checkbox" name="favorite_member" />john<br />
         <input type="checkbox" name="favorite_song" />rhapsody<br />
         <input type="checkbox" name="favorite_song" />killer<br />
     '''
     _fields = _parse_fields(BeautifulSoup(html))
     assert_equal(len(_fields), 2)
     assert_true(isinstance(_fields['favorite_member'], fields.Checkbox))
     assert_true(isinstance(_fields['favorite_song'], fields.Checkbox))
     assert_equal(len(_fields['favorite_member']._parsed), 4)
     assert_equal(len(_fields['favorite_song']._parsed), 2)
Exemple #4
0
 def test_parse_checkbox(self):
     html = '''
         <input type="checkbox" name="favorite_member" />freddie<br />
         <input type="checkbox" name="favorite_member" />brian<br />
         <input type="checkbox" name="favorite_member" />roger<br />
         <input type="checkbox" name="favorite_member" />john<br />
         <input type="checkbox" name="favorite_song" />rhapsody<br />
         <input type="checkbox" name="favorite_song" />killer<br />
     '''
     _fields = _parse_fields(BeautifulSoup(html))
     assert_equal(len(_fields), 2)
     assert_true(isinstance(_fields['favorite_member'], fields.Checkbox))
     assert_true(isinstance(_fields['favorite_song'], fields.Checkbox))
     assert_equal(
         len(_fields['favorite_member']._parsed), 4
     )
     assert_equal(
         len(_fields['favorite_song']._parsed), 2
     )
Exemple #5
0
 def test_parse_textarea(self):
     html = '<textarea name="band">queen</textarea>'
     _fields = _parse_fields(BeautifulSoup(html))
     assert_equal(len(_fields), 1)
     assert_true(isinstance(_fields['band'], fields.Textarea))
Exemple #6
0
 def test_parse_file_input(self):
     html = '<input name="band" type="file" />'
     _fields = _parse_fields(BeautifulSoup(html))
     assert_equal(len(_fields), 1)
     assert_true(isinstance(_fields['band'], fields.FileInput))
Exemple #7
0
 def test_parse_textarea(self):
     html = '<textarea name="band">queen</textarea>'
     _fields = _parse_fields(BeautifulSoup(html))
     assert_equal(len(_fields), 1)
     assert_true(isinstance(_fields['band'], fields.Textarea))
Exemple #8
0
 def test_parse_file_input(self):
     html = '<input name="band" type="file" />'
     _fields = _parse_fields(BeautifulSoup(html))
     assert_equal(len(_fields), 1)
     assert_true(isinstance(_fields['band'], fields.FileInput))