diff options
author | Jason Lowe-Power <jason@lowepower.com> | 2017-11-17 17:02:05 -0800 |
---|---|---|
committer | Jason Lowe-Power <jason@lowepower.com> | 2017-12-14 00:27:59 +0000 |
commit | f07d5069d86e31ecf195664850f79fb00c445bd3 (patch) | |
tree | f54ac06896fa828f873d199a0e9b25bd94911c79 /ext/pybind11/tests/test_inheritance.py | |
parent | 3f64b374c49491f18dc2ca538ed8c8597e4aac83 (diff) | |
download | gem5-f07d5069d86e31ecf195664850f79fb00c445bd3.tar.xz |
ext: Upgrade PyBind11 to version 2.2.1
This upgrade is necessary for pybind to build with GCC 7.2.
We still need to add the patch for stl.h. MSC_FULL_VER change is no longer
needed.
See https://gem5-review.googlesource.com/c/public/gem5/+/2230
Change-Id: I806729217d022070583994c2dfcaa74476aef30f
Signed-off-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-on: https://gem5-review.googlesource.com/5801
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Diffstat (limited to 'ext/pybind11/tests/test_inheritance.py')
-rw-r--r-- | ext/pybind11/tests/test_inheritance.py | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/ext/pybind11/tests/test_inheritance.py b/ext/pybind11/tests/test_inheritance.py deleted file mode 100644 index d1f537d1d..000000000 --- a/ext/pybind11/tests/test_inheritance.py +++ /dev/null @@ -1,78 +0,0 @@ -import pytest - - -def test_inheritance(msg): - from pybind11_tests import Pet, Dog, Rabbit, Hamster, Chimera, dog_bark, pet_name_species - - roger = Rabbit('Rabbit') - assert roger.name() + " is a " + roger.species() == "Rabbit is a parrot" - assert pet_name_species(roger) == "Rabbit is a parrot" - - polly = Pet('Polly', 'parrot') - assert polly.name() + " is a " + polly.species() == "Polly is a parrot" - assert pet_name_species(polly) == "Polly is a parrot" - - molly = Dog('Molly') - assert molly.name() + " is a " + molly.species() == "Molly is a dog" - assert pet_name_species(molly) == "Molly is a dog" - - fred = Hamster('Fred') - assert fred.name() + " is a " + fred.species() == "Fred is a rodent" - - assert dog_bark(molly) == "Woof!" - - with pytest.raises(TypeError) as excinfo: - dog_bark(polly) - assert msg(excinfo.value) == """ - dog_bark(): incompatible function arguments. The following argument types are supported: - 1. (arg0: m.Dog) -> str - - Invoked with: <m.Pet object at 0> - """ - - with pytest.raises(TypeError) as excinfo: - Chimera("lion", "goat") - assert "No constructor defined!" in str(excinfo.value) - - -def test_automatic_upcasting(): - from pybind11_tests import return_class_1, return_class_2, return_class_n, return_none - - assert type(return_class_1()).__name__ == "DerivedClass1" - assert type(return_class_2()).__name__ == "DerivedClass2" - assert type(return_none()).__name__ == "NoneType" - # Repeat these a few times in a random order to ensure no invalid caching - # is applied - assert type(return_class_n(1)).__name__ == "DerivedClass1" - assert type(return_class_n(2)).__name__ == "DerivedClass2" - assert type(return_class_n(0)).__name__ == "BaseClass" - assert type(return_class_n(2)).__name__ == "DerivedClass2" - assert type(return_class_n(2)).__name__ == "DerivedClass2" - assert type(return_class_n(0)).__name__ == "BaseClass" - assert type(return_class_n(1)).__name__ == "DerivedClass1" - - -def test_isinstance(): - from pybind11_tests import test_isinstance, Pet, Dog - - objects = [tuple(), dict(), Pet("Polly", "parrot")] + [Dog("Molly")] * 4 - expected = (True, True, True, True, True, False, False) - assert test_isinstance(objects) == expected - - -def test_holder(): - from pybind11_tests import test_mismatched_holder_type_1, test_mismatched_holder_type_2 - - with pytest.raises(RuntimeError) as excinfo: - test_mismatched_holder_type_1() - - assert str(excinfo.value) == ("generic_type: type \"MismatchDerived1\" does not have " - "a non-default holder type while its base " - "\"MismatchBase1\" does") - - with pytest.raises(RuntimeError) as excinfo: - test_mismatched_holder_type_2() - - assert str(excinfo.value) == ("generic_type: type \"MismatchDerived2\" has a " - "non-default holder type while its base " - "\"MismatchBase2\" does not") |