Best Python code snippet using sure_python
test_old_api.py
Source: test_old_api.py
...516def test_within_pass_utc():517 "within(five=miliseconds) gives utc parameter"518 from sure import within, miliseconds519 from datetime import datetime520 def assert_utc(utc):521 assert isinstance(utc, datetime)522 within(five=miliseconds)(assert_utc)()523def test_that_is_a_matcher_should_absorb_callables_to_be_used_as_matcher():524 "that.is_a_matcher should absorb callables to be used as matcher"525 @that.is_a_matcher526 def is_truthful(what):527 assert bool(what), '%s is so untrue' % (what)528 return 'foobar'529 assert that('friend').is_truthful()530 assert_equals(that('friend').is_truthful(), 'foobar')531def test_accepts_setup_list():532 "sure.with_context() accepts a list of callbacks for setup"533 def setup1(context):534 context.first_name = "John"...
tests.py
Source: tests.py
...302 # assert delta == date.tz.utcoffset(date.utc.datetime.replace(tzinfo=None)), (delta, date.tz.utcoffset(date.utc.datetime.replace(tzinfo=None)))303 # assert delta == date.tz.utcoffset(date.utc.naive.datetime), (delta, date.tz.utcoffset(date.utc.naive.datetime))304 assert delta.total_seconds() == -14400, delta.total_seconds()305class BestGuessUtcTest(TestCase):306 def assert_utc(self, value, target):307 target = target.replace(tzinfo=utc)308 result = best_guess_utc(value)309 assert result == target, result310 def test_various(self):311 self.assert_utc('1/6/2013 UTC', dt.datetime(2013, 1, 6))312 self.assert_utc('1/6/2013 EST', dt.datetime(2013, 1, 6, 5))313 self.assert_utc('1/6/2013 BST', dt.datetime(2013, 5, 31, 23))314 self.assert_utc('Tue, 18 Jun 2013 12:19:09 -0400', dt.datetime(2013, 6, 18, 16, 19, 9))315class DocsTest(TestCase):316 def test_old_inline(self):317 result = SimpleDate(timestamp=0, tz='CLST')318 assert str(result) == "1969-12-31 21:00:00.000000 CLST", result319 with self.assertRaises(NoTimezone):320 SimpleDate(dt.datetime(2012, 5, 19, 12, 0, tzinfo=timezone('US/Eastern')), tz='ignored', debug=True)321 result = SimpleDate('2012-05-19 12:00 EDT')322 assert str(result) == "2012-05-19 12:00 EDT", result323class MRUSortedIterableTest(TestCase):324 def test_sorting(self):325 iterable = MRUSortedIterable([1,2,3,4])326 one, two = take(2, iterable)327 assert (one, two) == (1, 2), (one, two)328 two = list(take(1, iterable))[-1]...
sqlite_type_assertions.py
Source: sqlite_type_assertions.py
...13def assert_str(value):14 assert isinstance(value, str)15def assert_str_or_null(value):16 assert isinstance(value, str) or value is None17def assert_utc(value):18 assert isinstance(value, datetime.datetime)19 assert value.tzname() == 'UTC'20def assert_utc_or_null(value):21 if value is None: return22 assert isinstance(value, datetime.datetime)23 assert value.tzname() == 'UTC'24def assert_decimal(value):25 assert isinstance(value, Decimal)26def assert_decimal_or_null(value):27 assert isinstance(value, Decimal) or value is None28def assert_user_types(u: User):29 assert_str(u.username)30 assert_str(u.password_hash)31 assert_utc(u.created_at)32 assert_utc(u.updated_at)33def assert_charge_types(c: Charge):34 assert_str(c.uid)35 assert_int(c.time_to_pay_ms)36 assert_int(c.time_to_complete_ms)37 assert_str_or_null(c.merchant_order_id)38 assert_decimal(c.total)39 assert_str(c.currency)40 assert_decimal_or_null(c.cc_total)41 assert_str_or_null(c.cc_currency)42 assert_str_or_null(c.cc_address)43 assert_decimal_or_null(c.cc_price)44 assert_decimal_or_null(c.usd_total)45 assert_str(c.pay_status)46 assert_str(c.status)47 assert_decimal(c.cc_received_total)48 assert_int(c.confirmations)49 assert_utc_or_null(c.activated_at)50 assert_utc_or_null(c.paid_at)51 assert_utc_or_null(c.completed_at)52 assert_utc_or_null(c.expired_at)53 assert_utc_or_null(c.cancelled_at)54 assert_utc_or_null(c.merchant_callback_url_called_at)55 assert_str_or_null(c.wallet_fingerprint)56 assert_int_or_null(c.address_derivation_index)57 assert_bool(c.status_fixed_manually)58 assert_str_or_null(c.block_explorer_1)59 assert_str_or_null(c.block_explorer_2)60 assert_int(c.subsequent_discrepancies)61 assert_utc(c.created_at)...
Check out the latest blogs from LambdaTest on this topic:
Ever came across the situation where you really need to open a web page fast and it’s taking forever because of slow internet speed? May be someone in your network is downloading a torrent choking the bandwidth?
In today’s scenario, software testing has become an important entity across every domain for the benefits it offers. We have already explored a lot about software testing in general in our post need of software testing.
This article is a part of our Content Hub. For more in-depth resources, check out our content hub on Mobile Testing Tutorial.
Before development of a project begins, the project manager’s job is to determine which methodology should be used for the project life cycle. The 2 most popular methodologies are
In human physiology, vision plays a major role as 83% of the information humans perceive is via sight. So, your website should never lack in visual appeal. In web design, this is even more important. Every new iteration of design leaves some minor deviations. Sometimes, these minor visual deviations can be very hard to fix or unknowingly break the whole user experience. Hence, it is necessary to make sure that your website provides a perfect and working interface design to the user.
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!