Skip to content
Snippets Groups Projects
Select Git revision
  • 2bc49f7f2cce7dbb8c0c0fd71e08cf37b7d8a0f2
  • master default protected
  • dev protected
  • gitkeep
  • Issue/2463-newCoscinePIDTypes
  • Issue/2309-docs
  • Issue/2259-updatePids
  • Issue/1910-MigrationtoNET6.0
  • Sprint/2022-01
  • Sprint/2021-03
  • Product/1287-dotnet5Sharepoint
  • Topic/1334-dotnet5migration
  • Sprint/2021-01
  • Product/407-net5migration
  • Topic/1226-proxyApiLibraryMigration
  • v3.0.3
  • v3.0.2
  • v3.0.1
  • v3.0.0
  • v2.1.0
  • v2.0.0
  • v1.4.0
  • v1.3.0
  • v1.2.1
  • v1.2.0
  • v1.1.0
  • v1.0.0
27 results

CurrentWebRequest.cs

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    test_create_id.py 929 B
    #!/usr/bin/env python3
    # -*- coding: utf-8 -*-
    """
    Unittests for create_id
    """
    
    import unittest
    import plotid.create_id as cid
    
    
    class TestCreateID(unittest.TestCase):
        """
        Class for all unittests of the create_id module.
        """
    
        def test_existence(self):
            """Test if create_id returns a string."""
            self.assertIsInstance(cid.create_id('time'), str)
            self.assertIsInstance(cid.create_id('random'), str)
    
        def test_errors(self):
            """ Test if Errors are raised when id_method is wrong. """
            with self.assertRaises(ValueError):
                cid.create_id(3)
            with self.assertRaises(ValueError):
                cid.create_id('h')
    
        def test_length(self):
            """ Test if figure_id has the correct length. """
            self.assertEqual(len(cid.create_id('time')), 10)
            self.assertEqual(len(cid.create_id('random')), 8)
    
    
    if __name__ == '__main__':
        unittest.main()