#
# Copyright (C) 2015 Satoru SATOH <ssato @ redhat.com>
# License: MIT
#
# pylint: disable=missing-docstring
import anyconfig.backend.bson as TT
import tests.backend.ini

from anyconfig.compat import OrderedDict as ODict, IS_PYTHON_3
from tests.common import to_bytes as _bytes


CNF_0 = ODict((("a", 0.1), ("b", _bytes("bbb")),
               ("sect0",
                ODict((("c", [_bytes("x"), _bytes("y"), _bytes("z")]), )))))


class Test10(tests.backend.ini.Test10):

    cnf = CNF_0
    cnf_s = TT.bson.BSON.encode(CNF_0)
    load_options = dict(as_class=dict)
    dump_options = dict(check_keys=True)

    if IS_PYTHON_3:
        is_order_kept = False  # FIXME: Make it work w/ python 3.

    def setUp(self):
        self.psr = TT.Parser()


class Test20(tests.backend.ini.Test20):

    psr_cls = TT.Parser
    cnf = CNF_0
    cnf_s = TT.bson.BSON.encode(CNF_0)
    cnf_fn = "conf0.bson"

# vim:sw=4:ts=4:et:

@@ -16,16 +16,23 @@
 C) 2015 
+- 2017 
 Satoru S
@@ -109,16 +109,128 @@
 ocstring
+,invalid-name,too-few-public-methods%0A# pylint: disable=ungrouped-imports%0Afrom __future__ import absolute_import%0A
 %0Aimport 
@@ -279,19 +279,29 @@
 backend.
-ini
+common as TBC
 %0A%0Afrom a
@@ -338,30 +338,8 @@
 Dict
- as ODict, IS_PYTHON_3
 %0Afro
@@ -390,16 +390,22 @@
 NF_0 = O
+rdered
 Dict(((%22
@@ -451,16 +451,22 @@
         
+      
 (%22sect0%22
@@ -470,26 +470,16 @@
 t0%22,
-%0A                O
+ Ordered
 Dict
@@ -516,131 +516,298 @@
 y%22),
- _bytes(%22z%22)%5D), )))))%0A%0A%0Aclass Test10(tests.backend.ini.Test10):%0A%0A    cnf = CNF_0%0A    cnf_s = TT.bson.BSON.encode(CNF_0)%0A   
+%0A                                                   _bytes(%22z%22)%5D), )))))%0A%0A%0Aclass HasParserTrait(TBC.HasParserTrait):%0A%0A    psr = TT.Parser()%0A    cnf = CNF_0%0A    cnf_s = TT.bson.BSON.encode(cnf)%0A%0A%0Aclass Test_10(TBC.Test_10_dumps_and_loads, HasParserTrait):%0A%0A    # Can't if bson.has_c():%0A    #
  loa
@@ -841,16 +841,18 @@
 ict)%0A   
+ #
  dump_op
@@ -885,147 +885,16 @@
 ue)%0A
-%0A
     
-if IS_PYTHON_3:%0A        is_order_kept = False  # FIXME: Make it work w/ python 3.%0A%0A    def setUp(self):%0A        self.psr = TT.Parser()
+pass
 %0A%0A%0Ac
@@ -906,143 +906,65 @@
 Test
+_
 20(
-tests.backend.ini
+TBC
 .Test
+_
 20
-):%0A%0A    psr_cls = TT.Parser%0A    cnf = CNF_0%0A    cnf_s = TT.bson.BSON.encode(CNF_0)%0A    cnf_fn = %22conf0.bson%22
+_dump_and_load, HasParserTrait):%0A%0A    pass
 %0A%0A# 

switch base test cases of bson backend from tests.backend.ini to tests.backend.common