From 0a562ff6036ea97dfe6b0ec5d602f19587574066 Mon Sep 17 00:00:00 2001 From: Salvo 'LtWorf' Tomaselli Date: Mon, 23 Feb 2015 14:17:50 +0100 Subject: [PATCH] Check for duplicated attributes Fails to work if attributes are duplicated, raising an appropriate exception. --- relational/relation.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/relational/relation.py b/relational/relation.py index 09c166e..858d59f 100644 --- a/relational/relation.py +++ b/relational/relation.py @@ -527,6 +527,9 @@ class header (object): if not is_valid_relation_name(i): raise Exception('"%s" is not a valid attribute name' % i) + if len(attributes) != len(set(attributes)): + raise Exception('Attribute names must be unique') + def __repr__(self): return "header(%s)" % (self.attributes.__repr__())