예제 #1
0
    def test_add_helper(self):
        with patch.multiple(BaseColumnPrimitiveTypeProfiler,
                            __abstractmethods__=set()):
            profile1 = BaseColumnPrimitiveTypeProfiler(name=0)

        with patch.multiple(BaseColumnPrimitiveTypeProfiler,
                            __abstractmethods__=set()):
            profile2 = BaseColumnPrimitiveTypeProfiler(name=0)

        with patch.multiple(BaseColumnPrimitiveTypeProfiler,
                            __abstractmethods__=set()):
            merged_profile = BaseColumnPrimitiveTypeProfiler(name=0)

        profile1.match_count = 2
        profile2.match_count = 3

        profile1.sample_size = 2
        profile2.sample_size = 3

        # Check if match_count was merged
        merged_profile._add_helper(profile1, profile2)
        self.assertEqual(merged_profile.match_count, 5)

        # Check if sample size merged
        self.assertEqual(merged_profile.sample_size, 5)

        # Check for np.nan column index values for the merged profile
        self.assertTrue(np.isnan(merged_profile.col_index))

        # Check for name alignment
        self.assertEqual(merged_profile.name, profile2.name)
예제 #2
0
 def test_cannot_instantiate(self):
     """showing we normally can't instantiate an abstract class"""
     with self.assertRaises(TypeError) as e:
         BaseColumnPrimitiveTypeProfiler()
     self.assertEqual(
         "Can't instantiate abstract class BaseColumnPrimitiveTypeProfiler "
         "with abstract methods _update_helper, profile, update",
         str(e.exception))
예제 #3
0
 def setUpClass(cls):
     with patch.multiple(BaseColumnPrimitiveTypeProfiler,
                         __abstractmethods__=set()):
         cls.b_profile = BaseColumnPrimitiveTypeProfiler(name=0)