summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTill Maas <opensource@till.name>2014-02-06 13:29:49 +0100
committerTill Maas <opensource@till.name>2014-02-06 13:29:49 +0100
commitdb7aba42bf4c2d1dd1c3e34e5107c3cf3a9de42b (patch)
tree423c32de3d4db443fc40ec6224771dfdccb60572
parentea46d6c4238bac8e2f1218c084077551074d9f36 (diff)
downloadcnucnu-db7aba42bf4c2d1dd1c3e34e5107c3cf3a9de42b.zip
cnucnu-db7aba42bf4c2d1dd1c3e34e5107c3cf3a9de42b.tar.gz
cnucnu-db7aba42bf4c2d1dd1c3e34e5107c3cf3a9de42b.tar.xz
Make name_override logic obvious
-rw-r--r--cnucnu/__init__.py3
-rwxr-xr-xcnucnu/tests/aliases_test.py4
2 files changed, 7 insertions, 0 deletions
diff --git a/cnucnu/__init__.py b/cnucnu/__init__.py
index 0dfd8bf..0c817cb 100644
--- a/cnucnu/__init__.py
+++ b/cnucnu/__init__.py
@@ -114,6 +114,9 @@ def unalias(name, value, what):
if alias in ALIASES.keys():
value = alias
name = name_override
+ name_override = True
+ else:
+ name_override = False
else:
name_override = False
diff --git a/cnucnu/tests/aliases_test.py b/cnucnu/tests/aliases_test.py
index da5bfbd..f9bc899 100755
--- a/cnucnu/tests/aliases_test.py
+++ b/cnucnu/tests/aliases_test.py
@@ -30,6 +30,10 @@ class AliasTest(unittest.TestCase):
self.assertEqual(regex, ALIASES["DEFAULT"]["regex"].format(
name="testname"))
+ def testOverride(self):
+ regex = unalias("testname", "TEST:", "regex")
+ self.assertEqual(regex, "TEST:")
+
def testCPAN(self):
url = unalias("perl-test", "CPAN-DEFAULT", "url")
self.assertEqual(url, "http://search.cpan.org/dist/test/")