def test_parsednet28(self):
     net = "10.12.13."
     firstip = 224
     pline = list(parseline(net + str(firstip) + "/28"))
     pline.sort()
     for i, p in enumerate(pline):
         with self.subTest(line=str(p)):
             self.assertEqual(dectoIP(p), net + str(firstip + i))
    def test_parsenetupto24(self):

        net = "10.12.12."
        firstip = 0
        mask = 24

        pline = list(parseline(net + str(firstip) + "/" + str(mask)))
        pline.sort()
        for i, p in enumerate(pline):
            with self.subTest(line=str(p)):
                self.assertEqual(dectoIP(p), net + str(firstip + i))
    def test_parsedrange(self):
        net = "10.15.20."
        hostmin = 12
        hostmax = 241

        rangestr = "{0}{1}-{0}{2}".format(net, hostmin, hostmax)

        pline = list(parseline(rangestr))
        pline.sort()

        for i, ip in enumerate(range(hostmin, hostmax + 1)):
            with self.subTest(line=str(ip)):
                self.assertEqual(dectoIP(pline[i]), net + str(ip))
 def test_parsedhost(self):
     host = "192.168.1.1"
     pline = parseline(host)
     self.assertEqual(dectoIP(list(pline)[0]), host)
 def test_parsedcount(self):
     for net, result in self.testlist1:
         pline = parseline(net)
         with self.subTest(line=result):
             self.assertEqual(len(pline), result)