Skip to content

Commit

Permalink
Merge pull request #83 from mauricioabreu/master
Browse files Browse the repository at this point in the history
Fixed wrong behaviour when assigning BooleanValue
  • Loading branch information
jezdez committed Jan 6, 2015
2 parents a8643a1 + 3f892f9 commit cb9f7c3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions configurations/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def value(self, value):
def __new__(cls, *args, **kwargs):
"""
checks if the creation can end up directly in the final value.
That is the case whenever environ = False or environ_name is given
That is the case whenever environ = False or environ_name is given.
"""
instance = object.__new__(cls)
instance.__init__(*args, **kwargs)
Expand All @@ -59,7 +59,7 @@ def __init__(self, default=None, environ=True, environ_name=None,
environ_prefix='DJANGO', *args, **kwargs):
if 'late_binding' in kwargs:
self.late_binding = kwargs.get('late_binding')
if isinstance(default, Value) and default.default:
if isinstance(default, Value) and default.default is not None:
self.default = copy.copy(default.default)
else:
self.default = default
Expand Down
6 changes: 6 additions & 0 deletions tests/test_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ def test_boolean_values_nonboolean(self):
with env(DJANGO_TEST='nonboolean'):
self.assertRaises(ValueError, value.setup, 'TEST')

def test_boolean_values_assign_false_to_another_booleanvalue(self):
value1 = BooleanValue(False)
value2 = BooleanValue(value1)
self.assertFalse(value1.setup('TEST1'))
self.assertFalse(value2.setup('TEST2'))

def test_integer_values(self):
value = IntegerValue(1)
with env(DJANGO_TEST='2'):
Expand Down

0 comments on commit cb9f7c3

Please sign in to comment.