Given:
class A:
pass
class B(A):
pass
isinstance(B(), A)
will return True.
BUT
class MyModel(db.Model):
pass
isinstance(MyModel(), db.Model)
returns False
(surely True
?).
What am I missing?
Edit: Ok, simplest test that fails- created a blank GAE project. Inside main.py I've defined:
from google.appengine.ext import db
class MyModel(db.Model):
detail = db.StringProperty()
Then I've created a test file (test_ami.py) which contains the following:
import unittest
from main import MyModel
from google.appengine.ext import db
class TestAmI(unittest.TestCase):
def test_whatami(self):
m = MyModel()
self.assertEquals(True, isinstance(m, db.Model));
self.assertEquals(True, isinstance(MyModel(), db.Model));
On the command line: nosetests --with-gae results in:
File "test_ami.py", line 8, in test_whatami self.assertEquals(True, isinstance(m, db.Model)) AssertionError: True != False
Line 8 is: self.assertEquals(True, isinstance(m, db.Model));