In a source code in python: usr/local/lib/python3.3/unittest/__init__.py
from .result import TestResult
from .case import (TestCase, FunctionTestCase, SkipTest, skip, skipIf,
skipUnless, expectedFailure)
from .suite import BaseTestSuite, TestSuite
from .loader import (TestLoader, defaultTestLoader, makeSuite, getTestCaseNames,
findTestCases)
from .main import TestProgram, main
from .runner import TextTestRunner, TextTestResult
from .signals import installHandler, registerResult, removeResult, removeHandler
I can't understand .result and .main. Why do they have a dot prefix in the name?
It's called a relative import.
It means you import from the module in the same directory that the module this code is in. Without the dot, it would import the from first module found in the PYTHON PATH.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With