2021-01-23 04:05:22 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import pytest
|
|
|
|
|
2021-01-25 07:06:33 +00:00
|
|
|
import class_sh_module_local_0 as m0
|
|
|
|
import class_sh_module_local_1 as m1
|
|
|
|
import class_sh_module_local_2 as m2
|
2021-01-23 04:05:22 +00:00
|
|
|
|
|
|
|
|
2021-01-23 16:49:48 +00:00
|
|
|
def test_cross_module_get_mtxt():
|
|
|
|
obj1 = m1.atyp("A")
|
|
|
|
assert obj1.tag() == 1
|
|
|
|
obj2 = m2.atyp("B")
|
|
|
|
assert obj2.tag() == 2
|
|
|
|
assert m1.get_mtxt(obj1) == "A"
|
|
|
|
assert m2.get_mtxt(obj2) == "B"
|
|
|
|
assert m1.get_mtxt(obj2) == "B"
|
|
|
|
assert m2.get_mtxt(obj1) == "A"
|
|
|
|
assert m0.get_mtxt(obj1) == "A"
|
|
|
|
assert m0.get_mtxt(obj2) == "B"
|
2021-01-23 04:05:22 +00:00
|
|
|
|
|
|
|
|
2021-01-23 16:49:48 +00:00
|
|
|
def test_m0_rtrn_valu_atyp():
|
2021-01-23 04:05:22 +00:00
|
|
|
with pytest.raises(TypeError) as exc_info:
|
2021-01-23 16:49:48 +00:00
|
|
|
m0.rtrn_valu_atyp()
|
2021-01-23 04:05:22 +00:00
|
|
|
assert str(exc_info.value).startswith(
|
|
|
|
"Unable to convert function return value to a Python type!"
|
|
|
|
)
|