コード例 #1
0
    def test_updated_fact_same(self, dummy_window, fact):
        """
        Make sure the property returns Fact with matching field values.

        We need to jump through some extra hoops because we the current
        implementation will always set the edited fact to today as well as ignore
        all 'second' time info.
        """
        dialog = dialogs.EditFactDialog(dummy_window, fact)
        result = dialog.updated_fact
        # The default 'raw fact' used in populating the entry field does discard
        # the original facts timeinfos seconds. This would couse a mismatch, so
        # we account for it manually.
        fact.start = fact.start.replace(second=0)
        fact.end = fact.end.replace(second=0)
        assert result.as_tuple() == fact.as_tuple()
コード例 #2
0
ファイル: test_dialogs.py プロジェクト: jtojnar/hamster-gtk
    def test_updated_fact_same(self, dummy_window, fact):
        """
        Make sure the property returns Fact matching field values.

        We need to jump through some extra hoops because we the current
        implementation will always set the edited fact to today as well as ignore
        all 'second' time info.
        """
        dialog = dialogs.EditFactDialog(dummy_window, fact)
        today = datetime.date.today()
        fact.start = datetime.datetime.combine(
            today, fact.start.time()).replace(second=0)
        fact.end = datetime.datetime.combine(today,
                                             fact.end.time()).replace(second=0)
        result = dialog.updated_fact
        assert result.as_tuple() == fact.as_tuple()
コード例 #3
0
ファイル: conftest.py プロジェクト: landonb/hamster-gtk
def edit_fact_dialog(request, fact, dummy_window):
    """Return a edit fact dialog for a generic fact."""
    return dialogs.EditFactDialog(dummy_window, fact)
コード例 #4
0
 def test_init(self, fact, dummy_window):
     result = dialogs.EditFactDialog(dummy_window, fact)
     assert result
コード例 #5
0
 def test_updated_fact_same(self, dummy_window, fact):
     """Make sure the property returns Fact with matching field values."""
     dialog = dialogs.EditFactDialog(dummy_window, fact)
     result = dialog.updated_fact
     assert result.as_tuple() == fact.as_tuple()