Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_parse_dict_value(self):
self.assertEqual(
parse_dict_value("key1"),
Token([("key1", "")])
)
self.assertEqual(
parse_dict_value("key1=val1"),
Token([("key1", "val1")])
)
self.assertEqual(
parse_dict_value("key1=val1|key2=val2"),
Token([("key1", "val1"), ("key2", "val2")])
)
self.assertEqual(
parse_dict_value("key1=val1|key2|key3=val3"),
Token([("key1", "val1"), ("key2", ""), ("key3", "val3")])
)
self.assertEqual(
parse_dict_value("key1=val1|key1=val2"),
Token([("key1", "val1")])
)
self.assertEqual(
parse_dict_value("key1=val1|key2=val2"),
Token([("key1", "val1"), ("key2", "val2")])
)
self.assertEqual(
parse_dict_value("key1=val1|key2|key3=val3"),
Token([("key1", "val1"), ("key2", ""), ("key3", "val3")])
)
self.assertEqual(
parse_dict_value("key1=val1|key1=val2"),
Token([("key1", "val2")])
)
self.assertEqual(
parse_dict_value("key1=_|_|_=val1"),
Token([("key1", None)])
)
self.assertEqual(parse_dict_value(""), None)
self.assertEqual(parse_dict_value("_"), None)
Token([("key1", "")])
)
self.assertEqual(
parse_dict_value("key1=val1"),
Token([("key1", "val1")])
)
self.assertEqual(
parse_dict_value("key1=val1|key2=val2"),
Token([("key1", "val1"), ("key2", "val2")])
)
self.assertEqual(
parse_dict_value("key1=val1|key2|key3=val3"),
Token([("key1", "val1"), ("key2", ""), ("key3", "val3")])
)
self.assertEqual(
parse_dict_value("key1=val1|key1=val2"),
Token([("key1", "val2")])
)
self.assertEqual(
parse_dict_value("key1=_|_|_=val1"),
Token([("key1", None)])
)
self.assertEqual(parse_dict_value(""), None)
self.assertEqual(parse_dict_value("_"), None)
Token([("key1", "val1"), ("key2", "val2")])
)
self.assertEqual(
parse_dict_value("key1=val1|key2|key3=val3"),
Token([("key1", "val1"), ("key2", ""), ("key3", "val3")])
)
self.assertEqual(
parse_dict_value("key1=val1|key1=val2"),
Token([("key1", "val2")])
)
self.assertEqual(
parse_dict_value("key1=_|_|_=val1"),
Token([("key1", None)])
)
self.assertEqual(parse_dict_value(""), None)
self.assertEqual(parse_dict_value("_"), None)
def test_parse_dict_value(self):
self.assertEqual(
parse_dict_value("key1"),
Token([("key1", "")])
)
self.assertEqual(
parse_dict_value("key1=val1"),
Token([("key1", "val1")])
)
self.assertEqual(
parse_dict_value("key1=val1|key2=val2"),
Token([("key1", "val1"), ("key2", "val2")])
)
self.assertEqual(
parse_dict_value("key1=val1|key2|key3=val3"),
Token([("key1", "val1"), ("key2", ""), ("key3", "val3")])
)
self.assertEqual(
parse_dict_value("key1=val1|key1=val2"),
Token([("key1", "val2")])
)
self.assertEqual(
parse_dict_value("key1=_|_|_=val1"),
Token([("key1", None)])
)
self.assertEqual(parse_dict_value(""), None)
self.assertEqual(parse_dict_value("_"), None)
"pfeats": lambda line, i: parse_dict_value(line[i]),
"phead": lambda line, i: parse_int_value(line[i]),
def test_parse_dict_value(self):
self.assertEqual(
parse_dict_value("key1"),
Token([("key1", "")])
)
self.assertEqual(
parse_dict_value("key1=val1"),
Token([("key1", "val1")])
)
self.assertEqual(
parse_dict_value("key1=val1|key2=val2"),
Token([("key1", "val1"), ("key2", "val2")])
)
self.assertEqual(
parse_dict_value("key1=val1|key2|key3=val3"),
Token([("key1", "val1"), ("key2", ""), ("key3", "val3")])
)
self.assertEqual(
parse_dict_value("key1=val1|key1=val2"),
Token([("key1", "val2")])
)
self.assertEqual(
parse_dict_value("key1=_|_|_=val1"),
Token([("key1", None)])
)
self.assertEqual(parse_dict_value(""), None)
self.assertEqual(parse_dict_value("_"), None)
def test_parse_dict_value(self):
self.assertEqual(
parse_dict_value("key1"),
Token([("key1", "")])
)
self.assertEqual(
parse_dict_value("key1=val1"),
Token([("key1", "val1")])
)
self.assertEqual(
parse_dict_value("key1=val1|key2=val2"),
Token([("key1", "val1"), ("key2", "val2")])
)
self.assertEqual(
parse_dict_value("key1=val1|key2|key3=val3"),
Token([("key1", "val1"), ("key2", ""), ("key3", "val3")])
)
self.assertEqual(
parse_dict_value("key1=val1|key1=val2"),
Token([("key1", "val2")])
)
self.assertEqual(
parse_dict_value("key1=_|_|_=val1"),
parse_dict_value("key1=val1|key2=val2"),
Token([("key1", "val1"), ("key2", "val2")])
)
self.assertEqual(
parse_dict_value("key1=val1|key2|key3=val3"),
Token([("key1", "val1"), ("key2", ""), ("key3", "val3")])
)
self.assertEqual(
parse_dict_value("key1=val1|key1=val2"),
Token([("key1", "val2")])
)
self.assertEqual(
parse_dict_value("key1=_|_|_=val1"),
Token([("key1", None)])
)
self.assertEqual(parse_dict_value(""), None)
self.assertEqual(parse_dict_value("_"), None)