I've only started my project and already got a problem. File parser.py contains following code and nothing more:
class A:
def __init__(self):
self.x = 0
for file parser_tests.py I tried following combinations: 1)
import unittest
class ParserTests(unittest.TestCase):
def one(self):
from parser import A
x = A()
self.assertTrue(True)
2)
import unittest
from parser import A
class ParserTests(unittest.TestCase):
def one(self):
x = A()
self.assertTrue(True)
3)
import unittest
import parser
class ParserTests(unittest.TestCase):
def one(self):
x = parser.A()
self.assertTrue(True)
But all of them lead to AttributeError: 'module' object has no attribute 'A' or ImportError: cannot import name 'A'
How to fix this?