Beispiel #1
0
 def test_can_contain_dict(self):
     x = 'hello'
     y = 'world'
     self.assertEqual(compact(x, y, {'z': 'foo'}), {
         'x': 'hello',
         'y': 'world',
         'z': 'foo'
     })
Beispiel #2
0
 def test_compact_returns_dict_of_local_variable(self):
     x = 'hello'
     self.assertEqual(compact(x), {'x': 'hello'})
Beispiel #3
0
 def test_works_with_classes(self):
     request = Request(None)
     self.assertIn('request', compact(request))
Beispiel #4
0
 def test_compact_throws_exceptions(self):
     r = Request(None)
     request = r
     with self.assertRaises(AmbiguousError):
         compact(request)
Beispiel #5
0
 def test_exception_on_too_many(self):
     x = 'hello'
     y = 'world'
     with self.assertRaises(ValueError):
         compact(x, y, 'z')
Beispiel #6
0
 def test_works_with_several_variables(self):
     x = 'hello'
     y = 'world'
     self.assertEqual(compact(x, y), {'x': 'hello', 'y': 'world'})