def testWillCallTranslationDeactivateAfterCallingBlock(self, translation): with locale_context('pl_PL'): translation.deactivate.assert_not_called() translation.deactivate.assert_called_once()
def testWillCallWhateverIsInTheBlock(self, translation): fun = mock.Mock() with locale_context('anything'): fun() fun.assert_called_once()
def testWillCallTranslationActivateBeforeCallingBlock(self, translation): with locale_context('pl_PL'): translation.activate.assert_called_once_with('pl_PL') translation.activate.assert_called_once_with('pl_PL')