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} })
def test_ignore_non_const(self): # skip non-constant expressions conf = test_horizon._parse_config("a=func();c=3") self.assertEqual(conf, {'c': 3})
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})
def test_assign_slice(self): conf = test_horizon._parse_config("a['b']=1") self.assertEqual(conf, {'a[b]': 1})
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}})
def test_ignore_imports(self): conf = test_horizon._parse_config("import blah") self.assertEqual(conf, {})
def test_empty(self): conf = test_horizon._parse_config("") self.assertEqual(conf, {})