Skip to content

Commit

Permalink
Merge pull request #393 from malthe/absolute-import-testing
Browse files Browse the repository at this point in the history
Make imports absolute
  • Loading branch information
malthe authored Dec 4, 2023
2 parents 3f7c904 + 19174b5 commit 9e809d4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions src/chameleon/tests/test_parser.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from unittest import TestCase

from ..namespaces import PY_NS
from ..namespaces import XML_NS
from ..namespaces import XMLNS_NS
from chameleon.namespaces import PY_NS
from chameleon.namespaces import XML_NS
from chameleon.namespaces import XMLNS_NS


class ParserTest(TestCase):
def test_comment_double_hyphen_parsing(self):
from ..parser import match_double_hyphen
from chameleon.parser import match_double_hyphen

self.assertFalse(match_double_hyphen.match('->'))
self.assertFalse(match_double_hyphen.match('-->'))
Expand All @@ -28,14 +28,14 @@ def test_sample_files(self):
with open(os.path.join(path, filename), 'rb') as f:
source = f.read()

from ..utils import read_encoded
from chameleon.utils import read_encoded
try:
want = read_encoded(source)
except UnicodeDecodeError as exc:
self.fail("{} - {}".format(exc, filename))

from ..parser import ElementParser
from ..tokenize import iter_xml
from chameleon.parser import ElementParser
from chameleon.tokenize import iter_xml
try:
tokens = iter_xml(want)
parser = ElementParser(tokens, {
Expand Down
8 changes: 4 additions & 4 deletions src/chameleon/tests/test_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ def find_files(self, ext):
class ZopePageTemplatesTest(RenderTestCase):
@property
def from_string(body):
from ..zpt.template import PageTemplate
from chameleon.zpt.template import PageTemplate
return partial(PageTemplate, keep_source=True)

@property
def from_file(body):
from ..zpt.template import PageTemplateFile
from chameleon.zpt.template import PageTemplateFile
return partial(PageTemplateFile, keep_source=True)

def template(body):
Expand Down Expand Up @@ -687,7 +687,7 @@ def cleanup(path=temp_path):
shutil.rmtree(path)

def test_pt_files(self):
from ..zpt.template import PageTemplateFile
from chameleon.zpt.template import PageTemplateFile

class Literal:
def __init__(self, s):
Expand All @@ -712,7 +712,7 @@ def __str__(self):
)

def test_txt_files(self):
from ..zpt.template import PageTextTemplateFile
from chameleon.zpt.template import PageTextTemplateFile
self.execute(".txt", PageTextTemplateFile)

def execute(self, ext, factory, **kwargs):
Expand Down
4 changes: 2 additions & 2 deletions src/chameleon/tests/test_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ def test_sample_files(self):
source = f.read()
f.close()

from ..utils import read_encoded
from chameleon.utils import read_encoded
try:
want = read_encoded(source)
except UnicodeDecodeError as exc:
self.fail("{} - {}".format(exc, filename))

from ..tokenize import iter_xml
from chameleon.tokenize import iter_xml
try:
tokens = iter_xml(want)
got = "".join(tokens)
Expand Down

0 comments on commit 9e809d4

Please sign in to comment.