def test_no_attr(self): obj = DummyObject() self.assertIsNone(get_first_attr(obj, ['foo', 'bar']))
def test_first(self): obj = DummyObject() obj.foo = 1 obj.bar = 2 self.assertEqual(get_first_attr(obj, ['foo', 'bar']), 1) self.assertEqual(get_first_attr(obj, ['bar', 'foo']), 2)