Ejemplo n.º 1
0
def test_base_class():
    """Test base class managed type"""
    ob = SubClassTest()
    assert ob.foo() == "foo"
    assert FunctionsTest.test_foo(ob) == "foo"
    assert ob.bar("bar", 2) == "bar"
    assert FunctionsTest.test_bar(ob, "bar", 2) == "bar"
    assert ob.not_overriden() == "not_overriden"
    assert list(ob.return_list()) == ["a", "b", "c"]
    assert list(SubClassTest.test_list(ob)) == ["a", "b", "c"]
Ejemplo n.º 2
0
 def testBaseClass(self):
     """Test base class managed type"""
     object = SubClassTest()
     self.assertEqual(object.foo(), "foo")
     self.assertEqual(TestFunctions.test_foo(object), "foo")
     self.assertEqual(object.bar("bar", 2), "bar")
     self.assertEqual(TestFunctions.test_bar(object, "bar", 2), "bar")
     self.assertEqual(object.not_overriden(), "not_overriden")
     self.assertEqual(list(object.return_list()), ["a", "b", "c"])
     self.assertEqual(list(SubClassTest.test_list(object)), ["a", "b", "c"])
Ejemplo n.º 3
0
def test_base_class():
    """Test base class managed type"""
    ob = SubClassTest()
    assert ob.foo() == "foo"
    assert FunctionsTest.test_foo(ob) == "foo"
    assert ob.bar("bar", 2) == "bar"
    assert FunctionsTest.test_bar(ob, "bar", 2) == "bar"
    assert ob.not_overriden() == "not_overriden"
    assert list(ob.return_list()) == ["a", "b", "c"]
    assert list(SubClassTest.test_list(ob)) == ["a", "b", "c"]
Ejemplo n.º 4
0
    def testDerivedClass(self):
        """Test python class derived from managed type"""
        object = DerivedClass()
        self.assertEqual(object.foo(), "DerivedClass")
        self.assertEqual(object.base_foo(), "foo")
        self.assertEqual(object.super_foo(), "foo")
        self.assertEqual(TestFunctions.test_foo(object), "DerivedClass")
        self.assertEqual(object.bar("bar", 2), "bar_bar")
        self.assertEqual(TestFunctions.test_bar(object, "bar", 2), "bar_bar")
        self.assertEqual(object.not_overriden(), "not_overriden")
        self.assertEqual(list(object.return_list()), ["A", "B", "C"])
        self.assertEqual(list(SubClassTest.test_list(object)), ["A", "B", "C"])

        x = TestFunctions.pass_through(object)
        self.assertEqual(id(x), id(object))
Ejemplo n.º 5
0
def test_derived_class():
    """Test python class derived from managed type"""
    DerivedClass = derived_class_fixture(test_derived_class.__name__)
    ob = DerivedClass()
    assert ob.foo() == "DerivedClass"
    assert ob.base_foo() == "foo"
    assert ob.super_foo() == "foo"
    assert FunctionsTest.test_foo(ob) == "DerivedClass"
    assert ob.bar("bar", 2) == "bar_bar"
    assert FunctionsTest.test_bar(ob, "bar", 2) == "bar_bar"
    assert ob.not_overriden() == "not_overriden"
    assert list(ob.return_list()) == ["A", "B", "C"]
    assert list(SubClassTest.test_list(ob)) == ["A", "B", "C"]

    x = FunctionsTest.pass_through(ob)
    assert id(x) == id(ob)
Ejemplo n.º 6
0
def test_derived_class():
    """Test python class derived from managed type"""
    DerivedClass = derived_class_fixture()
    ob = DerivedClass()
    assert ob.foo() == "DerivedClass"
    assert ob.base_foo() == "foo"
    assert ob.super_foo() == "foo"
    assert FunctionsTest.test_foo(ob) == "DerivedClass"
    assert ob.bar("bar", 2) == "bar_bar"
    assert FunctionsTest.test_bar(ob, "bar", 2) == "bar_bar"
    assert ob.not_overriden() == "not_overriden"
    assert list(ob.return_list()) == ["A", "B", "C"]
    assert list(SubClassTest.test_list(ob)) == ["A", "B", "C"]

    x = FunctionsTest.pass_through(ob)
    assert id(x) == id(ob)