Ejemplo n.º 1
0
    def test_migrate_v0_to_v1(self):
        v0_params = {"direction": 1, "colnames": "x", "varcol": "variable"}
        v1_params = {
            "direction": "longtowide",
            "colnames": "x",
            "varcol": "variable"
        }

        new_params = migrate_params(v0_params)
        self.assertEqual(new_params, v1_params)
Ejemplo n.º 2
0
    def test_migrate_v0_to_v1(self):
        v0_params = {'direction': 1, 'colnames': 'x', 'varcol': 'variable'}
        v1_params = {
            'direction': 'longtowide',
            'colnames': 'x',
            'varcol': 'variable'
        }

        new_params = migrate_params(v0_params)
        self.assertEqual(new_params, v1_params)
Ejemplo n.º 3
0
 def test_migrate_v2(self):
     self.assertEqual(
         migrate_params({
             "operation": "widetolong",
             "key_colnames": ["A"],
             "wtl_valcolname": "value",
             "wtl_varcolname": "variable",
             "ltw_varcolname": "var",
         }),
         {
             "operation": "widetolong",
             "key_colnames": ["A"],
             "wtl_valcolname": "value",
             "wtl_varcolname": "variable",
             "ltw_varcolname": "var",
         },
     )
Ejemplo n.º 4
0
 def test_migrate_v1_widetolong(self):
     self.assertEqual(
         migrate_params({
             "direction": "widetolong",
             "colnames": "A",
             "has_second_key": True,
             "second_key": "B",
             "varcol": "var",
         }),
         {
             "operation": "widetolong",
             "key_colnames": ["A"],  # in v1, wtl didn't support second_key
             "wtl_valcolname": "value",  # wasn't an option before
             "wtl_varcolname": "variable",  # wasn't an option before
             "ltw_varcolname": "var",  # unused
         },
     )
Ejemplo n.º 5
0
 def test_migrate_v1_longtowide(self):
     self.assertEqual(
         migrate_params({
             "direction": "longtowide",
             "colnames": "A",
             "has_second_key": True,
             "second_key": "B",
             "varcol": "var",
         }),
         {
             "operation": "longtowide",
             "key_colnames": ["A", "B"],
             "wtl_valcolname": "value",  # wasn't an option before
             "wtl_varcolname": "variable",  # wasn't an option before
             "ltw_varcolname": "var",
         },
     )
Ejemplo n.º 6
0
 def test_migrate_v0(self):
     # The menu goes from 'direction: 1' to 'operation: longtowide'
     self.assertEqual(
         migrate_params({
             "direction": 1,
             "colnames": "x",
             "varcol": "var",
             "has_second_key": True,
             "second_key": "y",
         }),
         {
             "operation": "longtowide",
             "key_colnames": ["x", "y"],
             "wtl_valcolname": "value",  # wasn't an option before
             "wtl_varcolname": "variable",  # wasn't an option before
             "ltw_varcolname": "var",
         },
     )