コード例 #1
0
ファイル: 界面设计.py プロジェクト: thomas-yanxin/12306-
def cxjm():
    root2 = Tk()
    root2.geometry('480x640')
    root2.title('12306查询')
    photo = PhotoImage(file='bg.gif')
    label2 = Label(root2, text='******')
    label2.pack()
    label3 = Label(root2, text='起始站:')  #输入起始站
    label3.place(relx=0.1, rely=0.1)
    inp1 = Entry(root2)
    inp1.place(relx=0.3, rely=0.1, relwidth=0.3)
    label4 = Label(root2, text='终点站:')  #输入终点站
    label4.place(relx=0.1, rely=0.2)
    inp2 = Entry(root2)
    inp2.place(relx=0.3, rely=0.2, relwidth=0.3)
    label5 = Label(root2, text='出发时间:')  #输入出发时间
    label5.place(relx=0.1, rely=0.3)
    inp3 = Entry(root2)
    inp3.place(relx=0.3, rely=0.3, relwidth=0.3)
    label6 = Label(root2, text='列车类型')  #输入列车类型
    label6.place(relx=0.1, rely=0.4)
    inp4 = Entry(root2)
    inp4.place(relx=0.3, rely=0.4, relwidth=0.3)
    label0 = Label(
        root2,
        text=
        '查询须知:\nd----动车\ng----高铁\nk----快速\nt----特快\nz----直达\n日期格式:\n20**-**-**'
    )  #查询须知
    label0.place(relx=0.8)

    btn_1 = Button(
        root2,
        text='查询',
        command=lambda: tickets.tickets(inp1, inp2, inp3, inp4))  #一键查询,f2为查询函数
    btn_1.place(relx=0.25, rely=0.5)
コード例 #2
0
    def test_tickets(self):
        with self.subTest():
            self.assertEqual(tickets([25, 25, 25, 25]), 'YES')

        with self.subTest():
            self.assertEqual(tickets([50, 25, 25, 100]), 'NO')

        with self.subTest():
            self.assertEqual(tickets([25, 50]), 'YES')

        with self.subTest():
            self.assertEqual(tickets([25, 25, 25, 100]), 'YES')

        with self.subTest():
            self.assertEqual(tickets([25, 25, 25, 50, 100]), 'YES')

        with self.subTest():
            self.assertEqual(tickets([25, 25, 25, 50, 50, 100]), 'YES')

        with self.subTest():
            self.assertEqual(tickets([25, 25, 25, 25, 50, 50, 50, 100]), 'YES')

        with self.subTest():
            self.assertEqual(tickets([25, 25, 25, 50, 50, 50, 100]), 'NO')

        with self.subTest():
            self.assertEqual(tickets([50]), 'NO')

        with self.subTest():
            self.assertEqual(tickets([25]), 'YES')

        with self.subTest():
            self.assertEqual(tickets([100]), 'NO')

        with self.subTest():
            self.assertEqual(tickets([25, 25, 25, 25, 50, 100]), 'YES')

        with self.subTest():
            self.assertEqual(tickets([25, 25, 25, 25, 50, 100, 100]), 'NO')
コード例 #3
0
    def test_tickets(self):
        bills = [25, 25, 50]
        self.assertEqual(tickets(bills), "YES")

        bills = [25, 100]
        self.assertEqual(tickets(bills), "NO")

        bills = [25, 25, 25, 25, 25, 25, 25, 25, 25, 25]
        self.assertEqual(tickets(bills), "YES")

        bills = [50, 50, 50, 50, 50, 50, 50, 50, 50, 50]
        self.assertEqual(tickets(bills), "NO")

        bills = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100]
        self.assertEqual(tickets(bills), "NO")

        bills = [25, 25, 25, 25, 50, 100, 50]
        self.assertEqual(tickets(bills), "YES")

        bills = [50, 100, 100]
        self.assertEqual(tickets(bills), "NO")

        bills = [25, 25, 100]
        self.assertEqual(tickets(bills), "NO")

        bills = [25, 25, 25, 25, 25, 25, 25, 50, 50, 50, 100, 100, 100, 100]
        self.assertEqual(tickets(bills), "NO")

        bills = [25, 25, 50, 50, 100]
        self.assertEqual(tickets(bills), "NO")

        bills = [25, 50, 50]
        self.assertEqual(tickets(bills), "NO")

        bills = [25, 25, 25, 100]
        self.assertEqual(tickets(bills), "YES")

        bills = [25, 50, 25, 100]
        self.assertEqual(tickets(bills), "YES")

        bills = [25, 25, 25, 25, 25, 100, 100]
        self.assertEqual(tickets(bills), "NO")

        bills = [
            25, 50, 25, 100, 25, 25, 50, 100, 25, 25, 25, 100, 25, 25, 50, 100,
            25, 50, 25, 100, 25, 50, 50, 50
        ]
        self.assertEqual(tickets(bills), "NO")

        bills = [
            25, 25, 25, 100, 25, 25, 25, 100, 25, 25, 50, 100, 25, 25, 50, 100,
            50, 50
        ]
        self.assertEqual(tickets(bills), "NO")

        bills = [25, 50, 25, 100, 25, 25, 50, 100, 25, 50, 25, 100, 50, 25]
        self.assertEqual(tickets(bills), "NO")
コード例 #4
0
ファイル: test.py プロジェクト: clementselvaprasath/codewars
 def test1(self):
     self.assertEqual(tickets([25, 25, 50]), "YES")
コード例 #5
0
ファイル: test.py プロジェクト: clementselvaprasath/codewars
 def test2(self):
     self.assertEqual(tickets([25, 100]), "NO")
コード例 #6
0
ファイル: test.py プロジェクト: clementselvaprasath/codewars
 def test3(self):
     self.assertEqual(tickets([25, 25, 50, 50, 100]), "NO")
コード例 #7
0
 def test(self):
     self.assertEqual(tickets([25, 25, 50]), "YES")
     self.assertEqual(tickets([25, 100]), "NO")
     self.assertEqual(tickets([25, 25, 25, 25, 25, 25, 25, 25, 25, 25]),
                      "YES")
     self.assertEqual(tickets([50, 50, 50, 50, 50, 50, 50, 50, 50, 50]),
                      "NO")
     self.assertEqual(
         tickets([100, 100, 100, 100, 100, 100, 100, 100, 100, 100]), "NO")
     self.assertEqual(tickets([25, 25, 25, 25, 50, 100, 50]), "YES")
     self.assertEqual(tickets([50, 100, 100]), "NO")
     self.assertEqual(tickets([25, 25, 100]), "NO")
     self.assertEqual(
         tickets(
             [25, 25, 25, 25, 25, 25, 25, 50, 50, 50, 100, 100, 100, 100]),
         "NO")
     self.assertEqual(tickets([25, 25, 50, 50, 100]), "NO")
     self.assertEqual(tickets([25, 50, 50]), "NO")
     self.assertEqual(tickets([25, 25, 25, 100]), "YES")
     self.assertEqual(tickets([25, 50, 25, 100]), "YES")
     self.assertEqual(tickets([25, 25, 25, 25, 25, 100, 100]), "NO")
     self.assertEqual(
         tickets([
             25, 50, 25, 100, 25, 25, 50, 100, 25, 25, 25, 100, 25, 25, 50,
             100, 25, 50, 25, 100, 25, 50, 50, 50
         ]), "NO")
     self.assertEqual(
         tickets([
             25, 25, 25, 100, 25, 25, 25, 100, 25, 25, 50, 100, 25, 25, 50,
             100, 50, 50
         ]), "NO")
     self.assertEqual(
         tickets(
             [25, 50, 25, 100, 25, 25, 50, 100, 25, 50, 25, 100, 50, 25]),
         "NO")
コード例 #8
0
 def test_2(self):
     result = tickets([25, 100])
     self.assertEqual(result, "NO")
コード例 #9
0
 def test_1(self):
     result = tickets([25, 25, 50])
     self.assertEqual(result, "YES")
コード例 #10
0
def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument('-m',
                        '--milestone_id',
                        dest='milestone_id',
                        help='The milestone id to be parsed',
                        default='4.11.3')
    return parser.parse_args()


if __name__ == '__main__':
    args = parse_args()

    # Fetch tickets data
    t = tickets.tickets(milestone_id=args.milestone_id)
    t.load()
    tickets_stats = t.tickets

    # Generate markdown format for data
    md = markdown.markdown()
    reports.gen_overall_progress(tickets_stats['overall_progress'], md)
    reports.gen_tickets_stats_by_category(tickets_stats['by_category'], md)
    reports.gen_individual_tickets_info(tickets_stats['tickets'], md)

    with io.open('tickets.md', 'w', encoding='utf-8') as file:
        try:
            file.write(md.content.encode('utf-8'))
        except TypeError:  # For Python 3
            file.write(md.content)