diff --git a/Semi_ATE/TnD/TnD.py b/Semi_ATE/TnD/TnD.py index 73463f3..2911159 100644 --- a/Semi_ATE/TnD/TnD.py +++ b/Semi_ATE/TnD/TnD.py @@ -81,15 +81,6 @@ def iso_to_gregorian(iso_year, iso_week, iso_day): return year_start + datetime.timedelta(days=iso_day - 1, weeks=iso_week - 1) -def url_datetime_string_to_epoch(url_datetime): - retval = url_datetime - print(retval) - retval = retval.split(",")[1].strip() - retval = retval.replace("GMT", "").strip() - retval = datetime.datetime.strptime(retval, "%d %b %Y %H:%M:%S") - return int((retval - datetime.datetime(1970, 1, 1)).total_seconds()) - - def micronas_time_structure_to_epoch(Datum=0, Uhrzeit=0): """ Micronas uses the following legacy structures: @@ -122,12 +113,6 @@ class DTError(RuntimeError): def __init__(self, arg): self.args = arg - def __str__(self): - return "".join(self.args) - - def __repr__(self): - return "".join(self.args) - class TD(object): """ diff --git a/tests/test_TD.py b/tests/test_TD.py index bf271b9..09bb206 100644 --- a/tests/test_TD.py +++ b/tests/test_TD.py @@ -1,7 +1,19 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -Created on Thu Feb 18 22:42:32 2021 +import time + +from Semi_ATE.TnD.TnD import DT, TD + + +try: + _ = DT() + _ = _ - DT(_.epoch + 1) +except: + assert False +else: + assert True + +one = 34858861 +two = 2 * one + +assert TD(one).__str__() == "1 year 1 month 1 week 1 day 1 hour 1 minute 1 second" +assert TD(two).__str__() == "2 years 2 months 2 weeks 2 days 2 hours 2 minutes 2 seconds" -@author: nerohmot -""" diff --git a/tests/test_is_date.py b/tests/test_is_date.py new file mode 100644 index 0000000..c9a0782 --- /dev/null +++ b/tests/test_is_date.py @@ -0,0 +1,5 @@ +from Semi_ATE.TnD.TnD import is_date + +assert is_date("32000000") is False +assert is_date("00130000") is False +assert is_date(0) is False \ No newline at end of file diff --git a/tests/test_is_datecode.py b/tests/test_is_datecode.py new file mode 100644 index 0000000..b747488 --- /dev/null +++ b/tests/test_is_datecode.py @@ -0,0 +1,8 @@ +from Semi_ATE.TnD.TnD import is_datecode + +assert is_datecode("00540") is False +assert is_datecode("00XX0") is False +assert is_datecode("00010") is False +assert is_datecode("00018") is False +assert is_datecode("0001X") is False +assert is_datecode(0) is False diff --git a/tests/test_micronas_time_structure_to_epoch.py b/tests/test_micronas_time_structure_to_epoch.py new file mode 100644 index 0000000..33f9e5b --- /dev/null +++ b/tests/test_micronas_time_structure_to_epoch.py @@ -0,0 +1,3 @@ +from Semi_ATE.TnD.TnD import micronas_time_structure_to_epoch + +assert True \ No newline at end of file