generated from jCloud/repository-template
Do not permit empty python namespace names
This commit is contained in:
@@ -37,6 +37,7 @@ class PythonNamespace:
|
|||||||
|
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
||||||
|
|
||||||
class PythonPackageNamespace(PythonNamespace):
|
class PythonPackageNamespace(PythonNamespace):
|
||||||
'''
|
'''
|
||||||
A subclass of ``PythonNamespace`` for python package namespaces.
|
A subclass of ``PythonNamespace`` for python package namespaces.
|
||||||
|
|||||||
@@ -4,11 +4,9 @@ import pytest
|
|||||||
class StrSubclass(str): ...
|
class StrSubclass(str): ...
|
||||||
|
|
||||||
@pytest.mark.parametrize('namespace,expected_name', [
|
@pytest.mark.parametrize('namespace,expected_name', [
|
||||||
(PythonModuleNamespace(''), ''),
|
|
||||||
(PythonModuleNamespace(' '), ' '),
|
|
||||||
(PythonModuleNamespace('a'), 'a'),
|
(PythonModuleNamespace('a'), 'a'),
|
||||||
(PythonModuleNamespace('1'), '1'),
|
(PythonModuleNamespace('1'), '1'),
|
||||||
(PythonModuleNamespace(StrSubclass('')), StrSubclass('')),
|
(PythonModuleNamespace(StrSubclass('a')), StrSubclass('a')),
|
||||||
])
|
])
|
||||||
def test_PythonModuleNamespace_name_attribute(namespace, expected_name):
|
def test_PythonModuleNamespace_name_attribute(namespace, expected_name):
|
||||||
assert namespace.name == expected_name
|
assert namespace.name == expected_name
|
||||||
|
|||||||
@@ -4,11 +4,9 @@ import pytest
|
|||||||
class StrSubclass(str): ...
|
class StrSubclass(str): ...
|
||||||
|
|
||||||
@pytest.mark.parametrize('namespace,expected_name', [
|
@pytest.mark.parametrize('namespace,expected_name', [
|
||||||
(PythonNamespace(''), ''),
|
|
||||||
(PythonNamespace(' '), ' '),
|
|
||||||
(PythonNamespace('a'), 'a'),
|
(PythonNamespace('a'), 'a'),
|
||||||
(PythonNamespace('1'), '1'),
|
(PythonNamespace('1'), '1'),
|
||||||
(PythonNamespace(StrSubclass('')), StrSubclass('')),
|
(PythonNamespace(StrSubclass('a')), StrSubclass('a')),
|
||||||
])
|
])
|
||||||
def test_PythonNamespace_name_attribute(namespace, expected_name):
|
def test_PythonNamespace_name_attribute(namespace, expected_name):
|
||||||
assert namespace.name == expected_name
|
assert namespace.name == expected_name
|
||||||
Reference in New Issue
Block a user