How to use is_primitive method in localstack

Best Python code snippet using localstack_python

util_tests.py

Source:util_tests.py Github

copy

Full Screen

...13from jsonstruct.util import *14from jsonstruct._samples import Thing, ListSubclass, DictSubclass15class IsPrimitiveTestCase(unittest.TestCase):16 def test_int(self):17 self.assertTrue(is_primitive(0))18 self.assertTrue(is_primitive(3))19 self.assertTrue(is_primitive(-3))20 def test_float(self):21 self.assertTrue(is_primitive(0))22 self.assertTrue(is_primitive(3.5))23 self.assertTrue(is_primitive(-3.5))24 self.assertTrue(is_primitive(float(3)))25 def test_long(self):26 self.assertTrue(is_primitive(long(3)))27 def test_bool(self):28 self.assertTrue(is_primitive(True))29 self.assertTrue(is_primitive(False))30 def test_None(self):31 self.assertTrue(is_primitive(None))32 def test_str(self):33 self.assertTrue(is_primitive('hello'))34 self.assertTrue(is_primitive(''))35 def test_unicode(self):36 self.assertTrue(is_primitive(u('hello')))37 self.assertTrue(is_primitive(u('')))38 self.assertTrue(is_primitive(unicode('hello')))39 def test_list(self):40 self.assertFalse(is_primitive([]))41 self.assertFalse(is_primitive([4, 4]))42 def test_dict(self):43 self.assertFalse(is_primitive({'key':'value'}))44 self.assertFalse(is_primitive({}))45 def test_tuple(self):46 self.assertFalse(is_primitive((1, 3)))47 self.assertFalse(is_primitive((1,)))48 def test_set(self):49 self.assertFalse(is_primitive(set([1, 3])))50 def test_object(self):51 self.assertFalse(is_primitive(Thing('test')))52class IsCollection(unittest.TestCase):53 def test_list(self):54 self.assertTrue(is_list([1, 2]))55 def test_set(self):56 self.assertTrue(is_set(set([1, 2])))57 def test_tuple(self):58 self.assertTrue(is_tuple((1, 2)))59 def test_dict(self):60 self.assertFalse(is_list({'key':'value'}))61 self.assertFalse(is_set({'key':'value'}))62 self.assertFalse(is_tuple({'key':'value'}))63 def test_other(self):64 self.assertFalse(is_list(1))65 self.assertFalse(is_set(1))...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful