summaryrefslogtreecommitdiff
path: root/test/test_codeunit.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2010-03-14 22:35:41 -0400
committerNed Batchelder <ned@nedbatchelder.com>2010-03-14 22:35:41 -0400
commitc7ae0afc9f67410fd86e1e69f5baa2f50d5346bc (patch)
tree30f4804f6110cb46013a37a714f0f2bfc77e36c2 /test/test_codeunit.py
parente1e4f3a2e99dfb90c5df3c8d0ef4acba19b048b0 (diff)
downloadpython-coveragepy-git-c7ae0afc9f67410fd86e1e69f5baa2f50d5346bc.tar.gz
Source files can have more than one dot in them. Fixes issue #46.
Diffstat (limited to 'test/test_codeunit.py')
-rw-r--r--test/test_codeunit.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/test_codeunit.py b/test/test_codeunit.py
index 35387ba3..7903d153 100644
--- a/test/test_codeunit.py
+++ b/test/test_codeunit.py
@@ -36,6 +36,20 @@ class CodeUnitTest(CoverageTest):
self.assertEqual(bcu[0].source_file().read(), "# bfile.py\n")
self.assertEqual(ccu[0].source_file().read(), "# cfile.py\n")
+ def test_odd_filenames(self):
+ acu = code_unit_factory("aa/afile.odd.py", FileLocator())
+ bcu = code_unit_factory("aa/bb/bfile.odd.py", FileLocator())
+ b2cu = code_unit_factory("aa/bb.odd/bfile.py", FileLocator())
+ self.assertEqual(acu[0].name, "aa/afile.odd")
+ self.assertEqual(bcu[0].name, "aa/bb/bfile.odd")
+ self.assertEqual(b2cu[0].name, "aa/bb.odd/bfile")
+ self.assertEqual(acu[0].flat_rootname(), "aa_afile_odd")
+ self.assertEqual(bcu[0].flat_rootname(), "aa_bb_bfile_odd")
+ self.assertEqual(b2cu[0].flat_rootname(), "aa_bb_odd_bfile")
+ self.assertEqual(acu[0].source_file().read(), "# afile.odd.py\n")
+ self.assertEqual(bcu[0].source_file().read(), "# bfile.odd.py\n")
+ self.assertEqual(b2cu[0].source_file().read(), "# bfile.py\n")
+
def test_modules(self):
import aa, aa.bb, aa.bb.cc
cu = code_unit_factory([aa, aa.bb, aa.bb.cc], FileLocator())