Permalink
Browse files

Don't allow unnamed categories.

Should the user supply an empty name to a constructor of Category, raise
ValueError.
  • Loading branch information...
1 parent 9fffc9b commit 20c545dfbae69e0a26119b35f5becafe15595080 @scolobb committed Jun 12, 2012
Showing with 3 additions and 0 deletions.
  1. +3 −0 sympy/categories/baseclasses.py
View
3 sympy/categories/baseclasses.py
@@ -547,6 +547,9 @@ class Category(Basic):
Diagram
"""
def __new__(cls, name, objects=EmptySet(), commutative=EmptySet()):
+ if not name:
+ raise ValueError("A Category cannot have an empty name.")
+
new_category = Basic.__new__(cls, Symbol(name), objects,
FiniteSet(commutative))
return new_category

0 comments on commit 20c545d

Please sign in to comment.