예제 #1
0
 def test_currency_name_dict(self):
     ret = twder.currency_name_dict()
     currencies = twder.currencies()
     for c in currencies:
         self.assertIn(c, ret)
         self.assertIsInstance(ret[c], str)
예제 #2
0
     schedul.add_row(change1("IDR"))
     schedul.add_row(change1("EUR"))
     schedul.add_row(change1("KRW"))
     schedul.add_row(change1("VND"))
     schedul.add_row(change1("MYR"))
     schedul.add_row(change1("CNY"))
     print(schedul)
     print("更新時間:", twder.now("USD")[0])
     continue1 = int(input("繼續查詢其他幣別?1.使用其他功能 2.離開:"))
     if continue1 == 2:
         break
 elif choice == 2:
     continue2 = 1
     while continue2 == 1:
         print("您可以查詢以下幣別的匯率:")
         print(','.join(twder.currencies()))
         currency = input("請輸入您要查詢的幣別(請注意大小寫):")
         print("幣別:%s(%s)" % (currency, translate(currency)))
         print("現金買入匯率為:%2f" % (float(twder.now(currency)[1])))
         print("現金賣出匯率為:%2f" % (float(twder.now(currency)[2])))
         print("即期買入匯率為:%2f" % (float(twder.now(currency)[3])))
         print("即期賣出匯率為:%2f" % (float(twder.now(currency)[4])))
         continue2 = int(input("繼續查詢其他幣別?1.繼續 2.使用其他功能 3.離開:"))
         if continue2 == 2 or continue2 == 3:
             break
 elif choice == 3:
     continue3 = 1
     while continue3 == 1:
         choicec = input("請選擇(1.台幣換外幣2.外幣換台幣3.外幣換外幣):")
         if choicec == "1":
             currency = input("請輸入想換算的幣別:")
예제 #3
0
 def test_currencies(self):
     ret = twder.currencies()
     self.assertIsInstance(ret, list)
     self.all_element_is_str(ret)