mirror of
https://github.com/django-components/django-components.git
synced 2025-08-31 03:07:19 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
15a0e66219
commit
0648ad9a93
14 changed files with 983 additions and 432 deletions
|
@ -1,8 +1,9 @@
|
|||
import unittest
|
||||
|
||||
from .django_test_setup import * # NOQA
|
||||
from django_components import component
|
||||
|
||||
from .django_test_setup import * # NOQA
|
||||
|
||||
|
||||
class MockComponent(object):
|
||||
pass
|
||||
|
@ -17,14 +18,13 @@ class ComponentRegistryTest(unittest.TestCase):
|
|||
class TestComponent(component.Component):
|
||||
pass
|
||||
|
||||
self.assertEqual(component.registry.get("decorated_component"), TestComponent)
|
||||
self.assertEqual(
|
||||
component.registry.get("decorated_component"), TestComponent
|
||||
)
|
||||
|
||||
def test_simple_register(self):
|
||||
self.registry.register(name="testcomponent", component=MockComponent)
|
||||
self.assertEqual(
|
||||
self.registry.all(),
|
||||
{"testcomponent": MockComponent}
|
||||
)
|
||||
self.assertEqual(self.registry.all(), {"testcomponent": MockComponent})
|
||||
|
||||
def test_register_two_components(self):
|
||||
self.registry.register(name="testcomponent", component=MockComponent)
|
||||
|
@ -34,13 +34,15 @@ class ComponentRegistryTest(unittest.TestCase):
|
|||
{
|
||||
"testcomponent": MockComponent,
|
||||
"testcomponent2": MockComponent,
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
def test_prevent_registering_twice(self):
|
||||
self.registry.register(name="testcomponent", component=MockComponent)
|
||||
with self.assertRaises(component.AlreadyRegistered):
|
||||
self.registry.register(name="testcomponent", component=MockComponent)
|
||||
self.registry.register(
|
||||
name="testcomponent", component=MockComponent
|
||||
)
|
||||
|
||||
def test_simple_unregister(self):
|
||||
self.registry.register(name="testcomponent", component=MockComponent)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue