-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Return item from registry adders. Add basic tests for registries.
- Loading branch information
Showing
3 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from ..registries import BuilderRegistry, CompressorRegistry | ||
|
||
|
||
def test_builder_registry(): | ||
|
||
builder_registry = BuilderRegistry() | ||
|
||
@builder_registry("ext") | ||
class ExtBuilder: | ||
pass | ||
|
||
@builder_registry(("ext1", "ext2")) | ||
class ExtsBuilder: | ||
pass | ||
|
||
assert builder_registry.members == {"ext": ExtBuilder, | ||
"ext1": ExtsBuilder, | ||
"ext2": ExtsBuilder} | ||
|
||
|
||
def test_compressor_registry(): | ||
|
||
compressor_registry = CompressorRegistry() | ||
|
||
@compressor_registry("dummy") | ||
def dummy_compressor(_filepath: str): | ||
pass | ||
|
||
assert compressor_registry.members == {"dummy": dummy_compressor} |