Beispiel #1
0
 def testReuseArgScopeNested(self):
   func1_kwargs = {'a': 1, 'b': None, 'c': [1]}
   func2_kwargs = {'b': 2, 'd': [2]}
   key = lambda f: (f.__module__, f.__name__)
   current_scope1 = {key(func1): func1_kwargs.copy()}
   current_scope2 = {key(func1): func1_kwargs.copy(),
                     key(func2): func2_kwargs.copy()}
   with self.test_session():
     with scopes.arg_scope([func1], a=1, b=None, c=[1]) as scope1:
       with scopes.arg_scope([func2], b=2, d=[2]) as scope2:
         pass
     with scopes.arg_scope(scope1):
       self.assertDictEqual(scopes._current_arg_scope(), current_scope1)
     with scopes.arg_scope(scope2):
       self.assertDictEqual(scopes._current_arg_scope(), current_scope2)
Beispiel #2
0
 def testReuseArgScopeNested(self):
   func1_kwargs = {'a': 1, 'b': None, 'c': [1]}
   func2_kwargs = {'b': 2, 'd': [2]}
   key = lambda f: (f.__module__, f.__name__)
   current_scope1 = {key(func1): func1_kwargs.copy()}
   current_scope2 = {key(func1): func1_kwargs.copy(),
                     key(func2): func2_kwargs.copy()}
   with self.test_session():
     with scopes.arg_scope([func1], a=1, b=None, c=[1]) as scope1:
       with scopes.arg_scope([func2], b=2, d=[2]) as scope2:
         pass
     with scopes.arg_scope(scope1):
       self.assertDictEqual(scopes._current_arg_scope(), current_scope1)
     with scopes.arg_scope(scope2):
       self.assertDictEqual(scopes._current_arg_scope(), current_scope2)
Beispiel #3
0
 def testEmptyArgScope(self):
     with self.test_session():
         self.assertEqual(scopes._current_arg_scope(), {})
Beispiel #4
0
 def testEmptyArgScope(self):
   with self.test_session():
     self.assertEqual(scopes._current_arg_scope(), {})