コード例 #1
0
 def test_var_in_var_str_sub(self):
     d = {}
     d["x"] = "some string"
     d["y"] = "x is '%(x)s'"
     d["z"] = "y is '%(y)s'"
     self.assertEqual(utils.parse_vars("%(z)s", d),
                      "y is 'x is 'some string''")
コード例 #2
0
 def test_mix_str_and_format_sub(self):
     d = {}
     d['device'] = 'disk0'
     d['rbytes'] = 100000
     d['wbytes'] = 200000
     self.assertEqual(utils.parse_vars("{device} rbytes={rbytes:fmt.bc}, wbytes=%(wbytes)s", d), "disk0 rbytes=97.7 K, wbytes=200000")
コード例 #3
0
 def test_single_var_str_format_sub(self):
     d = {}
     d['rbytes'] = 100000
     self.assertEqual(utils.parse_vars("rbytes={rbytes:fmt.bc}", d), "rbytes=97.7 K")
コード例 #4
0
 def test_single_var_str_sub(self):
     d = {}
     d["z"] = "some string"
     self.assertEqual(utils.parse_vars("%(z)s", d), 'some string')