Ejemplo n.º 1
0
 def setUp(self):
     self.m = Meter([
         NonDictionaryFactor(),
         NonASCIIFactor(),
         LengthFactor(),
         VarietyFactor(),
         CasemixFactor(),
         CharmixFactor()
     ])
     self.threshold = self.m.threshold
     super(MeterTest, self).setUp()
Ejemplo n.º 2
0
class MeterTest(TestCase):

    def setUp(self):
        self.m = Meter([NonDictionaryFactor(), NonASCIIFactor(), LengthFactor(), VarietyFactor(), CasemixFactor(), CharmixFactor()])
        self.threshold = self.m.threshold
        super(MeterTest, self).setUp()

    @property
    def data(self):
        return [
            ("",                       False, []),
            (",",                      False, []),
            ("12345678",               False, []),
            ("asdf",                   False, []),
            ("pass",                   False, []),
            ("fewsIa",                 True, []),
            ("fewsIa1234",             True, []),
            ("fewsIa1234.*&",          True, []),
            ("你好",                   True, []),
            ("你好啊的算法第三方",     True, []),
            ("douban",                 False, []),
            ("mapix",                  False, []),
        ]

    def p(self, value):
        pprint(value)

    def test_meter(self):
        for pwd, condition, _ in self.data:
            score, feedbacks = self.m.test(pwd)
            assert (score > 0.5) is condition
Ejemplo n.º 3
0
class MeterTest(TestCase):
    def setUp(self):
        self.m = Meter([
            NonDictionaryFactor(),
            NonASCIIFactor(),
            LengthFactor(),
            VarietyFactor(),
            CasemixFactor(),
            CharmixFactor()
        ])
        self.threshold = self.m.threshold
        super(MeterTest, self).setUp()

    @property
    def data(self):
        return [
            ("", False, []),
            (",", False, []),
            ("12345678", False, []),
            ("asdf", False, []),
            ("pass", False, []),
            ("fewsIa", True, []),
            ("fewsIa1234", True, []),
            ("fewsIa1234.*&", True, []),
            ("你好", True, []),
            ("你好啊的算法第三方", True, []),
            ("douban", False, []),
            ("mapix", False, []),
        ]

    def p(self, value):
        pprint(value)

    def test_meter(self):
        for pwd, condition, _ in self.data:
            score, feedbacks = self.m.test(pwd)
            assert (score > 0.5) is condition
Ejemplo n.º 4
0
 def setUp(self):
     self.m = Meter([NonDictionaryFactor(), NonASCIIFactor(), LengthFactor(), VarietyFactor(), CasemixFactor(), CharmixFactor()])
     self.threshold = self.m.threshold
     super(MeterTest, self).setUp()