Changeset f7e47b5 in mod_gnutls


Ignore:
Timestamp:
Jan 3, 2020, 6:06:54 AM (3 months ago)
Author:
Fiona Klute <fiona.klute@…>
Branches:
master
Children:
63e4efe
Parents:
0699668
Message:

Override yaml.YAMLObject.from_yaml() instead of adding constructors

The code is simpler this way, and also avoids running PyYAML functions
on module load.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/mgstest/tests.py

    r0699668 rf7e47b5  
    11#!/usr/bin/python3
    22
    3 # Copyright 2019 Fiona Klute
     3# Copyright 2019-2020 Fiona Klute
    44#
    55# Licensed under the Apache License, Version 2.0 (the "License");
     
    106106
    107107    @classmethod
    108     def _from_yaml(cls, loader, node):
     108    def from_yaml(cls, loader, node):
    109109        fields = loader.construct_mapping(node)
    110110        conn = cls(**fields)
     
    230230
    231231    @classmethod
    232     def _from_yaml(cls, loader, node):
     232    def from_yaml(cls, loader, node):
    233233        fields = loader.construct_mapping(node)
    234234        req = cls(**fields)
     
    303303        if 'body' in self.expect:
    304304            self.check_body(body)
    305 
    306 
    307 
    308 # Override the default constructors. Pyyaml ignores default parameters
    309 # otherwise.
    310 yaml.add_constructor('!request', TestRequest._from_yaml, yaml.Loader)
    311 yaml.add_constructor('!request10', TestReq10._from_yaml, yaml.Loader)
    312 yaml.add_constructor('!connection', TestConnection._from_yaml, yaml.Loader)
    313305
    314306
Note: See TracChangeset for help on using the changeset viewer.