Esempio n. 1
0
 def test_parse_v0_valueerror_bad_type(self):
     with self.assertRaises(ValueError):
         migrate_params({
             "column":
             "A",
             "refine":
             json.dumps([{
                 "type": "selec",
                 "column": "A",
                 "content": {
                     "value": "x"
                 }
             }]),
         })
Esempio n. 2
0
 def test_parse_v0_valueerror_bad_change_no_content_key(self):
     with self.assertRaises(ValueError):
         migrate_params({
             "column":
             "A",
             "refine":
             json.dumps([{
                 "type": "change",
                 "column": "A",
                 "contentx": {
                     "fromVal": "x",
                     "toVal": "y"
                 },
             }]),
         })
Esempio n. 3
0
 def _test_parse_v2(self, column: str, arr: Dict[str, Any],
                    expected: RefineSpec) -> None:
     result = migrate_params({"column": column, "refine": arr})
     self.assertEqual(result["column"], column)
     refine = result["refine"]
     self.assertEqual(refine["renames"], expected.renames)
     self.assertTrue("blackist" not in refine)
     self.assertEqual(len(refine.keys()), 1)
Esempio n. 4
0
 def _test_parse_v0(self, column: str, arr: List[Dict[str, Any]],
                    expected: RefineSpec) -> None:
     """
     Test that deprecated input is transformed into what the user expects.
     """
     result = migrate_params({"column": column, "refine": json.dumps(arr)})
     self.assertEqual(result["column"], column)
     refine = result["refine"]
     self.assertEqual(refine["renames"], expected.renames)
Esempio n. 5
0
 def test_parse_v1(self):
     result = migrate_params({
         "column":
         "A",
         "refine":
         '{"renames": {"a": "b"}, "blacklist": []}'
     })
     self.assertEqual(result, {
         "column": "A",
         "refine": {
             "renames": {
                 "a": "b"
             }
         }
     })
Esempio n. 6
0
 def test_parse_v1_empty_refine(self):
     result = migrate_params({"column": "A", "refine": ""})
     self.assertEqual(result, {"column": "A", "refine": {"renames": {}}})
Esempio n. 7
0
 def test_parse_v0_valueerror_not_dict(self):
     with self.assertRaises(ValueError):
         migrate_params({"column": "A", "refine": json.dumps("A")})