Example #1
0
    def test_access_attributes(self):
        song = MPDSong({'foo': 'zz', 'id': '5'})

        self.assertEqual(5, song.id)
        self.assertEqual("zz", song.foo)
        self.assertIsInstance(song.foo, str)
        self.assertEqual(song.foo, song.get("foo"))
Example #2
0
    def test_access_attributes(self):
        song = MPDSong({'foo': 'zz', 'id': '5'})

        self.assertEqual(5, song.id)
        self.assertEqual("zz", song.foo)
        self.assertIsInstance(song.foo, str)
        self.assertEqual(song.foo, song.get("foo"))
Example #3
0
    def test_access_attributes(self):
        song = MPDSong({"foo": "zz", "id": "5"})

        self.assertEqual(5, song.id)
        self.assertEqual("zz", song.foo)
        self.assertIsInstance(song.foo, str)
        self.assertEqual(song.foo, song.get("foo"))
Example #4
0
 def test_get_unknown_attribute(self):
     song = MPDSong({})
     self.assertRaises(KeyError, lambda: song['bla'])
     self.assertEqual(None, song.get('bla'))
     self.assertEqual('foo', song.get('bla', 'foo'))
     self.assertEqual(None, song.bla)
Example #5
0
 def test_get_unknown_attribute(self):
     song = MPDSong({})
     self.assertRaises(KeyError, lambda: song['bla'])
     self.assertEqual(None, song.get('bla'))
     self.assertEqual('foo', song.get('bla', 'foo'))
     self.assertEqual(None, song.bla)
Example #6
0
 def test_get_unknown_attribute(self):
     song = MPDSong({})
     self.assertRaises(KeyError, lambda: song["bla"])
     self.assertEqual(None, song.get("bla"))
     self.assertEqual("foo", song.get("bla", "foo"))
     self.assertEqual(None, song.bla)