예제 #1
0
 def test_assign_basic(self):
     conf = test_horizon._parse_config(
         """a=0;b="str";c=(1,2);d=[1,2];e={1:2};f={1,2}""")
     self.assertEqual(conf, {
         'a': 0,
         'b': 'str',
         'c': (1, 2),
         'd': [1, 2],
         'e': {
             1: 2
         },
         'f': {1, 2}
     })
예제 #2
0
 def test_ignore_non_const(self):
     # skip non-constant expressions
     conf = test_horizon._parse_config("a=func();c=3")
     self.assertEqual(conf, {'c': 3})
예제 #3
0
 def test_ignore_destruct(self):
     # destructuring is hard and unlikely to be needed
     conf = test_horizon._parse_config("a,b=1,2;c=3")
     self.assertEqual(conf, {'c': 3})
예제 #4
0
 def test_assign_slice(self):
     conf = test_horizon._parse_config("a['b']=1")
     self.assertEqual(conf, {'a[b]': 1})
예제 #5
0
 def test_assign_basic(self):
     conf = test_horizon._parse_config(
         """a=0;b="str";c=(1,2);d=[1,2];e={1:2};f={1,2}""")
     self.assertEqual(conf, {'a': 0, 'b': 'str', 'c': (1, 2), 'd': [1, 2],
                             'e': {1: 2}, 'f': {1, 2}})
예제 #6
0
 def test_ignore_imports(self):
     conf = test_horizon._parse_config("import blah")
     self.assertEqual(conf, {})
예제 #7
0
 def test_empty(self):
     conf = test_horizon._parse_config("")
     self.assertEqual(conf, {})
예제 #8
0
 def test_ignore_non_const(self):
     # skip non-constant expressions
     conf = test_horizon._parse_config("a=func();c=3")
     self.assertEqual(conf, {'c': 3})
예제 #9
0
 def test_ignore_destruct(self):
     # destructuring is hard and unlikely to be needed
     conf = test_horizon._parse_config("a,b=1,2;c=3")
     self.assertEqual(conf, {'c': 3})
예제 #10
0
 def test_assign_slice(self):
     conf = test_horizon._parse_config("a['b']=1")
     self.assertEqual(conf, {'a[b]': 1})
예제 #11
0
 def test_ignore_imports(self):
     conf = test_horizon._parse_config("import blah")
     self.assertEqual(conf, {})
예제 #12
0
 def test_empty(self):
     conf = test_horizon._parse_config("")
     self.assertEqual(conf, {})