slight fix to MapUpdateClause context size. Fix MapUpdateClause assignment clause test.

This commit is contained in:
Michael Cyrulnik
2014-05-30 14:37:38 -04:00
parent b00f84e284
commit 2695377da9
2 changed files with 2 additions and 2 deletions

View File

@@ -334,7 +334,7 @@ class MapUpdateClause(ContainerUpdateClause):
def get_context_size(self):
if not self._analyzed: self._analyze()
if self.previous is None:
if self.previous is None and not self._updates:
return 1
return len(self._updates or []) * 2

View File

@@ -235,7 +235,7 @@ class ListUpdateClauseTests(TestCase):
class MapUpdateTests(TestCase):
def test_update(self):
c = MapUpdateClause('s', {3: 0, 5: 6}, {5: 0, 3: 4})
c = MapUpdateClause('s', {3: 0, 5: 6}, previous={5: 0, 3: 4})
c._analyze()
c.set_context_id(0)