From 54fea8f971b882ff34fffc69b409c417e448c14e Mon Sep 17 00:00:00 2001 From: Piotr Maslanka <piotr.maslanka@ericsson.com> Date: Mon, 4 Mar 2024 11:01:13 +0100 Subject: [PATCH] fixed #60 Change-Id: Ibe82b23afe8577c18550fdf579d9589c4d0f6044 --- CHANGELOG.md | 4 +++- tests/test_coding/test_overloading.py | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13caa2c2..179308ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,4 +3,6 @@ * minor pylint improvements * better coverage * SyncableDroppable.cleanup() bugs out, wrote a quick patch for it to do nothing and filed as #61. -* unit tests for overloading \ No newline at end of file +* unit tests for overloading +* fixed #60 + diff --git a/tests/test_coding/test_overloading.py b/tests/test_coding/test_overloading.py index be72a045..c189ff59 100644 --- a/tests/test_coding/test_overloading.py +++ b/tests/test_coding/test_overloading.py @@ -25,3 +25,21 @@ class TestOverloading(unittest.TestCase): fun(2) self.assertRaises(TypeError, lambda: fun(2.5)) fun('test') + + def test_something_2(self): + class A: + pass + + class B(A): + pass + + @overload + def fun(a: B): + self.assertEquals(type(a), B) + + @fun.overload + def fun(a: A): + self.assertEquals(type(a), A) + + fun(A()) + fun(B()) -- GitLab