How to use test_basics method in SeleniumBase

Best Python code snippet using SeleniumBase

test_timeline.py

Source:test_timeline.py Github

copy

Full Screen

...56 self.item = self.event.item57 def user(self):58 return "comment user"59class TestTimeLineEvent(unittest.TestCase):60 def test_basics(self):61 e = TimeLineEvent(DummyComment())62 now = datetime.now()63 five_mins = timedelta(minutes=5)64 self.assertEqual(e.label(), None)65 self.assertTrue(e.timestamp() < (now + five_mins))66 self.assertTrue(e.timestamp() > (now - five_mins))67 self.assertEqual(e.event_type(), "event")68 self.assertEqual(e.title(), "dummy item")69 self.assertEqual(e.body(), "Dummy Comment")70 self.assertEqual(e.user(), "comment user")71 self.assertEqual(e.url(), "item absolute url")72 def test_naive_date_compare(self):73 e1 = TimeLineEvent(DummyComment())74 e2 = TimeLineEvent(DummyCommentTzAware())75 try:76 e1 < e277 except TypeError:78 self.fail('Compare between naive and non-naive timestamps failure')79class TestTimeLineComment(unittest.TestCase):80 def test_basics(self):81 e = TimeLineComment(DummyComment())82 self.assertEqual(e.label(), "COMMENT ADDED")83 self.assertEqual(e.timestamp(), "comment add_date_time")84 self.assertEqual(e.event_type(), "comment")85 self.assertEqual(e.title(), "dummy item")86 self.assertEqual(e.body(), "Dummy Comment")87 self.assertEqual(e.user(), "comment user")88 self.assertEqual(e.url(), "item absolute url")89class DummyActualTime(object):90 def __init__(self):91 class DummyUser(object):92 userprofile = "resolver"93 self.completed = "completed"94 self.user = DummyUser()95 self.actual_time = timedelta(hours=1)96 self.item = DummyItem()97class TestTimeLineActualTime(unittest.TestCase):98 def test_basics(self):99 e = TimeLineActualTime(DummyActualTime())100 self.assertEqual(e.label(), "TIME LOGGED")101 self.assertEqual(e.timestamp(), "completed")102 self.assertEqual(e.event_type(), "actual_time")103 self.assertEqual(e.title(), "dummy item")104 self.assertEqual(e.body(), "1.00 hour")105 self.assertEqual(e.user(), "resolver")106 self.assertEqual(e.url(), "item absolute url")107class DummyStatus(object):108 def __init__(self):109 class DummyUser(object):110 userprofile = "status user"111 self.author = DummyUser()112 self.added = timezone.now().date()113 self.body = "body"114class TestTimeLineStatus(unittest.TestCase):115 def test_basics(self):116 e = TimeLineStatus(DummyStatus())117 self.assertEqual(e.label(), "STATUS UPDATE")118 self.assertEqual(e.event_type(), "status_update")119 self.assertEqual(e.title(), "status update")120 self.assertEqual(e.body(), "body")121 self.assertEqual(e.user(), "status user")122 self.assertEqual(e.url(), None)123class DummyPost(object):124 def __init__(self):125 self.added = "added"126 self.user = UserFactory()127 self.subject = "subject"128 self.body = "body"129 def get_absolute_url(self):130 return "post absolute url"131class TestTimeLinePost(unittest.TestCase):132 def test_basics(self):133 e = TimeLinePost(DummyPost())134 self.assertEqual(e.label(), "FORUM POST")135 self.assertEqual(e.event_type(), "forum_post")136 self.assertEqual(e.title(), "subject")137 self.assertEqual(e.body(), "body")138 self.assertEqual(e.user().status, "active")139 self.assertEqual(e.url(), "post absolute url")140class DummyMilestone(object):141 def __init__(self):142 self.target_date = timezone.now().date()143 self.name = "milestone name"144 def get_absolute_url(self):145 return "milestone url"146class TestTimeLineMilestone(unittest.TestCase):147 def test_basics(self):148 e = TimeLineMilestone(DummyMilestone())149 self.assertEqual(e.label(), "MILESTONE")150 self.assertEqual(e.event_type(), "milestone")151 self.assertEqual(e.title(), "milestone name")152 self.assertEqual(e.body(), None)153 self.assertEqual(e.user(), None)...

Full Screen

Full Screen

test_normalizer.py

Source:test_normalizer.py Github

copy

Full Screen

...8from rl.core.function_approximators import normalizers as Nor9import functools10def assert_array(a,b):11 assert np.all(np.isclose(a-b,0.0, atol=1e-5))12def test_basics(cls):13 shape = (1,3,4)14 nor = cls(shape)15 xs = np.random.random([10]+list(shape))16 nxs = nor.normalize(xs)17 assert np.all(np.isclose(xs,nxs)) # should be identity before any call of update18 # single instance19 x = np.random.random(shape)20 nx = nor(x)21 assert np.all(np.isclose(x,nx))22 # copy23 nor2 = copy.deepcopy(nor)24 nor.update(xs)25 assert nor._initialized and not nor2._initialized26 # save and load27 import tempfile28 with tempfile.TemporaryDirectory() as path:29 nor.save(path)30 nor2.restore(path)31 assert_array(nor(x), nor2(x))32 # reset33 nor.reset()34 assert nor._initialized is False35class Tests(unittest.TestCase):36 def test_normalizers(self):37 test_basics(Nor.Normalizer)38 test_basics(Nor.NormalizerStd)39 test_basics(Nor.NormalizerMax)40 test_basics(Nor.tfNormalizerStd)41 test_basics(Nor.tfNormalizerMax)42 def test_normalizer_std(self):43 shape = (1,2,3)44 nor = Nor.NormalizerStd(shape)45 xs = np.random.random([10]+list(shape))46 nor.update(xs)47 assert np.all(np.isclose(nor._bias-np.mean(xs,axis=0),0.0))48 assert np.all(np.isclose(nor._scale-np.std(xs,axis=0),0.0))49 assert nor._initialized is True50 xs2 = np.random.random([10]+list(shape))51 xs = np.concatenate((xs,xs2))52 nor.update(xs2)53 assert np.all(np.isclose(nor._bias-np.mean(xs,axis=0),0.0))54 assert np.all(np.isclose(nor._scale-np.std(xs,axis=0),0.0))55 def test_tf_normalizers(self):...

Full Screen

Full Screen

test_external.py

Source:test_external.py Github

copy

Full Screen

1from testing.external.common.client import run_test_as_subprocess2class TestCommand:3 def test_basics_work(self):4 assert run_test_as_subprocess('test_command/test_basics') == 05 def test_interaction(self):6 assert run_test_as_subprocess('test_command/test_interaction') == 07class TestNaturalLanguage:8 def test_basics_work(self):9 assert run_test_as_subprocess('test_natural_language/test_basics') == 010class TestMessage:11 def test_basics_work(self):12 assert run_test_as_subprocess('test_message/test_basics') == 013class TestNoticeRequest:14 def test_basics_work(self):...

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 SeleniumBase 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