コード例 #1
0
    def test_parse_calendar_day(self):
        date = _parse_calendar_day('1981-04-05')
        self.assertEqual(date.year, 1981)
        self.assertEqual(date.month, 4)
        self.assertEqual(date.day, 5)

        date = _parse_calendar_day('19810405')
        self.assertEqual(date.year, 1981)
        self.assertEqual(date.month, 4)
        self.assertEqual(date.day, 5)
コード例 #2
0
    def test_parse_calendar_day(self):
        testtuples = (('1981-04-05', {'YYYY': '1981', 'MM': '04', 'DD': '05'}),
                      ('19810405', {'YYYY': '1981', 'MM': '04', 'DD': '05'}))

        for testtuple in testtuples:
            mockBuilder = mock.Mock()
            mockBuilder.build_date.return_value = testtuple[1]

            result = _parse_calendar_day(testtuple[0], mockBuilder)

            self.assertEqual(result, testtuple[1])
            mockBuilder.build_date.assert_called_once_with(**testtuple[1])
コード例 #3
0
ファイル: test_date.py プロジェクト: otr0624/StoreApp
    def test_parse_calendar_day(self):
        testtuples = (
            ("1981-04-05", {"YYYY": "1981", "MM": "04", "DD": "05"}),
            ("19810405", {"YYYY": "1981", "MM": "04", "DD": "05"}),
        )

        for testtuple in testtuples:
            mockBuilder = mock.Mock()
            mockBuilder.build_date.return_value = testtuple[1]

            result = _parse_calendar_day(testtuple[0], mockBuilder)

            self.assertEqual(result, testtuple[1])
            mockBuilder.build_date.assert_called_once_with(**testtuple[1])
コード例 #4
0
ファイル: test_date.py プロジェクト: pratiks14/pythonreq
    def test_parse_calendar_day(self):
        date = _parse_calendar_day('1981-04-05')
        self.assertEqual(date, datetime.date(1981, 4, 5))

        date = _parse_calendar_day('19810405')
        self.assertEqual(date, datetime.date(1981, 4, 5))