| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import ctypes | ||
| import sys | ||
| import unittest | ||
| import warnings | ||
| from ctypes import Union | ||
|
|
||
|
|
||
| UnionType = type(Union) | ||
| # _CData is not exported to Python, so we have to access it from __base__. | ||
| _CData = Union.__base__ | ||
|
|
||
|
|
||
| class ArrayTestCase(unittest.TestCase): | ||
| def test_inheritance_hierarchy(self): | ||
| self.assertEqual(_CData.__name__, "_CData") | ||
| self.assertEqual(Union.mro(), [Union, _CData, object]) | ||
|
|
||
| self.assertEqual(UnionType.__name__, "UnionType") | ||
| self.assertEqual(type(UnionType), type) | ||
|
|
||
| def test_instantiation(self): | ||
| with self.assertRaisesRegex(TypeError, "abstract class"): | ||
| Union() | ||
|
|
||
| UnionType("Foo", (Union,), {}) | ||
|
|
||
| def test_immutability(self): | ||
| Union.foo = "bar" | ||
|
Comment thread
erlend-aasland marked this conversation as resolved.
Outdated
|
||
|
|
||
| msg = "cannot set 'foo' attribute of immutable type" | ||
| with self.assertRaisesRegex(TypeError, msg): | ||
| UnionType.foo = "bar" | ||
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.