Пример #1
0
 def test_set_date(self):
     info = AlbumInfo()
     info.date = '2021-01-01'
     self.assertEqual(info.date, date(2021, 1, 1))
     info.date = date(2021, 1, 2)
     self.assertEqual(info.date, date(2021, 1, 2))
Пример #2
0
 def test_serialized_date(self):
     info = AlbumInfo()
     info.date = date(2021, 1, 2)
     info_dict = info.to_dict()
     self.assertEqual(info_dict['date'], '2021-01-02')
Пример #3
0
 def test_set_date_in_init(self):
     info = AlbumInfo(date='2021-01-01')
     self.assertEqual(info.date, date(2021, 1, 1))
Пример #4
0
 def test_deserialized_type(self):
     info_dict = AlbumInfo().to_dict()
     info_dict['type'] = 'Album'
     info = AlbumInfo.from_dict(info_dict)
     self.assertEqual(info.type, DiscoEntryType.Album)
Пример #5
0
 def test_serialized_type(self):
     info = AlbumInfo()
     info_dict = info.to_dict()
     self.assertNotIn('_type', info_dict)
     self.assertIs(info_dict['type'], None)
Пример #6
0
 def test_default_type(self):
     info = AlbumInfo()
     self.assertEqual(info.type, DiscoEntryType.UNKNOWN)
Пример #7
0
 def test_entry_type_from_str(self):
     info = AlbumInfo(type='Album')
     self.assertEqual(info.type, DiscoEntryType.Album)