Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
webcache
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
webcache
Commits
3384abc1
Commit
3384abc1
authored
Feb 11, 2012
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed unit tests.
parent
c6c47384
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
9 deletions
+13
-9
importer.py
importer.py
+5
-1
tests/test_cache.py
tests/test_cache.py
+3
-3
tests/test_importer.py
tests/test_importer.py
+5
-5
No files found.
importer.py
View file @
3384abc1
...
...
@@ -120,7 +120,10 @@ class Importer(Cache):
return replaced
def concatenate(self, files):
def concatenate(self, files, relative_path=False):
#if relative_path:
# files = self.create_full_paths(files, relative_path)
map(assert_file_exists, files)
self.loaded = []
self.import_map = {}
...
...
@@ -153,6 +156,7 @@ class Importer(Cache):
+ 'file "%s".' % (f, path))
concat += self.concatenate(new_imports)
#concat += self.concatenate(new_imports, path)
concat += content
self.loaded += path
...
...
tests/test_cache.py
View file @
3384abc1
...
...
@@ -22,7 +22,7 @@ class TestCache(unittest.TestCase):
f
.
write
(
name
)
f
.
close
()
self
.
c
=
Cache
(
files
=
[
'foo'
,
'bar'
],
root
=
'baz'
)
self
.
c
=
Cache
(
files
=
[
'foo'
,
'bar'
],
root
=
'baz
/
'
)
def
tearDown
(
self
):
rmtree
(
'baz'
)
...
...
@@ -49,12 +49,12 @@ class TestCache(unittest.TestCase):
self
.
assertEqual
(
self
.
c
.
cached
,
d
+
'cached/'
)
def
test___init___custom_root
(
self
):
c
=
Cache
(
root
=
'foo'
)
c
=
Cache
(
root
=
'foo
/
'
)
self
.
assertTrue
(
hasattr
(
c
,
'root'
))
self
.
assertEqual
(
c
.
root
,
d
+
'foo/'
)
def
test___init___custom_cached_dir
(
self
):
c
=
Cache
(
cached
=
'foo'
)
c
=
Cache
(
cached
=
'foo
/
'
)
self
.
assertTrue
(
hasattr
(
c
,
'cached'
))
self
.
assertEqual
(
c
.
cached
,
d
+
'foo/'
)
...
...
tests/test_importer.py
View file @
3384abc1
...
...
@@ -25,7 +25,7 @@ class TestImporter(unittest.TestCase):
f
.
write
(
self
.
__getattribute__
(
name
))
f
.
close
()
self
.
importer
=
Importer
(
'foo
'
)
self
.
importer
=
Importer
(
root
=
'foo/
'
)
def
tearDown
(
self
):
shutil
.
rmtree
(
'foo'
)
...
...
@@ -35,7 +35,7 @@ class TestImporter(unittest.TestCase):
self
.
assertEqual
(
self
.
importer
.
extension
,
''
)
def
test___init___extension
(
self
):
self
.
assertEqual
(
Importer
(
'foo
'
,
extension
=
'txt'
).
extension
,
'.txt'
)
self
.
assertEqual
(
Importer
(
root
=
'foo/
'
,
extension
=
'txt'
).
extension
,
'.txt'
)
def
test_separate_imports
(
self
):
self
.
assertEqual
(
separate_imports
(
self
.
none
),
([],
self
.
none
))
...
...
@@ -52,12 +52,12 @@ class TestImporter(unittest.TestCase):
def
test_create_full_paths_alias
(
self
):
self
.
importer
.
set_alias
(
'bar'
,
'none'
)
self
.
assertEqual
(
self
.
importer
.
create_full_paths
([
'
@
bar'
]),
self
.
assertEqual
(
self
.
importer
.
create_full_paths
([
'
.
bar'
]),
[
d
+
'foo/none'
])
self
.
assertRaises
(
ValueError
,
self
.
importer
.
create_full_paths
,
[
'
@
foo'
])
[
'
.
foo'
])
def
test_create_full_paths_relative_file
(
self
):
importer
=
Importer
(
'
.
'
)
importer
=
Importer
(
''
)
self
.
assertEqual
(
importer
.
create_full_paths
([
'none'
],
d
+
'foo/single'
),
[
d
+
'foo/none'
])
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment