예제 #1
0
def test_temporaryfile():
    file = core.TemporaryFile()
    with file.open_file("read_only"):
        assert file.get_open_mode() == "read_only"
    date = core.DateTime(2000, 1, 1, 1, 1, 1)
    date.set_timezone("Europe/Berlin")
    # tzinfo=datetime.timezone.utc
    # print(str(date.get_timezone()))
    file.set_file_time(date, "birth")
    # assert file.get_file_time("birth") == date.get_value()
    with pytest.raises(InvalidParamError):
        file.set_file_time(date, "test")
예제 #2
0
def test_datetime():
    dt = core.DateTime(2000, 11, 11, 0, 0, 0)
    with open("data.pkl", "wb") as jar:
        pickle.dump(dt, jar)
    with open("data.pkl", "rb") as jar:
        new = pickle.load(jar)
    assert dt == new
    dt.set_timezone("Europe/Berlin")
    tz = core.TimeZone("Europe/Berlin")
    dt.set_timezone(tz)
    assert dt.get_timezone() == tz
    assert dt.to_format("iso") == "2000-11-11T00:00:00+01:00"
    dt.get_date()
    dt.get_time()
    dt.set_time_spec("utc")
    with pytest.raises(InvalidParamError):
        dt.set_time_spec("test")
    assert dt.get_time_spec() == "utc"
예제 #3
0
 def get_datetime(self) -> core.DateTime:
     return core.DateTime(self.dateTime())
예제 #4
0
 def get_expiration(self) -> core.DateTime:
     return core.DateTime(self.expiration())
예제 #5
0
파일: fileinfo.py 프로젝트: phil65/PrettyQt
 def get_last_modified(self) -> core.DateTime:
     return core.DateTime(self.lastModified())
예제 #6
0
파일: fileinfo.py 프로젝트: phil65/PrettyQt
 def get_last_read(self) -> core.DateTime:
     return core.DateTime(self.lastRead())
예제 #7
0
파일: fileinfo.py 프로젝트: phil65/PrettyQt
 def get_metadata_change_time(self) -> core.DateTime:
     return core.DateTime(self.metadataChangeTime())
예제 #8
0
파일: fileinfo.py 프로젝트: phil65/PrettyQt
 def get_birth_time(self) -> core.DateTime:
     return core.DateTime(self.birthTime())
예제 #9
0
 def get_timestamp(self) -> core.DateTime:
     return core.DateTime(self.timestamp())
예제 #10
0
 def get_departure_time(self) -> core.DateTime:
     return core.DateTime(self.departureTime())
예제 #11
0
 def get_last_visited(self) -> core.DateTime:
     return core.DateTime(self.lastVisited())