diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2018-09-30 14:22:40 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2018-09-30 14:22:40 -0400 |
commit | dde63a57f2b9953c1c966968133743f1b4cdea9c (patch) | |
tree | c0ca3f7b6f8e738ea071f48ea9205d07b91e961c | |
parent | 0525cd6e3d4a3cd2b3231d14d662e7650ed627c6 (diff) | |
download | python-coveragepy-git-dde63a57f2b9953c1c966968133743f1b4cdea9c.tar.gz |
More tests of qualname_from_frame
-rw-r--r-- | tests/test_context.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_context.py b/tests/test_context.py index 4d89017b..b237af06 100644 --- a/tests/test_context.py +++ b/tests/test_context.py @@ -214,9 +214,17 @@ class SomethingElse(object): # pylint: disable=missing-docstr class MultiChild(SomethingElse, Child): # pylint: disable=missing-docstring pass +def no_arguments(): # pylint: disable=missing-docstring + return get_qualname() + +def plain_old_function(a, b): # pylint: disable=missing-docstring, unused-argument + return get_qualname() + def fake_out(self): # pylint: disable=missing-docstring, unused-argument return get_qualname() +def meth(self): + return get_qualname() class QualnameTest(CoverageTest): """Tests of qualname_from_frame.""" @@ -232,9 +240,20 @@ class QualnameTest(CoverageTest): def test_mi_inherited_method(self): self.assertEqual(MultiChild().meth(), "Parent.meth") + def test_no_arguments(self): + self.assertEqual(no_arguments(), "no_arguments") + + def test_plain_old_function(self): + self.assertEqual(plain_old_function(0, 1), "plain_old_function") + def test_fake_out(self): self.assertEqual(fake_out(0), "fake_out") def test_property(self): # I'd like this to be "Parent.a_property", but this might be ok too. self.assertEqual(Parent().a_property, "a_property") + + def test_changeling(self): + c = Child() + c.meth = meth + self.assertEqual(c.meth(c), "meth") |