예제 #1
0
 def test__entityclass__2(self):
     class X(object):
         @classmethod
         def __entityclass__(cls):
             return 'entityclass'
     self.assertEqual(functions_.entityclass(X), 'entityclass')
     self.assertEqual(functions_.entityclass(X()), 'entityclass')
예제 #2
0
 def test__functions_1(self):
     dt = datatype_.DataType(DogEntity, DogTable, DogRecord, DogTuple, DogArray)
     self.assertIs(functions_.entityclass(dt), DogEntity)
     self.assertIs(functions_.tableclass(dt), DogTable)
     self.assertIs(functions_.recordclass(dt), DogRecord)
     self.assertIs(functions_.tupleclass(dt), DogTuple)
     self.assertIs(functions_.arrayclass(dt), DogArray)
예제 #3
0
    def test__entityclass__1(self):
        dogs = Dogs()
        dog = DogRec(('Snoopy', 12), dogs)

        fld = record_.RecordFieldProxy(dog, 1)
        self.assertIs(fld.entityclass, Dog)
        self.assertIs(functions_.entityclass(fld), Dog)
예제 #4
0
 def test__entityclass__1(self):
     with self.assertRaisesRegex(AttributeError, r'\b__entityclass__\b'):
         functions_.entityclass('foo')
예제 #5
0
 def test__entityclass__2(self):
     class X(DogRec): pass
     X._entityclass = 'foo'
     self.assertIs(functions_.entityclass(X), X._entityclass)
예제 #6
0
 def test__entityclass__1(self):
     klass = functions_.entityclass(DogRec)
     self.assertIs(klass, DogRec._entityclass)
예제 #7
0
 def test__entityclass__1(self):
     self.assertIs(Dogs.entityclass, Dog)
     self.assertIs(Dogs.__entityclass__(), Dog)
     self.assertIs(Dogs().__entityclass__(), Dog)
     self.assertIs(functions_.entityclass(Dogs), Dog)
     self.assertIs(functions_.entityclass(Dogs()), Dog)
예제 #8
0
 def test__entityclass__1(self):
     col = table_.TableColumnDescriptor(Dogs(), 1)
     self.assertIs(col.entityclass, Dog)
     self.assertIs(functions_.entityclass(col), Dog)