How to use _assert_equals method in pandera

Best Python code snippet using pandera_python

merge_directories_test.py

Source:merge_directories_test.py Github

copy

Full Screen

...25 if not os.listdir(join(root, the_dir)):26 relpath = os.path.relpath(join(root, the_dir), folder)27 ret.append(relpath)28 return ret29 def _assert_equals(self, list1, list2):30 self.assertEqual(set([el.replace("/", "\\") for el in list1]),31 set([el.replace("/", "\\") for el in list2]))32 def test_empty_dest_merge(self):33 files = ["file.txt", "subdir/file2.txt"]34 self._save(self.source, files)35 merge_directories(self.source, self.dest)36 self._assert_equals(self._get_paths(self.dest), files)37 def test_non_empty_dest_merge(self):38 files = ["file.txt", "subdir/file2.txt"]39 self._save(self.source, files, "fromsrc")40 files_dest = ["file.txt", "subdir2/file2.txt"]41 self._save(self.dest, files_dest, "fromdest")42 merge_directories(self.source, self.dest)43 self._assert_equals(self._get_paths(self.dest), files + files_dest)44 # File from src overrides file from dest45 self.assertEqual(load(join(self.dest, "file.txt")), "fromsrc")46 def test_nested_directories(self):47 self.dest = join(self.source, "destination_dir")48 files_dest = ["file.txt", "subdir2/file2.txt"]49 self._save(self.dest, files_dest, "fromdest")50 mkdir(join(self.dest, "empty_folder", "subempty_folder"))51 files = ["file.txt", "subdir/file2.txt"]52 self._save(self.source, files, "fromsrc")53 merge_directories(self.source, self.dest)54 self._assert_equals(self._get_paths(self.dest), files + files_dest +55 ['empty_folder/subempty_folder', ])56 self.assertEqual(load(join(self.dest, "file.txt")), "fromsrc")57 self.assertEqual(load(join(self.dest, "subdir2/file2.txt")), "fromdest")58 self.assertEqual(load(join(self.dest, "subdir/file2.txt")), "fromsrc")59 def test_same_directory(self):60 files = ["file.txt", "subdir/file2.txt"]61 self._save(self.source, files, "fromsrc")62 merge_directories(self.source, self.source)63 self._assert_equals(self._get_paths(self.source), files)64 def test_parent_directory(self):65 files_dest = ["file.txt", "subdir2/file2.txt"]66 self._save(self.dest, files_dest, "fromdest")67 self.source = join(self.dest, "source_folder")68 files = ["file.txt", "subdir/file2.txt"]69 self._save(self.source, files, "fromsrc")70 merge_directories(self.source, self.dest)71 shutil.rmtree(self.source)72 self._assert_equals(self._get_paths(self.dest), files + files_dest)73 self.assertEqual(load(join(self.dest, "file.txt")), "fromsrc")74 self.assertEqual(load(join(self.dest, "subdir2/file2.txt")), "fromdest")75 self.assertEqual(load(join(self.dest, "subdir/file2.txt")), "fromsrc")76 def test_excluded_dirs(self):77 files = ["file.txt", "subdir/file2.txt", "subdir/file3.txt", "other_dir/somefile.txt",78 "other_dir/somefile2.txt"]79 self._save(self.source, files, "fromsrc")80 files_dest = ["file.txt", "subdir2/file2.txt"]81 self._save(self.dest, files_dest, "fromdest")82 # Excluded one file from other_dir and the whole subdir83 merge_directories(self.source, self.dest, excluded=["other_dir/somefile.txt", "subdir"])84 self._assert_equals(self._get_paths(self.dest), ["file.txt",85 "subdir2/file2.txt",86 "other_dir/somefile2.txt"])87 # Excluded one from dest (no sense) and one from origin88 merge_directories(self.source, self.dest, excluded=["subdir2/file2.txt",89 "subdir",90 "other_dir/somefile.txt"])91 self._assert_equals(self._get_paths(self.dest), ["file.txt",92 "subdir2/file2.txt",...

Full Screen

Full Screen

test_styles.py

Source:test_styles.py Github

copy

Full Screen

...18 def test_style_key_error(self):19 with pytest.raises(KeyError):20 self.container.styles.this_does_not_exist = "Hello"21 def test_style_expansion(self):22 def _assert_equals(short: str, long: str) -> bool:23 assert ptg.StyleManager.expand_shorthand(short).markup == long24 _assert_equals("60", "[60]{item}")25 _assert_equals("141 bold", "[141 bold]{item}")26 _assert_equals("", "{item}")27 _assert_equals("[!rainbow]Test {item}{depth}", "[!rainbow]Test {item}{depth}")28 def test_old_api(self):29 self.container.set_style("border", "60")30 assert self.container._get_style("border") == self.target_formatter31 self.container.set_style("border", self.target_formatter)32 assert self.container._get_style("border") == self.target_formatter33 assert self.container.styles.border == self.container._get_style("border")34 def test_multiple_styles(self):35 self.container.styles.border__corner = "60"36 assert (37 self.container.styles.border38 == self.container.styles.corner39 == self.target_formatter...

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