Example #1
0
 def test_status(self):
     ep_id = "519"
     ep = BangumiEpisode.from_html(ep_id, self._ep_html)
     with self.assertRaises(ValueError):
         ep.status = 'invalid'
     self.assertEqual('air', ep.status)
     ep.status = 'na'
     self.assertEqual('na', ep.status)
     ep.status = 'today'
     self.assertEqual('today', ep.status)
Example #2
0
 def test_status(self):
     ep_id = "519"
     ep = BangumiEpisode.from_html(ep_id, self._ep_html)
     with self.assertRaises(ValueError):
         ep.status = 'invalid'
     self.assertEqual('air', ep.status)
     ep.status = 'na'
     self.assertEqual('na', ep.status)
     ep.status = 'today'
     self.assertEqual('today', ep.status)
Example #3
0
 def test_from_html_with_ep(self):
     ep_id = "519"
     ep = BangumiEpisode.from_html(ep_id, self._ep_html)
     ep_coll = BangumiEpisodeCollection.from_html_with_ep(ep,
                                                          self._ep_html)
     self.assertEqual(self._c_statuses[0], ep_coll.c_status)
Example #4
0
 def test_subject(self):
     ep_id = "519"
     ep = BangumiEpisode.from_html(ep_id, self._ep_html)
     self.assertIsNone(ep.subject)
     with self.assertRaises(TypeError):
         ep.subject = ep
Example #5
0
 def test_fixed_attribute_exception(self):
     ep_id = "519"
     ep = BangumiEpisode.from_html(ep_id, self._ep_html)
     for key in ['id_', 'ep_num', 'ep_type', 'title', 'ch_title']:
         with self.assertRaises(AttributeError):
             setattr(ep, key, 's')
Example #6
0
 def test_from_html(self):
     ep_id = "519"
     ep = BangumiEpisode.from_html(ep_id, self._ep_html)
     self.assertEqual(self._ep_ids[0], ep.id_)
     self.assertEqual(self._ep_nums[0], ep.ep_num)
     self.assertEqual(self._ep_types[0], ep.ep_type)
Example #7
0
 def test_subject(self):
     ep_id = "519"
     ep = BangumiEpisode.from_html(ep_id, self._ep_html)
     self.assertIsNone(ep.subject)
     with self.assertRaises(TypeError):
         ep.subject = ep
Example #8
0
 def test_fixed_attribute_exception(self):
     ep_id = "519"
     ep = BangumiEpisode.from_html(ep_id, self._ep_html)
     for key in ['id_', 'ep_num', 'ep_type', 'title', 'ch_title']:
         with self.assertRaises(AttributeError):
             setattr(ep, key, 's')
Example #9
0
 def test_from_html(self):
     ep_id = "519"
     ep = BangumiEpisode.from_html(ep_id, self._ep_html)
     self.assertEqual(self._ep_ids[0], ep.id_)
     self.assertEqual(self._ep_nums[0], ep.ep_num)
     self.assertEqual(self._ep_types[0], ep.ep_type)