def test_create_file_with_extension(self): file_path = dm.outputs.testfile(extension='json').__fspath__() self.assertEqual(os.path.split(file_path)[1], 'testfile.json') self.state_check() dataset = DataSet.get() self.assertEqual(dataset.name, "testfile") self.assertEqual(dataset.project, "") self.assertEqual(dataset.branch.name, "master") self.assertEqual( os.path.split(dataset.get_fact('localpath'))[1], 'testfile.json') self.assertTrue( dataset.get_fact('calling_filename').endswith('outputer_tests.py')) self.assertIsNotNone(dataset.get_fact('metaargfilename')) self.assertEqual(dataset.get_fact(DataSetFactKeys.FileExtension), 'json')
def test_create_file_with_timefield_extra_slash(self): file_path = dm.outputs.testfile(timepath='2019/11/03/').__fspath__() file_path = file_path.replace('\\', '/') self.assertTrue(file_path.endswith('testfile/2019/11/03/testfile')) self.state_check() dataset = DataSet.get() self.assertEqual(dataset.name, "testfile") self.assertEqual(dataset.project, "") self.assertEqual(dataset.branch.name, "master") self.assertEqual( dataset.get_fact('localpath').replace('\\', '/')[-20:], '/2019/11/03/testfile') self.assertTrue( dataset.get_fact('calling_filename').endswith('outputer_tests.py')) self.assertIsNone(dataset.get_fact('metaargfilename'))
def test_create_file(self): file_path = dm.outputs.testfile.__fspath__() self.assertEqual(os.path.split(file_path)[1], 'testfile') self.state_check() dataset = DataSet.get() self.assertEqual(dataset.name, "testfile") self.assertEqual(dataset.project, "") self.assertEqual(dataset.branch.name, "master") self.assertEqual( os.path.split(dataset.get_fact('localpath'))[1], 'testfile') self.assertTrue( dataset.get_fact('calling_filename').endswith('outputer_tests.py')) self.assertIsNone( dataset.get_fact('metaargfilename') ) # is None because we didn't declare metaargs or format self.assertEqual(0, dataset.last_server_version)