How to use the quantulum3.classes.Unit function in quantulum3

To help you get started, we’ve selected a few quantulum3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nielstron / quantulum3 / quantulum3 / tests.py View on Github external
print(('Could not find %s, provide "derived" and'
                               ' "entity"' % item['unit']))
                        return
                    if entity == 'unknown':
                        derived = [{
                            'base': l.NAMES[i['base']].entity.name,
                            'power': i['power']
                        } for i in item['dimensions']]
                        entity = c.Entity(name='unknown', dimensions=derived)
                    elif entity in l.ENTITIES:
                        entity = l.ENTITIES[entity]
                    else:
                        print(('Could not find %s, provide "derived" and'
                               ' "entity"' % item['unit']))
                        return
                    unit = c.Unit(
                        name=item['unit'],
                        dimensions=item['dimensions'],
                        entity=entity)
                try:
                    span = next(
                        re.finditer(re.escape(item['surface']),
                                    test['req'])).span()
                except StopIteration:
                    print('Surface mismatch for "%s"' % test['req'])
                    return
                uncert = None
                if 'uncertainty' in item:
                    uncert = item['uncertainty']
                res.append(
                    c.Quantity(
                        value=item['value'],