(self)
| 1382 | |
| 1383 | @no_type_check |
| 1384 | def test_tz_aware(self): |
| 1385 | self.assertRaises(ValueError, MongoClient, tz_aware="foo") |
| 1386 | |
| 1387 | aware = self.rs_or_single_client(tz_aware=True) |
| 1388 | self.addCleanup(aware.close) |
| 1389 | naive = self.client |
| 1390 | aware.pymongo_test.drop_collection("test") |
| 1391 | |
| 1392 | now = datetime.datetime.now(tz=datetime.timezone.utc) |
| 1393 | aware.pymongo_test.test.insert_one({"x": now}) |
| 1394 | |
| 1395 | self.assertEqual(None, (naive.pymongo_test.test.find_one())["x"].tzinfo) |
| 1396 | self.assertEqual(utc, (aware.pymongo_test.test.find_one())["x"].tzinfo) |
| 1397 | self.assertEqual( |
| 1398 | (aware.pymongo_test.test.find_one())["x"].replace(tzinfo=None), |
| 1399 | (naive.pymongo_test.test.find_one())["x"], |
| 1400 | ) |
| 1401 | |
| 1402 | @client_context.require_ipv6 |
| 1403 | def test_ipv6(self): |
nothing calls this directly
no test coverage detected