From 4c1a99b6ae9308c052c6d5c3c504f237377257e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Wed, 26 Oct 2005 15:56:50 +0000 Subject: [PATCH] * add the metaclass test from new style classes paper --- tests/ootests.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 tests/ootests.py diff --git a/tests/ootests.py b/tests/ootests.py new file mode 100644 index 00000000..8bbbde3a --- /dev/null +++ b/tests/ootests.py @@ -0,0 +1,39 @@ +# Copyright (C) 2005, TUBITAK/UEKAE +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) +# any later version. +# +# Please read the COPYING file. +# + +import unittest +import os + +from pisi import version +from pisi.oo import * + +class OOTestCase(unittest.TestCase): + def setUp(self): + pass + + def testautosuper(self): + class A: + __metaclass__ = autosuper + def meth(self): + return "A" + class B(A): + def meth(self): + return "B" + self.__super.meth() + class C(A): + def meth(self): + return "C" + self.__super.meth() + class D(C, B): + def meth(self): + return "D" + self.__super.meth() + + self.assert_( D().meth() == "DCBA" ) + +suite = unittest.makeSuite(OOTestCase) +