def test_kv_to_map(self): self.assertEqual({}, opts.kv_to_map([])) # explicit treatment as string self.assertEqual({"k": "3"}, opts.kv_to_map(["k:'3'"])) self.assertEqual({"k": 3}, opts.kv_to_map(["k:3"])) # implicit treatment as string self.assertEqual({"k": "v"}, opts.kv_to_map(["k:v"])) self.assertEqual({"k": "v", "size": 4, "empty": False, "temperature": 0.5}, opts.kv_to_map(["k:'v'", "size:4", "empty:false", "temperature:0.5"]))
def test_kv_to_map(self): self.assertEqual({}, opts.kv_to_map([])) self.assertEqual({"k": "v"}, opts.kv_to_map(["k:'v'"])) self.assertEqual( { "k": "v", "size": 4, "empty": False, "temperature": 0.5 }, opts.kv_to_map( ["k:'v'", "size:4", "empty:false", "temperature:0.5"]))
def test_kv_to_map(self): assert opts.kv_to_map([]) == {} # explicit treatment as string assert opts.kv_to_map(["k:'3'"]) == {"k": "3"} assert opts.kv_to_map(["k:3"]) == {"k": 3} # implicit treatment as string assert opts.kv_to_map(["k:v"]) == {"k": "v"} assert opts.kv_to_map(["k:'v'", "size:4", "empty:false", "temperature:0.5"]) == { "k": "v", "size": 4, "empty": False, "temperature": 0.5, }