示例#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, {})