def test__get_extension(self): """Test get extension""" # Setup sampler = Mock(spec=Sampler) # Run parent_row = pd.Series([[0, 1], [1, 0]], index=['__foo__field', '__foo__field2']) table_name = 'foo' result = Sampler._get_extension(sampler, parent_row, table_name) # Asserts expected = {'field': [0, 1], 'field2': [1, 0]} assert result == expected
def test__get_extension(self): """Retrieve the generated parent row extension""" # Setup # Run sampler_mock = Mock() parent_row = pd.Series([[1, 1], [1, 1]], ['__demo__foo', '__demo__bar']) table_name = 'demo' parent_name = 'parent' result = Sampler._get_extension(sampler_mock, parent_row, table_name, parent_name) # Asserts expect = {'foo': [1, 1], 'bar': [1, 1]} assert result == expect